Documentation
¶
Index ¶
- func CtxWithIncomingToken(ctx context.Context, token string) context.Context
- func CtxWithToken(ctx context.Context, token string) context.Context
- func ErrToStatus(err error) *status.Status
- func ForwardErrorf(code codes.Code, formatter string, args ...interface{}) error
- func ForwardFromError(code codes.Code, err error) error
- func IsContextCanceled(err error) bool
- func IsContextDeadlineExceeded(err error) bool
- func NewOAuthAccess(getTokenFunc OAuthGetTokenFunc) credentials.PerRPCCredentials
- func OwnerFromOutgoingTokenMD(ctx context.Context, ownerClaim string) (string, error)
- func OwnerFromTokenMD(ctx context.Context, ownerClaim string) (string, error)
- func ParseOwnerFromJwtToken(ownerClaim, rawJwtToken string) (string, error)
- func StreamServerInterceptor(intercept Interceptor) grpc.StreamServerInterceptor
- func StreamServerInterceptorOption(intercept Interceptor) grpc.ServerOption
- func SubjectFromTokenMD(ctx context.Context) (string, error)
- func TokenFromMD(ctx context.Context) (string, error)
- func TokenFromOutgoingMD(ctx context.Context) (string, error)
- func UnaryServerInterceptor(intercept Interceptor) grpc.UnaryServerInterceptor
- func UnaryServerInterceptorOption(intercept Interceptor) grpc.ServerOption
- type AuthInterceptors
- type Claims
- type ClaimsFunc
- type Interceptor
- type Iterator
- type OAuthGetTokenFunc
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtxWithIncomingToken ¶
CtxWithIncomingToken stores token to ctx of response.
func CtxWithToken ¶
CtxWithToken stores token to ctx of request.
func ErrToStatus ¶
func ForwardErrorf ¶
ForwardErrorf tries to unwrap args as error with GRPCStatus() and forward original code and details.
func ForwardFromError ¶
ForwardFromError tries to unwrap err as GRPCStatus() and forward original code and details.
func IsContextCanceled ¶
func NewOAuthAccess ¶
func NewOAuthAccess(getTokenFunc OAuthGetTokenFunc) credentials.PerRPCCredentials
NewOAuthAccess constructs the PerRPCCredentials using a given token.
func OwnerFromOutgoingTokenMD ¶
OwnerFromOutgoingTokenMD extracts ownerClaim from token stored by CtxWithToken.
func OwnerFromTokenMD ¶
OwnerFromTokenMD is a helper function for extracting the ownerClaim from the :authorization gRPC metadata of the request.
func ParseOwnerFromJwtToken ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(intercept Interceptor) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new unary server interceptors that performs per-request auth.
func StreamServerInterceptorOption ¶
func StreamServerInterceptorOption(intercept Interceptor) grpc.ServerOption
func SubjectFromTokenMD ¶
SubjectFromTokenMD is a helper function for extracting the sub claim from the :authorization gRPC metadata of the request.
func TokenFromMD ¶
TokenFromMD is a helper function for extracting the :authorization header from the gRPC metadata of the request.
func TokenFromOutgoingMD ¶
TokenFromOutgoingMD extracts token stored by CtxWithToken.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(intercept Interceptor) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptors that performs per-request auth.
func UnaryServerInterceptorOption ¶
func UnaryServerInterceptorOption(intercept Interceptor) grpc.ServerOption
Types ¶
type AuthInterceptors ¶
type AuthInterceptors struct {
// contains filtered or unexported fields
}
func MakeAuthInterceptors ¶
func MakeAuthInterceptors(authFunc Interceptor, whiteListedMethods ...string) AuthInterceptors
func MakeJWTInterceptors ¶
func MakeJWTInterceptors(keyCache *jwt.KeyCache, claims ClaimsFunc, whiteListedMethods ...string) AuthInterceptors
func (AuthInterceptors) Stream ¶
func (f AuthInterceptors) Stream() grpc.StreamServerInterceptor
func (AuthInterceptors) Unary ¶
func (f AuthInterceptors) Unary() grpc.UnaryServerInterceptor
type Interceptor ¶
func ValidateJWT ¶
func ValidateJWT(keyCache *jwt.KeyCache, claims ClaimsFunc) Interceptor
func ValidateJWTWithValidator ¶
func ValidateJWTWithValidator(validator Validator, claims ClaimsFunc) Interceptor
type Iterator ¶
type Iterator struct { Err error // contains filtered or unexported fields }
func NewIterator ¶
func NewIterator(stream grpc.ClientStream, err error) *Iterator