Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerWrapper ¶
type HandlerWrapper struct { common.HTTPHandler // contains filtered or unexported fields }
HandlerWrapper wraps an existing HTTP handler and performs bearer token authorization. If authorized then the wrapped handler is invoked.
func NewHandlerWrapper ¶
func NewHandlerWrapper(handler common.HTTPHandler, tm tokenManager) *HandlerWrapper
NewHandlerWrapper returns a handler that first performs bearer token authorization and, if authorized, invokes the wrapped handler.
func (*HandlerWrapper) Handler ¶
func (h *HandlerWrapper) Handler() common.HTTPRequestHandler
Handler returns the 'wrapper' handler.
type TokenManager ¶ added in v1.0.0
type TokenManager struct {
// contains filtered or unexported fields
}
TokenManager manages the authorization tokens for both the client and server.
func NewTokenManager ¶ added in v1.0.0
func NewTokenManager(cfg Config) (*TokenManager, error)
NewTokenManager returns a token mapper that performs bearer token authorization.
func (*TokenManager) IsAuthRequired ¶ added in v1.0.0
func (m *TokenManager) IsAuthRequired(endpoint, method string) (bool, error)
IsAuthRequired return true if authorization is required for the given endpoint/method.
func (*TokenManager) RequiredAuthTokens ¶ added in v1.0.0
func (m *TokenManager) RequiredAuthTokens(endpoint, method string) ([]string, error)
RequiredAuthTokens returns the authorization tokens required for the given endpoint and method.
type TokenVerifier ¶
type TokenVerifier struct {
// contains filtered or unexported fields
}
TokenVerifier authorizes requests with bearer tokens.
func NewTokenVerifier ¶
func NewTokenVerifier(tm tokenManager, endpoint, method string) *TokenVerifier
NewTokenVerifier returns a verifier that performs bearer token authorization.