permission

package
v0.0.0-...-d74b047 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 userspace 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 {
	Authenticate(ctx context.Context, level proto.TokenLevel) error
}

Server authenticator interface.

type GatewayHandler

type GatewayHandler func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error

type Implementor

type Implementor interface {
	TokenRequired(fullPath string) proto.TokenLevel
}

gRPC implementor interface.

type Service

type Service interface {
	ScopedGRPCServer(scope proto.VisibleScope) []*grpc.Server
	RegisterGateway(scope proto.VisibleScope, handlers ...GatewayHandler) error
}

Jump to

Keyboard shortcuts

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