Documentation ¶
Index ¶
- Constants
- func ErrorIfBadHTTP(r *http.Response, exceptStatus ...int) error
- func IsAuthError(err error) bool
- func IsError(statusCode int) bool
- func RequiredScopes() []string
- func RequiredScopesMin() []string
- type Auth
- func (t Auth) GetFreshAccessTokenOrLogin() (string, error)
- func (t Auth) GetFreshAccessTokenOrNil() (string, error)
- func (t Auth) Login() (*LoginTokens, error)
- func (t Auth) Logout() error
- func (t Auth) PromptForLogin() (*LoginTokens, error)
- func (t *Auth) WithAccessTokenValidator(val func(string) (bool, error)) *Auth
- type AuthError
- type AuthStore
- type Authenticator
- func (a Authenticator) DoDeviceAuthFlow(onStateRetrieved func(url string, code string)) (*LoginTokens, error)
- func (a Authenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error)
- func (a *Authenticator) Start(ctx context.Context) (State, error)
- func (a *Authenticator) Wait(ctx context.Context, state State) (Result, error)
- type LoginAuth
- type LoginTokens
- type NoLoginAuth
- type OAuth
- type Result
- type State
- type StdHTTPResponseError
Constants ¶
View Source
const (
// namespace used to set/get values from the keychain.
SecNamespace = "auth0-cli"
)
Variables ¶
This section is empty.
Functions ¶
func ErrorIfBadHTTP ¶ added in v0.6.7
func IsAuthError ¶ added in v0.6.26
func IsError ¶ added in v0.6.7
IsError method returns true if HTTP status `code >= 400` otherwise false.
func RequiredScopes ¶
func RequiredScopes() []string
RequiredScopes returns the scopes used for login.
func RequiredScopesMin ¶
func RequiredScopesMin() []string
RequiredScopesMin returns minimum scopes used for login in integration tests.
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) Login ¶
func (t Auth) Login() (*LoginTokens, error)
func (Auth) PromptForLogin ¶
func (t Auth) PromptForLogin() (*LoginTokens, error)
Prompts for login and returns tokens, and saves to store
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 Authenticator ¶
type Authenticator struct { Audience string ClientID string DeviceCodeEndpoint string OauthTokenEndpoint string }
func (Authenticator) DoDeviceAuthFlow ¶
func (a Authenticator) DoDeviceAuthFlow(onStateRetrieved func(url string, code string)) (*LoginTokens, error)
func (Authenticator) GetNewAuthTokensWithRefresh ¶
func (a Authenticator) GetNewAuthTokensWithRefresh(refreshToken string) (*entity.AuthTokens, error)
type LoginAuth ¶
type LoginAuth struct {
Auth
}
func NewLoginAuth ¶
func (LoginAuth) GetAccessToken ¶
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) }
type State ¶
type State 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 (*State) IntervalDuration ¶
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.