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
Click to show internal directories.
Click to hide internal directories.