Documentation ¶
Index ¶
- func AuthFromMD(ctx context.Context, scheme string) (string, error)
- func StreamServerInterceptor(auth Authenticator, matchers ...selector.Matcher) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(auth Authenticator, matchers ...selector.Matcher) grpc.UnaryServerInterceptor
- type AuthFunc
- type Authenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthFromMD ¶
AuthFromMD is a helper function that extracts an authorization token from a grpc metadata object (same as github.com/grpc-ecosystem/go-grpc-middleware/auth.AuthFromMD)
func StreamServerInterceptor ¶
func StreamServerInterceptor(auth Authenticator, matchers ...selector.Matcher) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new stream server interceptor that authenticates a grpc request If no matchers are provided, the interceptor will attempt to authenticate all requests If matchers are provided, the interceptor will only attempt to authenticate requests if at least one matcher matches
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(auth Authenticator, matchers ...selector.Matcher) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor that authenticates a grpc request If no matchers are provided, the interceptor will attempt to authenticate all requests If matchers are provided, the interceptor will only attempt to authenticate requests if at least one matcher matches
Types ¶
type Authenticator ¶
type Authenticator interface { // Authenticate is a function that authenticates a grpc request Authenticate(ctx context.Context) (context.Context, error) }
Authenticator is an interface that defines a grpc authenticator
func Chain ¶
func Chain(auths ...Authenticator) Authenticator
Chain returns a new Authenticator that chains multiple Authenticators together - the first Authenticator to successfully authenticate the request will be used if all Authenticators fail, the request will be rejected with a status code of codes.Unauthenticated