From b2e0a7d684b304a58b2b06211fbd5c7731e1b24a Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 15 Feb 2021 10:55:08 +0100 Subject: [PATCH] rpcperms: export macaroon interceptor methods Since we need access to these methods from external subservers in some cases, we export them. --- rpcperms/interceptor.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rpcperms/interceptor.go b/rpcperms/interceptor.go index eb3370b1..207344e3 100644 --- a/rpcperms/interceptor.go +++ b/rpcperms/interceptor.go @@ -193,10 +193,10 @@ func (r *InterceptorChain) CreateServerOpts() []grpc.ServerOption { // We'll add the macaroon interceptors. If macaroons aren't disabled, // then these interceptors will enforce macaroon authentication. unaryInterceptors = append( - unaryInterceptors, r.macaroonUnaryServerInterceptor(), + unaryInterceptors, r.MacaroonUnaryServerInterceptor(), ) strmInterceptors = append( - strmInterceptors, r.macaroonStreamServerInterceptor(), + strmInterceptors, r.MacaroonStreamServerInterceptor(), ) // Get interceptors for Prometheus to gather gRPC performance metrics. @@ -300,9 +300,9 @@ func (r *InterceptorChain) checkMacaroon(ctx context.Context, return validator.ValidateMacaroon(ctx, uriPermissions, fullMethod) } -// macaroonUnaryServerInterceptor is a GRPC interceptor that checks whether the +// MacaroonUnaryServerInterceptor is a GRPC interceptor that checks whether the // request is authorized by the included macaroons. -func (r *InterceptorChain) macaroonUnaryServerInterceptor() grpc.UnaryServerInterceptor { +func (r *InterceptorChain) MacaroonUnaryServerInterceptor() grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { @@ -316,9 +316,9 @@ func (r *InterceptorChain) macaroonUnaryServerInterceptor() grpc.UnaryServerInte } } -// macaroonStreamServerInterceptor is a GRPC interceptor that checks whether +// MacaroonStreamServerInterceptor is a GRPC interceptor that checks whether // the request is authorized by the included macaroons. -func (r *InterceptorChain) macaroonStreamServerInterceptor() grpc.StreamServerInterceptor { +func (r *InterceptorChain) MacaroonStreamServerInterceptor() grpc.StreamServerInterceptor { return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {