This mechanism exchanges basic auth credentials for an identity token.
The identity token is used going forward to request scoped-down tokens
to use for registry operations.
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
| ... | ... |
@@ -57,12 +57,16 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
|
| 57 | 57 |
return err |
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 |
+ if response.IdentityToken != "" {
|
|
| 61 |
+ authConfig.Password = "" |
|
| 62 |
+ authConfig.IdentityToken = response.IdentityToken |
|
| 63 |
+ } |
|
| 60 | 64 |
if err := storeCredentials(cli.configFile, authConfig); err != nil {
|
| 61 | 65 |
return fmt.Errorf("Error saving credentials: %v", err)
|
| 62 | 66 |
} |
| 63 | 67 |
|
| 64 | 68 |
if response.Status != "" {
|
| 65 |
- fmt.Fprintf(cli.out, "%s\n", response.Status) |
|
| 69 |
+ fmt.Fprintln(cli.out, response.Status) |
|
| 66 | 70 |
} |
| 67 | 71 |
return nil |
| 68 | 72 |
} |
| ... | ... |
@@ -120,6 +124,7 @@ func (cli *DockerCli) configureAuth(flUser, flPassword, serverAddress string, is |
| 120 | 120 |
authconfig.Username = flUser |
| 121 | 121 |
authconfig.Password = flPassword |
| 122 | 122 |
authconfig.ServerAddress = serverAddress |
| 123 |
+ authconfig.IdentityToken = "" |
|
| 123 | 124 |
|
| 124 | 125 |
return authconfig, nil |
| 125 | 126 |
} |