Documentation ¶
Overview ¶
Package auth defines standard interface for authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamInterceptor ¶
func StreamInterceptor(auth Authenticator) grpc.StreamServerInterceptor
StreamInterceptor returns a grpc.StreamServerInterceptor that performs an authentication check for each request by using Authenticator.Authenticate(ctx context.Context).
func UnaryInterceptor ¶
func UnaryInterceptor(auth Authenticator) grpc.UnaryServerInterceptor
UnaryInterceptor returns a grpc.UnaryServerInterceptor that performs an authentication check for each request by using Authenticator.Authenticate(ctx context.Context).
Types ¶
type Authenticator ¶
Authenticator defines the interface to perform the actual authentication of the request. Implementations should fetch the required data from the context.Context object. GRPC specific data like `metadata` and `peer` is available on the context. Should return a new `context.Context` that is a child of `ctx` or `codes.Unauthenticated` when auth is lacking or `codes.PermissionDenied` when lacking permissions.
type AuthenticatorFunc ¶
AuthenticatorFunc defines a pluggable function to perform authentication of requests. Should return a new `context.Context` that is a child of `ctx` or `codes.Unauthenticated` when auth is lacking or `codes.PermissionDenied` when lacking permissions.
func (AuthenticatorFunc) Authenticate ¶
Authenticate implements the Authenticator interface
type MultiAuthenticator ¶
type MultiAuthenticator []Authenticator
MultiAuthenticator chains a series of Authenticators, allowing multiple authentication types to be used with a single interceptor.
func (MultiAuthenticator) Authenticate ¶
Authenticate implements the Authenticator interface.