Documentation
¶
Index ¶
- Variables
- func SetNameInContext(ctx context.Context, name Name) context.Context
- func WithCacheOf(credential Credential, action func(cache reflect.Value)) (ok bool)
- 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) RefreshCachedToken(ctx context.Context, client http.Client, getWorkspace getWorkspaceFunc) error
- func (oidcLogin *OidcLogin) StoreLogin(refreshToken string, token jwt.JWT)
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)) (ok bool)
WithCacheOf reaches the optional Cache field of a credential struct, such as ApiKey, and holds the struct to what identityOf needs to copy it: Cache is a json-ignored pointer, and no other field is a pointer at all.
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 {
// Identity identifies the credential, see Credentials.SetIdentity.
Identity() Identity
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) NameOf ¶
func (cs *Credentials) NameOf(credential Credential) (out Name)
func (*Credentials) SetIdentity ¶
func (cs *Credentials) SetIdentity(cred Credential)
type Manual ¶
func (*Manual) CachedToken ¶
type OidcLogin ¶
type OidcLogin struct {
Endpoint xurl.URL `json:"endpoint"`
Issuer xurl.URL `json:"issuer"`
ClientId string `json:"clientId"`
Cache *struct {
RefreshToken string `json:"refreshToken"`
ScopedTokens map[scope.Scope]jwt.JWT `json:"tokens,omitzero"`
} `json:"-"`
}
func (*OidcLogin) CachedToken ¶
func (*OidcLogin) RefreshCachedToken ¶
Click to show internal directories.
Click to hide internal directories.