Auth Wrapper (#1174)
* Auth Wrapper * Tweak cmd flag * auth_excludes => auth_exclude * Make Auth.Excludes variadic * Use metadata.Get (passes through http and http2 it will go through various case formats) * fix auth wrapper auth.Auth interface initialisation Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
|
||||
// Options for micro service
|
||||
type Options struct {
|
||||
Auth auth.Auth
|
||||
Broker broker.Broker
|
||||
Cmd cmd.Cmd
|
||||
Client client.Client
|
||||
@@ -40,6 +41,7 @@ type Options struct {
|
||||
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{
|
||||
Auth: auth.DefaultAuth,
|
||||
Broker: broker.DefaultBroker,
|
||||
Cmd: cmd.DefaultCmd,
|
||||
Client: client.DefaultClient,
|
||||
@@ -127,6 +129,7 @@ func Tracer(t trace.Tracer) Option {
|
||||
// Auth sets the auth for the service
|
||||
func Auth(a auth.Auth) Option {
|
||||
return func(o *Options) {
|
||||
o.Auth = a
|
||||
o.Server.Init(server.Auth(a))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user