Documentation
¶
Index ¶
- Constants
- func AcquireTokenViaChallenge(ctx context.Context, registryHost string, repository string, ...) (string, string, string, error)
- func GetAuthHeaderForImage(ctx context.Context, imageRef string, enabledRegs []models.ContainerRegistry) (string, error)
- func GetChallengeRequest(ctx context.Context, u url.URL) (*http.Request, error)
- func GetChallengeURL(imageRef string) (url.URL, error)
- func GetRegistryAddress(imageRef string) (string, error)
- func ResolveAuthHeaderForRepository(ctx context.Context, host, repository, tag string, ...) (string, string, string, error)
- type Client
- func (c *Client) CheckAuth(ctx context.Context, registry string) (string, error)
- func (c *Client) GetLatestDigest(ctx context.Context, registry, repository, tag, token string) (string, error)
- func (c *Client) GetLatestDigestTimed(ctx context.Context, registry, repository, tag, token string) (string, time.Duration, error)
- func (c *Client) GetRegistryURL(registry string) string
- func (c *Client) GetToken(ctx context.Context, authURL, repository string, creds *Credentials) (string, error)
- func (c *Client) GetTokenMulti(ctx context.Context, authURL string, repositories []string, creds *Credentials) (string, error)
- func (c *Client) ParseAuthChallenge(header string) (string, string)
- type Credentials
- type TestResult
Constants ¶
View Source
const ChallengeHeader = "WWW-Authenticate"
View Source
const ContentDigestHeader = "Docker-Content-Digest"
View Source
const DefaultRegistry = "registry-1.docker.io"
View Source
const DefaultRegistryDomain = "docker.io"
View Source
const DefaultRegistryHost = "index.docker.io"
Variables ¶
This section is empty.
Functions ¶
func AcquireTokenViaChallenge ¶
func AcquireTokenViaChallenge( ctx context.Context, registryHost string, repository string, challengeHeader string, enabledRegs []models.ContainerRegistry, ) (string, string, string, error)
AcquireTokenViaChallenge: Parses a WWW-Authenticate Bearer challenge, builds an auth URL, tries anonymous multi-scope token, then credential-based. Returns (token, method, username, error)
func GetAuthHeaderForImage ¶
func GetAuthHeaderForImage(ctx context.Context, imageRef string, enabledRegs []models.ContainerRegistry) (string, error)
GetAuthHeaderForImage performs the /v2/ challenge for an image and returns a usable Authorization header. It supports Basic and Bearer challenges. For Bearer, it reuses AcquireTokenViaChallenge which looks up credentials from the database (enabledRegs) when needed.
func GetChallengeRequest ¶
func GetChallengeURL ¶
GetChallengeURL returns https://<host>/v2/ for a given image ref (normalized). host is normalized so docker.io => index.docker.io.
func GetRegistryAddress ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides helper methods for Docker/OCI registries.
func (*Client) GetLatestDigest ¶
func (*Client) GetLatestDigestTimed ¶
func (*Client) GetRegistryURL ¶
func (*Client) GetTokenMulti ¶
type Credentials ¶
type TestResult ¶
type TestResult struct {
OverallSuccess bool `json:"overall_success"`
PingSuccess bool `json:"ping_success"`
AuthSuccess bool `json:"auth_success"`
CatalogSuccess bool `json:"catalog_success"`
URL string `json:"url"`
Domain string `json:"domain"`
Timestamp time.Time `json:"timestamp"`
Errors []string `json:"errors"`
}
func TestRegistryConnection ¶
func TestRegistryConnection(ctx context.Context, registryURL string, creds *Credentials) (*TestResult, error)
Click to show internal directories.
Click to hide internal directories.