Documentation ¶
Index ¶
- func GetTokenFromHTTPHeaders(headers http.Header) (string, error)
- func GetTokenFromHeader(ctx context.Context) (string, error)
- func NewServerInterceptor(authenticator Authenticator) rpc.ServerInterceptor
- func WithContextUser(ctx context.Context, user *User) context.Context
- func WithToken(ctx context.Context, token string) context.Context
- func WithTokenIfNoneSet(ctx context.Context, token string) context.Context
- type Authenticator
- type AuthenticatorFunc
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenFromHTTPHeaders ¶
GetTokenFromHTTPHeaders gets the current authentication token from the HTTP headers, if there is one.
func GetTokenFromHeader ¶
GetTokenFromHeader gets the current authentication token, if there is one.
func NewServerInterceptor ¶
func NewServerInterceptor(authenticator Authenticator) rpc.ServerInterceptor
NewServerInterceptor returns a new ServerInterceptor.
func WithContextUser ¶ added in v1.1.1
WithContextUser sets the user on the context. It is intended to be used by interceptors following token authentication.
Types ¶
type Authenticator ¶
Authenticator defines the interface used to authenticate a token.
type AuthenticatorFunc ¶
AuthenticatorFunc is a function that implements Authenticator
func (AuthenticatorFunc) Authenticate ¶
Authenticate implements Authenticator.
Click to show internal directories.
Click to hide internal directories.