Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericOAuth ¶
type GenericOAuth struct {
AuthURL string `long:"auth-url" env:"AUTH_URL" description:"Auth/Login URL"`
TokenURL string `long:"token-url" env:"TOKEN_URL" description:"Token URL"`
UserURL string `long:"user-url" env:"USER_URL" description:"URL used to retrieve user info"`
ClientID string `long:"client-id" env:"CLIENT_ID" description:"Client ID"`
ClientSecret string `long:"client-secret" env:"CLIENT_SECRET" description:"Client Secret" json:"-"`
Scopes []string `long:"scope" env:"SCOPE" env-delim:"," default:"profile" default:"email" description:"Scopes"`
TokenStyle string `` /* 148-byte string literal not displayed */
OAuthProvider
}
GenericOAuth provider
func (*GenericOAuth) ExchangeCode ¶
func (o *GenericOAuth) ExchangeCode(redirectURI, code string) (string, error)
ExchangeCode exchanges the given redirect uri and code for a token
func (*GenericOAuth) GetLoginURL ¶
func (o *GenericOAuth) GetLoginURL(redirectURI, state string) string
GetLoginURL provides the login url for the given redirect uri and state
func (*GenericOAuth) GetUser ¶
func (o *GenericOAuth) GetUser(token string) (User, error)
GetUser uses the given token and returns a complete provider.User object
func (*GenericOAuth) Name ¶
func (o *GenericOAuth) Name() string
Name returns the name of the provider
func (*GenericOAuth) Setup ¶
func (o *GenericOAuth) Setup() error
Setup performs validation and setup
type Google ¶
type Google struct {
ClientID string `long:"client-id" env:"CLIENT_ID" description:"Client ID"`
ClientSecret string `long:"client-secret" env:"CLIENT_SECRET" description:"Client Secret" json:"-"`
Scope string
Prompt string `long:"prompt" env:"PROMPT" default:"select_account" description:"Space separated list of OpenID prompt options"`
LoginURL *url.URL
TokenURL *url.URL
UserURL *url.URL
}
Google provider
func (*Google) ExchangeCode ¶
ExchangeCode exchanges the given redirect uri and code for a token
func (*Google) GetLoginURL ¶
GetLoginURL provides the login url for the given redirect uri and state
type LoggingRoundTripper ¶
type LoggingRoundTripper struct {
Proxied http.RoundTripper
Logger *log.Logger
}
type OAuthProvider ¶
type OAuthProvider struct {
Resource string `long:"resource" env:"RESOURCE" description:"Optional resource indicator"`
Config *oauth2.Config
// contains filtered or unexported fields
}
OAuthProvider is a provider using the oauth2 library
func (*OAuthProvider) ConfigCopy ¶
func (p *OAuthProvider) ConfigCopy(redirectURI string) oauth2.Config
ConfigCopy returns a copy of the oauth2 config with the given redirectURI which ensures the underlying config is not modified
func (*OAuthProvider) OAuthExchangeCode ¶
func (p *OAuthProvider) OAuthExchangeCode(redirectURI, code string) (*oauth2.Token, error)
OAuthExchangeCode provides a base "ExchangeCode" for providers using OAauth2
func (*OAuthProvider) OAuthGetLoginURL ¶
func (p *OAuthProvider) OAuthGetLoginURL(redirectURI, state string) string
OAuthGetLoginURL provides a base "GetLoginURL" for providers using OAauth2
type OIDC ¶
type OIDC struct {
IssuerURL string `long:"issuer-url" env:"ISSUER_URL" description:"Issuer URL"`
ClientID string `long:"client-id" env:"CLIENT_ID" description:"Client ID"`
ClientSecret string `long:"client-secret" env:"CLIENT_SECRET" description:"Client Secret" json:"-"`
OAuthProvider
// contains filtered or unexported fields
}
OIDC provider
func (*OIDC) ExchangeCode ¶
ExchangeCode exchanges the given redirect uri and code for a token
func (*OIDC) GetLoginURL ¶
GetLoginURL provides the login url for the given redirect uri and state
type Provider ¶
type Provider interface {
Name() string
GetLoginURL(redirectURI, state string) string
ExchangeCode(redirectURI, code string) (string, error)
GetUser(token string) (User, error)
Setup() error
}
Provider is used to authenticate users
type Providers ¶
type Providers struct {
Google Google `group:"Google Provider" namespace:"google" env-namespace:"GOOGLE"`
OIDC OIDC `group:"OIDC Provider" namespace:"oidc" env-namespace:"OIDC"`
GenericOAuth GenericOAuth `group:"Generic OAuth2 Provider" namespace:"generic-oauth" env-namespace:"GENERIC_OAUTH"`
}
Providers contains all the implemented providers