MCPcopy Create free account
hub / github.com/docker/cli / getCredentialsFromStore

Method getCredentialsFromStore

cli/config/credentials/native_store.go:119–141  ·  view source on GitHub ↗

getCredentialsFromStore executes the command to get the credentials from the native store.

(serverAddress string)

Source from the content-addressed store, hash-verified

117
118// getCredentialsFromStore executes the command to get the credentials from the native store.
119func (c *nativeStore) getCredentialsFromStore(serverAddress string) (types.AuthConfig, error) {
120 var ret types.AuthConfig
121
122 creds, err := client.Get(c.programFunc, serverAddress)
123 if err != nil {
124 if credentials.IsErrCredentialsNotFound(err) {
125 // do not return an error if the credentials are not
126 // in the keychain. Let docker ask for new credentials.
127 return ret, nil
128 }
129 return ret, err
130 }
131
132 if creds.Username == tokenUsername {
133 ret.IdentityToken = creds.Secret
134 } else {
135 ret.Password = creds.Secret
136 ret.Username = creds.Username
137 }
138
139 ret.ServerAddress = serverAddress
140 return ret, nil
141}
142
143// listCredentialsInStore returns a listing of stored credentials as a map of
144// URL -> username.

Callers 2

GetMethod · 0.95
GetAllMethod · 0.95

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected