From 0ec2399a2c4ca2df55013301cc36686e6ce62120 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Sat, 12 Dec 2020 19:39:04 +0000 Subject: [PATCH] fix command --- cmd/cmd.go | 64 ------------------------------------------------------ 1 file changed, 64 deletions(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index 98b082c0..20ef0e16 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -8,7 +8,6 @@ import ( "time" "github.com/micro/go-micro/v2/auth" - "github.com/micro/go-micro/v2/auth/provider" "github.com/micro/go-micro/v2/broker" "github.com/micro/go-micro/v2/client" "github.com/micro/go-micro/v2/client/grpc" @@ -69,10 +68,6 @@ import ( // auth jwtAuth "github.com/micro/go-micro/v2/auth/jwt" - - // auth providers - "github.com/micro/go-micro/v2/auth/provider/basic" - "github.com/micro/go-micro/v2/auth/provider/oauth" ) type Cmd interface { @@ -283,36 +278,6 @@ var ( EnvVars: []string{"MICRO_AUTH_PRIVATE_KEY"}, Usage: "Private key for JWT auth (base64 encoded PEM)", }, - &cli.StringFlag{ - Name: "auth_provider", - EnvVars: []string{"MICRO_AUTH_PROVIDER"}, - Usage: "Auth provider used to login user", - }, - &cli.StringFlag{ - Name: "auth_provider_client_id", - EnvVars: []string{"MICRO_AUTH_PROVIDER_CLIENT_ID"}, - Usage: "The client id to be used for oauth", - }, - &cli.StringFlag{ - Name: "auth_provider_client_secret", - EnvVars: []string{"MICRO_AUTH_PROVIDER_CLIENT_SECRET"}, - Usage: "The client secret to be used for oauth", - }, - &cli.StringFlag{ - Name: "auth_provider_endpoint", - EnvVars: []string{"MICRO_AUTH_PROVIDER_ENDPOINT"}, - Usage: "The enpoint to be used for oauth", - }, - &cli.StringFlag{ - Name: "auth_provider_redirect", - EnvVars: []string{"MICRO_AUTH_PROVIDER_REDIRECT"}, - Usage: "The redirect to be used for oauth", - }, - &cli.StringFlag{ - Name: "auth_provider_scope", - EnvVars: []string{"MICRO_AUTH_PROVIDER_SCOPE"}, - Usage: "The scope to be used for oauth", - }, &cli.StringFlag{ Name: "config", EnvVars: []string{"MICRO_CONFIG"}, @@ -371,11 +336,6 @@ var ( "jwt": jwtAuth.NewAuth, } - DefaultAuthProviders = map[string]func(...provider.Option) provider.Provider{ - "oauth": oauth.NewProvider, - "basic": basic.NewProvider, - } - DefaultProfiles = map[string]func(...profile.Option) profile.Profile{ "http": http.NewProfile, "pprof": pprof.NewProfile, @@ -528,30 +488,6 @@ func (c *cmd) Before(ctx *cli.Context) error { if len(ctx.String("auth_namespace")) > 0 { authOpts = append(authOpts, auth.Namespace(ctx.String("auth_namespace"))) } - if name := ctx.String("auth_provider"); len(name) > 0 { - p, ok := DefaultAuthProviders[name] - if !ok { - return fmt.Errorf("AuthProvider %s not found", name) - } - - var provOpts []provider.Option - clientID := ctx.String("auth_provider_client_id") - clientSecret := ctx.String("auth_provider_client_secret") - if len(clientID) > 0 || len(clientSecret) > 0 { - provOpts = append(provOpts, provider.Credentials(clientID, clientSecret)) - } - if e := ctx.String("auth_provider_endpoint"); len(e) > 0 { - provOpts = append(provOpts, provider.Endpoint(e)) - } - if r := ctx.String("auth_provider_redirect"); len(r) > 0 { - provOpts = append(provOpts, provider.Redirect(r)) - } - if s := ctx.String("auth_provider_scope"); len(s) > 0 { - provOpts = append(provOpts, provider.Scope(s)) - } - - authOpts = append(authOpts, auth.Provider(p(provOpts...))) - } // Set the registry if name := ctx.String("registry"); len(name) > 0 && (*c.opts.Registry).String() != name {