ServicePrivileges => ServiceToken
This commit is contained in:
parent
956029ae3d
commit
bd70820b6b
@ -133,7 +133,7 @@ func (g *grpcClient) call(ctx context.Context, node *registry.Node, req client.R
|
|||||||
|
|
||||||
// if the caller specifies using service privelages, and the client
|
// if the caller specifies using service privelages, and the client
|
||||||
// has auth set, override the authorization header
|
// has auth set, override the authorization header
|
||||||
if opts.ServicePrivileges && g.opts.Auth != nil && g.opts.Auth.Options().Token != nil {
|
if opts.ServiceToken && g.opts.Auth != nil && g.opts.Auth.Options().Token != nil {
|
||||||
t := g.opts.Auth.Options().Token
|
t := g.opts.Auth.Options().Token
|
||||||
header["authorization"] = auth.BearerScheme + t.Token
|
header["authorization"] = auth.BearerScheme + t.Token
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ type CallOptions struct {
|
|||||||
// Request/Response timeout
|
// Request/Response timeout
|
||||||
RequestTimeout time.Duration
|
RequestTimeout time.Duration
|
||||||
// Use the services own auth token
|
// Use the services own auth token
|
||||||
ServicePrivileges bool
|
ServiceToken bool
|
||||||
|
|
||||||
// Middleware for low level call func
|
// Middleware for low level call func
|
||||||
CallWrappers []CallWrapper
|
CallWrappers []CallWrapper
|
||||||
@ -303,11 +303,11 @@ func WithDialTimeout(d time.Duration) CallOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithServicePrivileges is a CallOption which overrides the
|
// WithServiceToken is a CallOption which overrides the
|
||||||
// authorization header with the services own auth token
|
// authorization header with the services own auth token
|
||||||
func WithServicePrivileges() CallOption {
|
func WithServiceToken() CallOption {
|
||||||
return func(o *CallOptions) {
|
return func(o *CallOptions) {
|
||||||
o.ServicePrivileges = true
|
o.ServiceToken = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user