MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / validateOCICredentials

Function validateOCICredentials

internal/ociauth/auth.go:81–93  ·  view source on GitHub ↗

validate if the provided OCI credentials are valid They include a username, password and a valid (RFC 3986 URI authority) serverName

(c *Credentials)

Source from the content-addressed store, hash-verified

79// validate if the provided OCI credentials are valid
80// They include a username, password and a valid (RFC 3986 URI authority) serverName
81func validateOCICredentials(c *Credentials) (authn.Keychain, error) {
82 if c.username == "" || c.password == "" || c.server == "" {
83 return nil, errors.New("OCI credentials require a username, password and a server name")
84 }
85
86 // name.NewRepository parses incorrectly URIs with schemas
87 // name.NewRegistry does it correctly but that will break the fact that we authenticate using full paths
88 if c.server == "http:" || c.server == "https:" {
89 return nil, errors.New("credentials server name must not contain a scheme (\"http://\")")
90 }
91
92 return c, nil
93}

Callers 2

NewCredentialsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected