Fix go-micro auth wrapper init
This commit is contained in:
parent
ebb1a42d48
commit
dea2d7ab9f
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user