service

package
v0.0.0-...-49c8f32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2021 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountSecretFromContext

func AccountSecretFromContext(ctx context.Context) *secret.Info

func ComponentNameFromContext

func ComponentNameFromContext(ctx context.Context) string

func ContextWithComponentName

func ContextWithComponentName(ctx context.Context, component string) context.Context

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 {
	// Return the component name implements the service method.
	ServiceComponentName(serviceMethod string) string

	// Register 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)
}

Server authenticator interface.

type Implementor

type Implementor interface {
	// Return server context.
	Context() context.Context

	// Return the unary server interceptor for local gateway handler server.
	UnaryInterceptor() grpc.UnaryServerInterceptor

	// Return the stream server interceptor for local gateway handler server.
	StreamInterceptor() grpc.StreamServerInterceptor

	// Get gRPC server of the specified visible scope.
	GetGRPCServer(scope permission.VisibleScope) []*grpc.Server

	// Get gateway mux of the specified visible scope.
	GetGatewayMux(scope permission.VisibleScope) []*runtime.ServeMux
}

Service implementor interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL