Change Docker client to support OAuth-based flow for login
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>
This commit is contained in:
parent
e896d1d7c4
commit
a6d0c66b4c
|
@ -57,12 +57,16 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if response.IdentityToken != "" {
|
||||
authConfig.Password = ""
|
||||
authConfig.IdentityToken = response.IdentityToken
|
||||
}
|
||||
if err := storeCredentials(cli.configFile, authConfig); err != nil {
|
||||
return fmt.Errorf("Error saving credentials: %v", err)
|
||||
}
|
||||
|
||||
if response.Status != "" {
|
||||
fmt.Fprintf(cli.out, "%s\n", response.Status)
|
||||
fmt.Fprintln(cli.out, response.Status)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -120,6 +124,7 @@ func (cli *DockerCli) configureAuth(flUser, flPassword, serverAddress string, is
|
|||
authconfig.Username = flUser
|
||||
authconfig.Password = flPassword
|
||||
authconfig.ServerAddress = serverAddress
|
||||
authconfig.IdentityToken = ""
|
||||
|
||||
return authconfig, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue