Documentation ¶
Index ¶
- Variables
- type Config
- func (c *Config) AddTenant(tenant Tenant) error
- func (c *Config) GetTenant(tenantName string) (Tenant, error)
- func (c *Config) Initialize() error
- func (c *Config) IsLoggedInWithTenant(tenantName string) bool
- func (c *Config) ListAllTenants() ([]Tenant, error)
- func (c *Config) RemoveTenant(tenant string) error
- func (c *Config) SetDefaultAppIDForTenant(tenantName, appID string) error
- func (c *Config) SetDefaultTenant(tenantName string) error
- func (c *Config) Validate() error
- type Tenant
- func (t *Tenant) CheckAuthenticationStatus() error
- func (t *Tenant) GetAccessToken() string
- func (t *Tenant) GetExtraRequestedScopes() []string
- func (t *Tenant) HasAllRequiredScopes() bool
- func (t *Tenant) HasExpiredToken() bool
- func (t *Tenant) IsAuthenticatedWithClientCredentials() bool
- func (t *Tenant) IsAuthenticatedWithDeviceCodeFlow() bool
- func (t *Tenant) RegenerateAccessToken(ctx context.Context) error
- type Tenants
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTokenMissingRequiredScopes is thrown when the token is missing required scopes. ErrTokenMissingRequiredScopes = errors.New("token is missing required scopes") // ErrInvalidToken is thrown when the token is invalid. ErrInvalidToken = errors.New("token is invalid") )
var ErrConfigFileMissing = errors.New("config.json file is missing")
ErrConfigFileMissing is thrown when the config.json file is missing.
var ErrNoAuthenticatedTenants = errors.New("Not logged in. Try `auth0 login`.")
ErrNoAuthenticatedTenants is thrown when the config file has no authenticated tenants.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { InstallID string `json:"install_id,omitempty"` DefaultTenant string `json:"default_tenant"` Tenants Tenants `json:"tenants"` // contains filtered or unexported fields }
Config holds cli configuration settings.
func (*Config) AddTenant ¶
AddTenant adds a tenant to the config. This is called after a login has completed.
func (*Config) Initialize ¶
Initialize will load the config settings into memory.
func (*Config) IsLoggedInWithTenant ¶
IsLoggedInWithTenant checks if we're logged in with the given tenant.
func (*Config) ListAllTenants ¶
ListAllTenants retrieves a list with all configured tenants.
func (*Config) RemoveTenant ¶
RemoveTenant removes a tenant from the config. This is called after a logout has completed.
func (*Config) SetDefaultAppIDForTenant ¶
SetDefaultAppIDForTenant saves the new default app id for the tenant to the disk.
func (*Config) SetDefaultTenant ¶
SetDefaultTenant saves the new default tenant to the disk.
type Tenant ¶
type Tenant struct { Name string `json:"name"` Domain string `json:"domain"` AccessToken string `json:"access_token,omitempty"` Scopes []string `json:"scopes,omitempty"` ExpiresAt time.Time `json:"expires_at"` DefaultAppID string `json:"default_app_id,omitempty"` ClientID string `json:"client_id"` }
Tenant keeps track of auth0 config for the tenant.
func (*Tenant) CheckAuthenticationStatus ¶
CheckAuthenticationStatus checks to see if the tenant in the config has all the required scopes and that the access token is not expired.
func (*Tenant) GetAccessToken ¶
GetAccessToken retrieves the tenant's access token.
func (*Tenant) GetExtraRequestedScopes ¶
GetExtraRequestedScopes retrieves any extra scopes requested for the tenant when logging in through the device code flow.
func (*Tenant) HasAllRequiredScopes ¶
HasAllRequiredScopes returns true if the tenant has all the required scopes, false otherwise.
func (*Tenant) HasExpiredToken ¶
HasExpiredToken checks whether the tenant has an expired token.
func (*Tenant) IsAuthenticatedWithClientCredentials ¶
IsAuthenticatedWithClientCredentials checks to see if the tenant has been authenticated through client credentials.
func (*Tenant) IsAuthenticatedWithDeviceCodeFlow ¶
IsAuthenticatedWithDeviceCodeFlow checks to see if the tenant has been authenticated through device code flow.