Documentation ¶
Index ¶
- Constants
- func AuthProviderFlagToCredentialProvider(authProviderFlag string) entity.CredentialProvider
- func ErrorIfBadHTTP(r *http.Response, exceptStatus ...int) error
- func GetEmailFromToken(token string) string
- func IsError(statusCode int) bool
- func IssuerCheck(token string, issuer string) bool
- type Auth
- func (t Auth) GetFreshAccessTokenOrLogin() (string, error)
- func (t Auth) GetFreshAccessTokenOrNil() (string, error)
- func (t Auth) Login(skipBrowser bool) (*LoginTokens, error)
- func (t Auth) LoginWithToken(token string) error
- func (t Auth) Logout() error
- func (t Auth) PromptForLogin() (*LoginTokens, error)
- func (t *Auth) WithAccessTokenValidator(val func(string) (bool, error)) *Auth
- type Auth0Authenticator
- func (a Auth0Authenticator) DoDeviceAuthFlow(onStateRetrieved func(url string, code string)) (*LoginTokens, error)
- func (a Auth0Authenticator) GetCredentialProvider() entity.CredentialProvider
- func (a Auth0Authenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error)
- func (a Auth0Authenticator) IsTokenValid(token string) bool
- func (a *Auth0Authenticator) Start(ctx context.Context) (Auth0State, error)
- func (a *Auth0Authenticator) Wait(ctx context.Context, state Auth0State) (Auth0Result, error)
- type Auth0Result
- type Auth0State
- type AuthError
- type AuthStore
- type KasAuthenticator
- func (a KasAuthenticator) DoDeviceAuthFlow(userLoginFlow func(url string, code string)) (*LoginTokens, error)
- func (a KasAuthenticator) GetCredentialProvider() entity.CredentialProvider
- func (a KasAuthenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error)
- func (a KasAuthenticator) IsTokenValid(token string) bool
- func (a KasAuthenticator) MakeLoginCall(id, email string) (LoginCallResponse, error)
- type LoginAuth
- type LoginCallResponse
- type LoginTokens
- type NoLoginAuth
- type OAuth
- type OAuthRetriever
- type RetrieveIDTokenResponse
- type StdHTTPResponseError
Constants ¶
View Source
const CredentialProviderAuth0 entity.CredentialProvider = "auth0"
View Source
const CredentialProviderKAS entity.CredentialProvider = "kas"
View Source
const (
// namespace used to set/get values from the keychain.
SecNamespace = "auth0-cli"
)
Variables ¶
This section is empty.
Functions ¶
func AuthProviderFlagToCredentialProvider ¶ added in v0.6.299
func AuthProviderFlagToCredentialProvider(authProviderFlag string) entity.CredentialProvider
func ErrorIfBadHTTP ¶ added in v0.6.7
func GetEmailFromToken ¶ added in v0.6.296
func IsError ¶ added in v0.6.7
IsError method returns true if HTTP status `code >= 400` otherwise false.
func IssuerCheck ¶ added in v0.6.296
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (Auth) GetFreshAccessTokenOrLogin ¶
Gets fresh access token and prompts for login and saves to store
func (Auth) GetFreshAccessTokenOrNil ¶
Gets fresh access token or returns nil and saves to store
func (Auth) LoginWithToken ¶ added in v0.6.63
func (Auth) PromptForLogin ¶
func (t Auth) PromptForLogin() (*LoginTokens, error)
Prompts for login and returns tokens, and saves to store
type Auth0Authenticator ¶ added in v0.6.296
type Auth0Authenticator struct { Issuer string Audience string ClientID string DeviceCodeEndpoint string OauthTokenEndpoint string }
func (Auth0Authenticator) DoDeviceAuthFlow ¶ added in v0.6.296
func (a Auth0Authenticator) DoDeviceAuthFlow(onStateRetrieved func(url string, code string)) (*LoginTokens, error)
func (Auth0Authenticator) GetCredentialProvider ¶ added in v0.6.296
func (a Auth0Authenticator) GetCredentialProvider() entity.CredentialProvider
func (Auth0Authenticator) GetNewAuthTokensWithRefresh ¶ added in v0.6.296
func (a Auth0Authenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error)
func (Auth0Authenticator) IsTokenValid ¶ added in v0.6.296
func (a Auth0Authenticator) IsTokenValid(token string) bool
func (*Auth0Authenticator) Start ¶ added in v0.6.296
func (a *Auth0Authenticator) Start(ctx context.Context) (Auth0State, error)
Start kicks-off the device authentication flow by requesting a device code from Auth0, The returned state contains the URI for the next step of the flow.
func (*Auth0Authenticator) Wait ¶ added in v0.6.296
func (a *Auth0Authenticator) Wait(ctx context.Context, state Auth0State) (Auth0Result, error)
Wait waits until the user is logged in on the browser.
type Auth0Result ¶ added in v0.6.296
type Auth0State ¶ added in v0.6.296
type Auth0State struct { DeviceCode string `json:"device_code"` UserCode string `json:"user_code"` VerificationURI string `json:"verification_uri_complete"` ExpiresIn int `json:"expires_in"` Interval int `json:"interval"` }
func (*Auth0State) IntervalDuration ¶ added in v0.6.296
func (s *Auth0State) IntervalDuration() time.Duration
type AuthError ¶ added in v0.6.16
type AuthError struct { // https://auth0.com/docs/api/authentication#standard-error-responses Error string `json:"error"` ErrorDescription string `json:"error_description"` }
type AuthStore ¶
type AuthStore interface { SaveAuthTokens(tokens entity.AuthTokens) error GetAuthTokens() (*entity.AuthTokens, error) DeleteAuthTokens() error }
type KasAuthenticator ¶ added in v0.6.296
type KasAuthenticator struct { Email string ShouldPromptEmail bool BaseURL string PollTimeout time.Duration Issuer string RedirectURI string }
func NewKasAuthenticator ¶ added in v0.6.296
func NewKasAuthenticator(email, baseURL, issuer string, shouldPromptEmail bool, redirectURI string) KasAuthenticator
func (KasAuthenticator) DoDeviceAuthFlow ¶ added in v0.6.296
func (a KasAuthenticator) DoDeviceAuthFlow(userLoginFlow func(url string, code string)) (*LoginTokens, error)
func (KasAuthenticator) GetCredentialProvider ¶ added in v0.6.296
func (a KasAuthenticator) GetCredentialProvider() entity.CredentialProvider
func (KasAuthenticator) GetNewAuthTokensWithRefresh ¶ added in v0.6.296
func (a KasAuthenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error)
func (KasAuthenticator) IsTokenValid ¶ added in v0.6.296
func (a KasAuthenticator) IsTokenValid(token string) bool
func (KasAuthenticator) MakeLoginCall ¶ added in v0.6.296
func (a KasAuthenticator) MakeLoginCall(id, email string) (LoginCallResponse, error)
type LoginAuth ¶
type LoginAuth struct {
Auth
}
func NewLoginAuth ¶
func (LoginAuth) GetAccessToken ¶
type LoginCallResponse ¶ added in v0.6.296
type LoginTokens ¶
type LoginTokens struct { entity.AuthTokens IDToken string }
type NoLoginAuth ¶
type NoLoginAuth struct {
Auth
}
func NewNoLoginAuth ¶
func NewNoLoginAuth(authStore AuthStore, oauth OAuth) *NoLoginAuth
func (NoLoginAuth) GetAccessToken ¶
func (l NoLoginAuth) GetAccessToken() (string, error)
type OAuth ¶
type OAuth interface { DoDeviceAuthFlow(onStateRetrieved func(url string, code string)) (*LoginTokens, error) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error) GetCredentialProvider() entity.CredentialProvider IsTokenValid(token string) bool }
func StandardLogin ¶ added in v0.6.299
func StandardLogin(authProvider string, email string, tokens *entity.AuthTokens) OAuth
type OAuthRetriever ¶ added in v0.6.296
type OAuthRetriever struct {
// contains filtered or unexported fields
}
func NewOAuthRetriever ¶ added in v0.6.296
func NewOAuthRetriever(oauths []OAuth) *OAuthRetriever
func (*OAuthRetriever) GetByProvider ¶ added in v0.6.296
func (o *OAuthRetriever) GetByProvider(provider entity.CredentialProvider) (OAuth, error)
func (*OAuthRetriever) GetByToken ¶ added in v0.6.296
func (o *OAuthRetriever) GetByToken(token string) (OAuth, error)
type RetrieveIDTokenResponse ¶ added in v0.6.296
type StdHTTPResponseError ¶ added in v0.6.16
type StdHTTPResponseError struct {
// contains filtered or unexported fields
}
func NewHTTPResponseError ¶ added in v0.6.16
func NewHTTPResponseError(response *http.Response) *StdHTTPResponseError
func (StdHTTPResponseError) Error ¶ added in v0.6.16
func (e StdHTTPResponseError) Error() string
Click to show internal directories.
Click to hide internal directories.