oauth2clientcredentials

package
v1.19.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 17 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOAuth2ClientCredentialsMiddleware

func NewOAuth2ClientCredentialsMiddleware(logger logger.Logger) middleware.Middleware

NewOAuth2ClientCredentialsMiddleware returns a new oAuth2 middleware.

Types

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

Middleware is an oAuth2 authentication middleware.

func (*Middleware) GetComponentMetadata added in v1.11.0

func (m *Middleware) GetComponentMetadata() (metadataInfo mdutils.MetadataMap)

func (*Middleware) GetHandler

func (m *Middleware) GetHandler(_ context.Context, metadata middleware.Metadata) (func(next http.Handler) http.Handler, error)

GetHandler returns the HTTP handler provided by the middleware.

func (*Middleware) GetToken

func (m *Middleware) GetToken(ctx context.Context, 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(ctx context.Context, conf *clientcredentials.Config) (*oauth2.Token, error)
}

TokenProviderInterface provides a common interface to Mock the Token retrieval in unit tests.

Directories

Path Synopsis
Package mock_oauth2clientcredentials is a generated GoMock package.
Package mock_oauth2clientcredentials is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL