middlewares

package
v0.0.0-...-8e0b234 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: OSL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientHeaderKey = "client-id"
	ClientSecretKey = "client-secret"
)

Variables

This section is empty.

Functions

func GrpcAuthUnaryServerInterceptor

func GrpcAuthUnaryServerInterceptor() grpc.UnaryServerInterceptor

GrpcAuthUnaryServerInterceptor returns a new unary server interceptor for auth.

Types

type AuthUnaryInterceptor

type AuthUnaryInterceptor struct {
}

Req/Resp 认证中间件

func (*AuthUnaryInterceptor) Auth

func (i *AuthUnaryInterceptor) Auth(
	ctx context.Context, req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (resp interface{}, err error)

func (*AuthUnaryInterceptor) GetClientCredentialsFromMeta

func (a *AuthUnaryInterceptor) GetClientCredentialsFromMeta(md metadata.MD) (
	clientId, clientSecret string)

Auth头, client-id/client-secret

Jump to

Keyboard shortcuts

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