validate if the provided OCI credentials are valid They include a username, password and a valid (RFC 3986 URI authority) serverName
(c *Credentials)
| 79 | // validate if the provided OCI credentials are valid |
| 80 | // They include a username, password and a valid (RFC 3986 URI authority) serverName |
| 81 | func 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 | } |
no outgoing calls
no test coverage detected