Documentation
¶
Index ¶
- Constants
- type AccessToken
- type Implementation
- type Provider
- func (Provider) GetAccessCredentialOptionsForArtifactRepository(artifactRepository string, _ ...auth.Option) ([]auth.Option, error)
- func (Provider) GetAudiences(_ context.Context, opts ...auth.Option) ([]string, error)
- func (Provider) GetIdentity(opts ...auth.Option) (string, error)
- func (Provider) GetName() string
- func (p Provider) NewAccessCredentialForIdentity(ctx context.Context, identity auth.Credential, opts ...auth.Option) (auth.Credential, error)
- func (Provider) NewArtifactRegistryCredentials(_ context.Context, _ string, accessCredential auth.Credential, ...) (*auth.ArtifactRegistryCredentials, error)
- func (Provider) NewControllerToken(context.Context, ...auth.Option) (auth.Credential, error)
- func (Provider) ParseArtifactRepository(artifactRepository string) (string, error)
Constants ¶
const (
// ProviderName is the name of the Docker Hub authentication provider.
ProviderName = "dockerhub"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
AccessToken is a Docker Hub access token obtained by exchanging an OIDC identity.
func (*AccessToken) GetDuration ¶
func (a *AccessToken) GetDuration() time.Duration
GetDuration implements auth.Credential.
type Implementation ¶
type Implementation interface {
ExchangeToken(ctx context.Context, client *http.Client, endpoint string, form url.Values) (*http.Response, error)
}
Implementation performs the Docker Hub HTTP exchange. It exists so tests can substitute the transport layer.
type Provider ¶
type Provider struct{ Implementation }
Provider implements auth.ArtifactRegistryCredentialsProvider for Docker Hub OIDC connections. It exchanges an OIDC identity for a short-lived Docker Hub access token; it does not support controller, Git, or REST config credentials.
func (Provider) GetAccessCredentialOptionsForArtifactRepository ¶
func (Provider) GetAccessCredentialOptionsForArtifactRepository(artifactRepository string, _ ...auth.Option) ([]auth.Option, error)
GetAccessCredentialOptionsForArtifactRepository implements auth.ArtifactRegistryCredentialsProvider. It pins the OIDC audience to the identity endpoint matching the registry host.
func (Provider) GetAudiences ¶
GetAudiences implements auth.Provider.
func (Provider) GetIdentity ¶
GetIdentity implements auth.Provider. The connection ID scopes cached credentials to the Docker Hub OIDC connection that issued them.
func (Provider) NewAccessCredentialForIdentity ¶
func (p Provider) NewAccessCredentialForIdentity(ctx context.Context, identity auth.Credential, opts ...auth.Option) (auth.Credential, error)
NewAccessCredentialForIdentity implements auth.Provider. It exchanges the supplied JWT identity for a Docker Hub access token.
func (Provider) NewArtifactRegistryCredentials ¶
func (Provider) NewArtifactRegistryCredentials(_ context.Context, _ string, accessCredential auth.Credential, opts ...auth.Option) (*auth.ArtifactRegistryCredentials, error)
NewArtifactRegistryCredentials implements auth.ArtifactRegistryCredentialsProvider.
func (Provider) NewControllerToken ¶
NewControllerToken implements auth.Provider. Docker Hub OIDC has no ambient controller identity: credentials must be obtained by exchanging a workload identity.