GetAll retrieves all the credentials from the native store.
()
| 58 | |
| 59 | // GetAll retrieves all the credentials from the native store. |
| 60 | func (c *nativeStore) GetAll() (map[string]types.AuthConfig, error) { |
| 61 | auths, err := c.listCredentialsInStore() |
| 62 | if err != nil { |
| 63 | return nil, err |
| 64 | } |
| 65 | |
| 66 | // Emails are only stored in the file store. |
| 67 | // This call can be safely eliminated when emails are removed. |
| 68 | fileConfigs, _ := c.fileStore.GetAll() |
| 69 | |
| 70 | authConfigs := make(map[string]types.AuthConfig) |
| 71 | for registry := range auths { |
| 72 | creds, err := c.getCredentialsFromStore(registry) |
| 73 | if err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | ac := fileConfigs[registry] // might contain Email |
| 77 | ac.Username = creds.Username |
| 78 | ac.Password = creds.Password |
| 79 | ac.IdentityToken = creds.IdentityToken |
| 80 | if ac.ServerAddress == "" { |
| 81 | ac.ServerAddress = creds.ServerAddress |
| 82 | } |
| 83 | authConfigs[registry] = ac |
| 84 | } |
| 85 | |
| 86 | return authConfigs, nil |
| 87 | } |
| 88 | |
| 89 | // Store saves the given credentials in the file store. |
| 90 | func (c *nativeStore) Store(authConfig types.AuthConfig) error { |