From bd70820b6bd035b3d7802e6add6ef30ffa31a67e Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Tue, 31 Mar 2020 13:48:28 +0100 Subject: [PATCH] ServicePrivileges => ServiceToken --- client/grpc/grpc.go | 2 +- client/options.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/grpc/grpc.go b/client/grpc/grpc.go index 54c4599d..8cd55dd8 100644 --- a/client/grpc/grpc.go +++ b/client/grpc/grpc.go @@ -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 // 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 header["authorization"] = auth.BearerScheme + t.Token } diff --git a/client/options.go b/client/options.go index 72d9d2bd..378957ed 100644 --- a/client/options.go +++ b/client/options.go @@ -58,7 +58,7 @@ type CallOptions struct { // Request/Response timeout RequestTimeout time.Duration // Use the services own auth token - ServicePrivileges bool + ServiceToken bool // Middleware for low level call func 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 -func WithServicePrivileges() CallOption { +func WithServiceToken() CallOption { return func(o *CallOptions) { - o.ServicePrivileges = true + o.ServiceToken = true } }