Skip to content

Commit

Permalink
Change Docker client to support OAuth-based flow for login
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
aaronlehmann authored and dmcgowan committed Mar 9, 2016
1 parent e896d1d commit a6d0c66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/client/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit a6d0c66

Please sign in to comment.