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:"User URL"` ClientID string `long:"client-id" env:"CLIENT_ID" description:"Client ID"` ClientSecret string `long:"client-secret" env:"CLIENT_SECRET" description:"Client secret"` Scopes []string `long:"scope" env:"SCOPE" env-delim:"," default:"email" description:"Scopes"` TokenStype string `` /* 146-byte string literal not displayed */ OAuthProvider }
GenericOAuth provider
func (*GenericOAuth) ExchangeCode ¶
func (r *GenericOAuth) ExchangeCode(redirectURI, code string) (string, error)
ExchangeCode exchange the code for the given redirect uri and code for token
func (*GenericOAuth) GetLoginURL ¶
func (r *GenericOAuth) GetLoginURL(redirectURI, state string) string
GetLoginURL providers the login url for the given redirect uri and state
func (*GenericOAuth) GetUser ¶
func (r *GenericOAuth) GetUser(token string) (User, error)
GetUser use the given token and return provider.User object
func (*GenericOAuth) Name ¶
func (r *GenericOAuth) Name() string
Name returns the name of the provider
func (*GenericOAuth) Setup ¶
func (r *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 OIDC provider
func (*Google) ExchangeCode ¶
ExchangeCode from code
func (*Google) GetLoginURL ¶
GetLoginURL from state
type OAuthProvider ¶
type OAuthProvider struct { Resource string `long:"resource" env:"RESOURCE" description:"Optional resource indicator"` Config *oauth2.Config // contains filtered or unexported fields }
OAuthProvider for oauth2 library
func (*OAuthProvider) CopyConfig ¶
func (r *OAuthProvider) CopyConfig(redirectURI string) oauth2.Config
CopyConfig from uri
func (*OAuthProvider) GetOAuthExchangeCode ¶
func (r *OAuthProvider) GetOAuthExchangeCode(redirectURI, code string) (*oauth2.Token, error)
GetOAuthExchangeCode token from code
func (*OAuthProvider) GetOAuthLoginURL ¶
func (r *OAuthProvider) GetOAuthLoginURL(redirectURI, state string) string
GetOAuthLoginURL from state
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"` OAuthProvider // contains filtered or unexported fields }
OIDC provider
func (*OIDC) ExchangeCode ¶
ExchangeCode get token with code
func (*OIDC) GetLoginURL ¶
GetLoginURL from OIDC provider
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 interface
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 support
Click to show internal directories.
Click to hide internal directories.