grpc_permission

package
v0.8.20 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(permissionFunc PermissionStreamFunc) grpc.StreamServerInterceptor

StreamServerInterceptor returns a new unary server interceptors that performs per-request permission checks.

func UnaryServerInterceptor

func UnaryServerInterceptor(permissionFunc PermissionUnaryFunc) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptors that performs per-request permission checks.

Types

type GetPermsRemapFunc

type GetPermsRemapFunc interface {
	GetPermsRemap() map[string]string
}

GetPermsRemap

type PermissionStreamFunc

type PermissionStreamFunc func(ctx context.Context, srv interface{}, info *grpc.StreamServerInfo) (context.Context, error)

type PermissionUnaryFunc

type PermissionUnaryFunc func(ctx context.Context, info *grpc.UnaryServerInfo) (context.Context, error)

Permission*Func is the pluggable function that performs authentication.

The passed in `Context` will contain the gRPC metadata.MD object (for header-based authentication) and the peer.Peer information that can contain transport-based credentials (e.g. `credentials.PermissionInfo`).

The returned context will be propagated to handlers, allowing user changes to `Context`. However, please make sure that the `Context` returned is a child `Context` of the one passed in.

If error is returned, its `grpc.Code()` will be returned to the user as well as the verbatim message. Please make sure you use `codes.Unauthenticated` (lacking auth) and `codes.PermissionDenied` (authed, but lacking perms) appropriately.

type ServiceStreamPermissionFuncOverride

type ServiceStreamPermissionFuncOverride interface {
	PermissionStreamFuncOverride(ctx context.Context, srv interface{}, info *grpc.StreamServerInfo) (context.Context, error)
}

ServiceStreamPermissionFuncOverride

type ServiceUnaryPermissionFuncOverride

type ServiceUnaryPermissionFuncOverride interface {
	PermissionUnaryFuncOverride(ctx context.Context, info *grpc.UnaryServerInfo) (context.Context, error)
}

ServiceUnaryPermissionFuncOverride

Jump to

Keyboard shortcuts

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