diff --git a/config/cmd/cmd.go b/config/cmd/cmd.go index 7b90b29a..021156b9 100644 --- a/config/cmd/cmd.go +++ b/config/cmd/cmd.go @@ -494,6 +494,7 @@ func (c *cmd) Before(ctx *cli.Context) error { *c.opts.Auth = a() clientOpts = append(clientOpts, client.Auth(*c.opts.Auth)) + serverOpts = append(serverOpts, server.Auth(*c.opts.Auth)) } // Set the profile diff --git a/service.go b/service.go index 2feb5db4..36044338 100644 --- a/service.go +++ b/service.go @@ -34,8 +34,9 @@ func newService(opts ...Option) Service { // service name serviceName := options.Server.Options().Name - // TODO: better accessors - authFn := func() auth.Auth { return options.Auth } + // authFn returns the auth, we pass as a function since auth + // has not yet been set at this point. + authFn := func() auth.Auth { return options.Server.Options().Auth } // wrap client to inject From-Service header on any calls options.Client = wrapper.FromService(serviceName, options.Client, authFn) diff --git a/util/wrapper/wrapper.go b/util/wrapper/wrapper.go index a2878a20..a599ac80 100644 --- a/util/wrapper/wrapper.go +++ b/util/wrapper/wrapper.go @@ -2,7 +2,6 @@ package wrapper import ( "context" - "fmt" "strings" "github.com/micro/go-micro/v2/auth" @@ -179,7 +178,6 @@ func AuthHandler(fn func() auth.Auth) server.HandlerWrapper { logger.Errorf("Missing request namespace") namespace = auth.DefaultNamespace } - fmt.Printf("Namespace is %v\n", namespace) // Inspect the token and get the account account, err := a.Inspect(token)