Help us shape the future of Go! Take the 2026 Go Developer Survey

auth

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenProvider

type AccessTokenProvider struct {
	// contains filtered or unexported fields
}

AccessTokenProvider uses access tokens directly from the credential store

func NewAccessTokenProvider

func NewAccessTokenProvider(configStore *ConfigStore, configKey string) *AccessTokenProvider

NewAccessTokenProvider creates a token provider that uses access tokens from the credential store

func NewAccessTokenProviderFromStore

func NewAccessTokenProviderFromStore(configStore *ConfigStore, configKey string) (*AccessTokenProvider, error)

NewAccessTokenProviderFromStore creates an AccessTokenProvider from a ConfigStore Returns error if no valid access token is available

func (*AccessTokenProvider) EnsureToken

func (p *AccessTokenProvider) EnsureToken(ctx context.Context) (string, error)

func (*AccessTokenProvider) Username

func (p *AccessTokenProvider) Username() string

type ConfigStore

type ConfigStore struct {
	// contains filtered or unexported fields
}

ConfigStore wraps the config file and provides credential access methods

func NewConfigStore

func NewConfigStore() *ConfigStore

NewConfigStore creates a new ConfigStore with the default config file

func (*ConfigStore) GetCredentialStoreAccessTokens

func (c *ConfigStore) GetCredentialStoreAccessTokens(registryEntry string) (string, string, error)

GetCredentialStoreAccessTokens retrieves the JWT that Desktop uses for API sessions.

func (*ConfigStore) GetCredentialStorePullTokens

func (c *ConfigStore) GetCredentialStorePullTokens(registryEntry string) (string, string, error)

GetCredentialStorePullTokens retrieves the user credentials the the user is using to pull. This may be a username/password, a PAT, or an OAT.

type LoginTokenProvider

type LoginTokenProvider struct {
	// contains filtered or unexported fields
}

LoginTokenProvider uses static username/password to obtain tokens via login API The name of this struct was specifically chosen to troll iam-team :)

func NewLoginTokenProvider

func NewLoginTokenProvider(username, password, baseURL string, transport http.RoundTripper) *LoginTokenProvider

NewLoginTokenProvider creates a token provider that uses username/password

func NewLoginTokenProviderFromStore

func NewLoginTokenProviderFromStore(configStore *ConfigStore, configKey, baseURL string, transport http.RoundTripper) (*LoginTokenProvider, error)

NewLoginTokenProviderFromStore creates a LoginTokenProvider from pull credentials in the ConfigStore

func (*LoginTokenProvider) EnsureToken

func (p *LoginTokenProvider) EnsureToken(ctx context.Context) (string, error)

EnsureToken returns a cached token if valid, otherwise authenticates with username/password to get a new token from the Docker Hub API.

func (*LoginTokenProvider) Username

func (p *LoginTokenProvider) Username() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL