Documentation
¶
Index ¶
- func AuthenticatedHttpClientFromContext(ctx context.Context) *mgcHttpPkg.Client
- func NewContext(parentCtx context.Context, auth *Auth) context.Context
- type APIKeyParameters
- type APIKeyParametersList
- type Auth
- func (o *Auth) AccessKeyPair() (accessKeyId, secretAccessKey string)
- func (o *Auth) AccessToken(ctx context.Context) (string, error)
- func (o *Auth) ApiKey(ctx context.Context) (string, error)
- func (a *Auth) AuthenticatedHttpClientFromContext(ctx context.Context) *mgcHttpPkg.Client
- func (o *Auth) BuiltInScopes() core.Scopes
- func (o *Auth) CodeChallengeToURL(scopes core.Scopes) (*url.URL, error)
- func (o *Auth) CurrentScopes() (core.Scopes, error)
- func (o *Auth) CurrentScopesString() (core.ScopesString, error)
- func (o *Auth) CurrentSecurityMethod() string
- func (o *Auth) CurrentTenant(ctx context.Context) (*Tenant, error)
- func (o *Auth) CurrentTenantID() (string, error)
- func (a *Auth) GetConfig() Config
- func (o *Auth) InitTokensFromFile()
- func (o *Auth) ListTenants(ctx context.Context) ([]*Tenant, error)
- func (o *Auth) Logout() error
- func (o *Auth) RedirectUri() string
- func (o *Auth) RefreshAccessToken(ctx context.Context) (string, error)
- func (o *Auth) RequestAuthTokenWithAuthorizationCode(ctx context.Context, authCode string) error
- func (o *Auth) SelectTenant(ctx context.Context, id string, scopes core.ScopesString) (*TokenExchangeResult, error)
- func (o *Auth) SetAPIKey(apiKey string) error
- func (o *Auth) SetAccessKey(id string, key string) error
- func (o *Auth) SetScopes(ctx context.Context, scopes core.Scopes) (*TokenExchangeResult, error)
- func (o *Auth) SetTokens(token *LoginResult) error
- func (o *Auth) SetXTenantID(tenantId string) error
- func (o *Auth) TenantsListUrl() string
- func (o *Auth) TokenExchangeUrl() string
- func (o *Auth) UnsetAccessKey() error
- func (o *Auth) ValidateAccessToken(ctx context.Context) error
- func (o *Auth) XTenantID(ctx context.Context) (string, error)
- type Authenticator
- type Config
- type ConfigResult
- type FailedRefreshAccessToken
- type LoginResult
- type SecurityMethod
- type Tenant
- type TokenExchangeResult
- type XTenantIDParameters
- type XTenantIDParametersList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticatedHttpClientFromContext ¶
func AuthenticatedHttpClientFromContext(ctx context.Context) *mgcHttpPkg.Client
Types ¶
type APIKeyParameters ¶
type APIKeyParameters struct {
Key string
}
type APIKeyParametersList ¶
type APIKeyParametersList interface {
GetAPIKey() string
}
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func FromContext ¶
func New ¶
func New( configMap map[string]Config, client *http.Client, profileManager *profile_manager.ProfileManager, mgcConfig *config.Config, ) *Auth
func (*Auth) AccessKeyPair ¶
func (*Auth) AccessToken ¶
Returns the current user access token. If token is empty, we might still have refresh token, try getting a new one. It will either fail with error or return a valid non-empty access token
func (*Auth) AuthenticatedHttpClientFromContext ¶
func (a *Auth) AuthenticatedHttpClientFromContext(ctx context.Context) *mgcHttpPkg.Client
func (*Auth) BuiltInScopes ¶
func (*Auth) CodeChallengeToURL ¶
func (*Auth) CurrentScopesString ¶
func (o *Auth) CurrentScopesString() (core.ScopesString, error)
func (*Auth) CurrentSecurityMethod ¶
func (*Auth) CurrentTenantID ¶
func (*Auth) InitTokensFromFile ¶
func (o *Auth) InitTokensFromFile()
func (*Auth) RedirectUri ¶
func (*Auth) RefreshAccessToken ¶
func (*Auth) RequestAuthTokenWithAuthorizationCode ¶
* Creates a new request access token from authorization code request, be
- mindful that the code verifier used in this request come from the last call
- of `CodeChallengeToUrl` method.
func (*Auth) SelectTenant ¶
func (o *Auth) SelectTenant(ctx context.Context, id string, scopes core.ScopesString) ( *TokenExchangeResult, error, )
func (*Auth) SetTokens ¶
func (o *Auth) SetTokens(token *LoginResult) error
func (*Auth) SetXTenantID ¶
func (*Auth) TenantsListUrl ¶
func (*Auth) TokenExchangeUrl ¶
func (*Auth) UnsetAccessKey ¶
type Authenticator ¶
type Authenticator interface { AccessToken(ctx context.Context) (string, error) SetTokens(token *LoginResult) error RefreshAccessToken(ctx context.Context) (string, error) ValidateAccessToken(ctx context.Context) error CodeChallengeToURL(scopes core.Scopes) (*url.URL, error) RequestAuthTokenWithAuthorizationCode(ctx context.Context, authCode string) error ListTenants(ctx context.Context) ([]*Tenant, error) SelectTenant(ctx context.Context, id string, scopes core.ScopesString) (*TokenExchangeResult, error) CurrentTenant(ctx context.Context) (*Tenant, error) CurrentTenantID() (string, error) SetScopes(ctx context.Context, scopes core.Scopes) (*TokenExchangeResult, error) CurrentScopes() (core.Scopes, error) CurrentScopesString() (core.ScopesString, error) ApiKey(ctx context.Context) (string, error) SetAPIKey(apiKey string) error AccessKeyPair() (accessKeyId, secretAccessKey string) SetAccessKey(id string, key string) error UnsetAccessKey() error XTenantID(ctx context.Context) (string, error) SetXTenantID(tenantId string) error Logout() error GetConfig() Config CurrentSecurityMethod() string }
type Config ¶
type Config struct { ClientId string ObjectStoreScopeIDs []string PublicClientsScopeIDs map[string]string RedirectUri string LoginUrl string TokenUrl string ValidationUrl string RefreshUrl string TenantsListUrl string TokenExchangeUrl string ApiKeysUrlV1 string ApiKeysUrlV2 string PublicClientsUrl string ClientsV2Url string }
type ConfigResult ¶
type FailedRefreshAccessToken ¶
type FailedRefreshAccessToken struct {
Message string
}
func (FailedRefreshAccessToken) Error ¶
func (e FailedRefreshAccessToken) Error() string
type LoginResult ¶
type SecurityMethod ¶
type SecurityMethod int
const ( BearerToken SecurityMethod = iota APIKey XTenantID )
func (SecurityMethod) String ¶
func (s SecurityMethod) String() string
type TokenExchangeResult ¶
type XTenantIDParameters ¶
type XTenantIDParameters struct {
Key string
}
type XTenantIDParametersList ¶
type XTenantIDParametersList interface {
GetXTenantID() string
}
Click to show internal directories.
Click to hide internal directories.