1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-02-04 18:21:53 +02:00

Add jwt auth automatically discover (#2242)

* Add grpc,memory,quic transport automatically discover

* Add grpc,memory,quic transport automatically discover

* Add jwt auth automatically discover

* Add jwt auth automatically discover
This commit is contained in:
simon 2021-09-03 14:49:49 +08:00 committed by GitHub
parent f444dadd50
commit 80dbe51077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -408,6 +408,14 @@ 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"); len(name) > 0 {
r, ok := c.opts.Auths[name]
if !ok {
return fmt.Errorf("Unsupported auth: %s", name)
}
*c.opts.Auth = r(authOpts...)
}
// Set the registry
if name := ctx.String("registry"); len(name) > 0 && (*c.opts.Registry).String() != name {