Documentation ¶
Index ¶
- func AccountSecretFromContext(ctx context.Context) *secret.Info
- func ComponentNameFromContext(ctx context.Context) string
- func ContextWithComponentName(ctx context.Context, component string) context.Context
- func StreamServerInterceptor(v Authenticator) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(v Authenticator) grpc.UnaryServerInterceptor
- type Authenticator
- type HttpHandler
- type Implementor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(v Authenticator) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor that authenticates incoming messages.
The stage at which unauthenticated messages will be rejected with `PermissionDenied` varies based on the type of the RPC. For `ServerStream` (1:m) requests, it will happen before reaching any user space handlers. For `ClientStream` (n:1) or `BidiStream` (n:m) RPCs, the messages will be rejected on calls to `stream.Recv()`.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(v Authenticator) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor that authenticates incoming messages.
Invalid messages will be rejected with `PermissionDenied` before reaching any userspace handlers.
Types ¶
type Authenticator ¶
type Authenticator interface { // ServiceComponentName returns the component name implements the service method. ServiceComponentName(serviceMethod string) string // RegisterServiceSubjects registers required method subjects of the service. // The map key of the parameter is the full url path of the method. RegisterServiceSubjects(component string, serviceMethodSubjects map[string][]permission.Subject, serviceMethodRoles map[string][]string) // Authenticate a request specified by the full url path of the method. Authenticate(ctx context.Context, serviceMethod string) (*secret.Info, error) }
Authenticator interface.
type HttpHandler ¶
type HttpHandler interface { // Handle registers the handler for the given pattern. Handle(pattern string, handler http.Handler) // HandleFunc registers the handler function for the given pattern. HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) }
HttpHandler interface.
type Implementor ¶
type Implementor interface { // Context returns the service context. Context() context.Context // UnaryInterceptor returns the unary server interceptor for local gateway handler server. UnaryInterceptor() grpc.UnaryServerInterceptor // StreamInterceptor returns the stream server interceptor for local gateway handler server. StreamInterceptor() grpc.StreamServerInterceptor // GetGRPCServer returns gRPC server of the specified visible scope. GetGRPCServer(scope permission.VisibleScope) []*grpc.Server // GetGatewayMux returns gateway mux of the specified visible scope. GetGatewayMux(scope permission.VisibleScope) []*runtime.ServeMux }
Implementor interface.