Documentation ¶
Index ¶
- type APIKeysDependencies
- type APIKeysProvider
- type OAuthAuthenticator
- func (op *OAuthAuthenticator) Exchange(ctx context.Context, code string) (*oauth2.Token, error)
- func (op *OAuthAuthenticator) GenerateState(redirectURL string) (string, error)
- func (op *OAuthAuthenticator) GetAuthCodeURL(state string) string
- func (op *OAuthAuthenticator) VerifyState(rawToken string) (string, error)
- type OAuthAuthenticatorConfig
- type OAuthAuthenticatorDependencies
- type RepoAuth
- type RepositoryAuthDependencies
- type TokenIssuer
- type TokenIssuerConfig
- type TokenIssuerDependencies
- type TokenProvider
- type TokenProviderDependencies
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeysDependencies ¶
type APIKeysDependencies struct { Logger zerolog.Logger APIKeysStore providers.APIKeysStorer Clock providers.Clock }
APIKeysDependencies defines the dependencies for the apikeys provider.
type APIKeysProvider ¶
type APIKeysProvider struct {
APIKeysDependencies
}
APIKeysProvider is the authentication provider for api keys.
func NewAPIKeysProvider ¶
func NewAPIKeysProvider(deps APIKeysDependencies) *APIKeysProvider
NewAPIKeysProvider creates a new authentication provider for api keys.
type OAuthAuthenticator ¶
type OAuthAuthenticator struct { OAuthAuthenticatorConfig OAuthAuthenticatorDependencies // contains filtered or unexported fields }
OAuthAuthenticator is the OAuthAuthenticator that uses OAuth2 to authenticate the user.
func NewOAuthAuthenticator ¶
func NewOAuthAuthenticator(cfg OAuthAuthenticatorConfig, deps OAuthAuthenticatorDependencies) *OAuthAuthenticator
NewOAuthAuthenticator creates a new OAuthAuthenticator.
func (*OAuthAuthenticator) Exchange ¶
Exchange exchanges the code returned from the OAuth2 authentication URL for a valid token. We then call the TokenIssuer to get an internal JWT.
func (*OAuthAuthenticator) GenerateState ¶
func (op *OAuthAuthenticator) GenerateState(redirectURL string) (string, error)
GenerateState generates the state nonce JWT with expiry.
func (*OAuthAuthenticator) GetAuthCodeURL ¶
func (op *OAuthAuthenticator) GetAuthCodeURL(state string) string
GetAuthCodeURL gets the OAuth2 authentication URL.
func (*OAuthAuthenticator) VerifyState ¶
func (op *OAuthAuthenticator) VerifyState(rawToken string) (string, error)
VerifyState verifies the state nonce JWT.
type OAuthAuthenticatorConfig ¶
type OAuthAuthenticatorConfig struct { BaseURL string GoogleClientID string GoogleClientSecret string GlobalTokenKey string }
OAuthAuthenticatorConfig contains the config for the OAuthAuthenticator.
type OAuthAuthenticatorDependencies ¶
type OAuthAuthenticatorDependencies struct { UUID providers.UUIDGenerator Clock providers.Clock Issuer providers.TokenIssuer UserStore providers.UserStorer }
OAuthAuthenticatorDependencies contains the dependencies for the OAuthAuthenticator.
type RepoAuth ¶
type RepoAuth struct {
RepositoryAuthDependencies
}
RepoAuth is the authentication provider for Krok repositories.
func NewRepositoryAuth ¶
func NewRepositoryAuth(deps RepositoryAuthDependencies) *RepoAuth
NewRepositoryAuth creates a new repository authentication provider.
type RepositoryAuthDependencies ¶
RepositoryAuthDependencies defines the dependencies for the repository auth provider.
type TokenIssuer ¶
type TokenIssuer struct { TokenIssuerConfig TokenIssuerDependencies }
TokenIssuer represents the auth JWT token issuer.
func NewTokenIssuer ¶
func NewTokenIssuer(cfg TokenIssuerConfig, deps TokenIssuerDependencies) *TokenIssuer
NewTokenIssuer creates a new TokenIssuer.
type TokenIssuerConfig ¶
type TokenIssuerConfig struct {
GlobalTokenKey string
}
TokenIssuerConfig contains the config for the TokenIssuer.
type TokenIssuerDependencies ¶
type TokenIssuerDependencies struct { UserStore providers.UserStorer Clock providers.Clock }
TokenIssuerDependencies contains the TokenIssuer dependencies.
type TokenProvider ¶
type TokenProvider struct {
TokenProviderDependencies
}
TokenProvider is the provider which saves and manages tokens for the various platforms.
func NewPlatformTokenProvider ¶
func NewPlatformTokenProvider(deps TokenProviderDependencies) *TokenProvider
NewPlatformTokenProvider creates a new Token provider for the platforms.
func (*TokenProvider) GetTokenForPlatform ¶
func (t *TokenProvider) GetTokenForPlatform(vcs int) (string, error)
GetTokenForPlatform will retrieve the token for this VCS.
func (*TokenProvider) SaveTokenForPlatform ¶
func (t *TokenProvider) SaveTokenForPlatform(token string, vcs int) error
SaveTokenForPlatform will save the token for this VCS.