Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewThirdPartyAuthHelper ¶
func NewThirdPartyAuthHelper( oauth2Config OAuth2Config, idTokenVerifier IDTokenVerifier, ) api.ThirdPartyAuthHelper
Types ¶
type IDTokenVerifier ¶
type IDTokenVerifier interface {
Verify(ctx context.Context, rawIDToken string) (*oidc.IDToken, error)
}
IDTokenVerifier is an interface for the subset of *oidc.IDTokenVerifier used for Brigade Session management. Dependence on this interface instead of directly upon the *oidc.IDTokenVerifier allows for the possibility of utilizing a mock implementation for testing purposes. Adding only the subset of functions that we actually use limits the effort involved in creating such mocks.
type OAuth2Config ¶
type OAuth2Config interface {
// AuthCodeURL given an OAuth 2 state code and oauth2.AuthCodeOption returns
// the URL that a user may visit with their web browser in order to complete
// authentication using OpenID Connect.
AuthCodeURL(
state string,
opts ...oauth2.AuthCodeOption,
) string
// Exchange exchanges the given OAuth 2 code for an *oauth2.Token.
Exchange(
ctx context.Context,
code string,
opts ...oauth2.AuthCodeOption,
) (*oauth2.Token, error)
}
OAuth2Config is an interface for the subset of *oauth2.Config functions used for Brigade Session management. Dependence on this interface instead of directly upon the *oauth2.Config allows for the possibility of utilizing a mock implementation for testing purposes. Adding only the subset of functions that we actually use limits the effort involved in creating such mocks.