Documentation
¶
Index ¶
- Variables
- func WithCacheOf(credential Credential, action func(cache reflect.Value))
- type ApiKey
- type Credential
- type Credentials
- type Identity
- type Manual
- type Name
- type OidcLogin
- func (oidcLogin *OidcLogin) CachedToken(ctx context.Context, getWorkspace getWorkspaceFunc) (token jwt.JWT, found bool)
- func (oidcLogin *OidcLogin) Identity() Identity
- func (oidcLogin *OidcLogin) Name() Name
- func (oidcLogin *OidcLogin) RefreshCachedToken(ctx context.Context, client http.Client, getWorkspace getWorkspaceFunc) error
- func (oidcLogin *OidcLogin) StoreLogin(oidcToken oidc.Token)
Constants ¶
This section is empty.
Variables ¶
View Source
var Names = []Name{ApiKeyName, ManualName, OidcLoginName}
Names lists every credential, in the order a resolution tries and reports them.
Functions ¶
func WithCacheOf ¶
func WithCacheOf(credential Credential, action func(cache reflect.Value))
Types ¶
type ApiKey ¶
type ApiKey struct {
Endpoint xurl.URL
ClientId uuid.UUID `json:"client_id"`
ClientSecret string `json:"client_secret"`
Cache *struct {
Token jwt.JWT `json:"token,omitzero"`
} `json:"-"`
}
func (*ApiKey) CachedToken ¶
type Credential ¶
type Credential interface {
Name() Name
// Identity identifies the credential, so that a cache minted for another one is not used.
Identity() Identity
// CachedToken does not check the expiry. The caller does, and calls RefreshCachedToken for an
// expired token.
CachedToken(ctx context.Context, getWorkspace getWorkspaceFunc) (token jwt.JWT, found bool)
// RefreshCachedToken re-mints the token, so a CachedToken call after it finds one.
RefreshCachedToken(ctx context.Context, client http.Client, getWorkspace getWorkspaceFunc) error
}
type Credentials ¶
type Credentials struct {
ApiKey *ApiKey `json:"apiKey,omitempty"`
Manual *Manual `json:"manual,omitempty"`
OidcLogin *OidcLogin `json:"oidcLogin,omitempty"`
}
func (*Credentials) ByName ¶
func (cs *Credentials) ByName(name Name) Credential
func (*Credentials) Set ¶ added in v0.2.0
func (cs *Credentials) Set(cred Credential)
type Manual ¶
type Manual struct {
Endpoint xurl.URL `json:"endpoint"`
Cache *struct {
Token jwt.JWT `json:"token"`
} `json:"-"`
}
func (*Manual) CachedToken ¶
type OidcLogin ¶
type OidcLogin struct {
Endpoint xurl.URL `json:"endpoint"`
Issuer xurl.URL `json:"issuer"`
ClientId string `json:"clientId"`
// AccessLevel is empty for a login of an older CLI, or on a meshStack without access levels.
AccessLevel meshstack.AccessLevel `json:"accessLevel,omitzero"`
Cache *struct {
RefreshToken string `json:"refreshToken"`
RefreshExpiresAt time.Time `json:"refreshExpiresAt,omitzero"`
ScopedTokens map[scope.Scope]jwt.JWT `json:"tokens,omitzero"`
} `json:"-"`
}
func (*OidcLogin) CachedToken ¶
func (*OidcLogin) RefreshCachedToken ¶
func (*OidcLogin) StoreLogin ¶
Click to show internal directories.
Click to hide internal directories.