Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is an oAuth2 authentication middleware
func NewOAuth2ClientCredentialsMiddleware ¶
func NewOAuth2ClientCredentialsMiddleware(logger logger.Logger) *Middleware
NewOAuth2ClientCredentialsMiddleware returns a new oAuth2 middleware
func (*Middleware) GetHandler ¶
func (m *Middleware) GetHandler(metadata middleware.Metadata) (func(h fasthttp.RequestHandler) fasthttp.RequestHandler, error)
GetHandler retruns the HTTP handler provided by the middleware
func (*Middleware) GetToken ¶
func (m *Middleware) GetToken(conf *clientcredentials.Config) (*oauth2.Token, error)
GetToken returns a token from the current OAuth2 ClientCredentials Configuration
func (*Middleware) SetTokenProvider ¶
func (m *Middleware) SetTokenProvider(tokenProvider TokenProviderInterface)
SetTokenProvider will enable to change the tokenProvider used after instanciation (needed for mocking)
type TokenProviderInterface ¶
type TokenProviderInterface interface {
GetToken(conf *clientcredentials.Config) (*oauth2.Token, error)
}
TokenProviderInterface provides a common interface to Mock the Token retrieval in unit tests
Click to show internal directories.
Click to hide internal directories.