Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support IdentityToken in AuthConfiguration #744

Merged
merged 5 commits into from
Aug 13, 2018

Conversation

GeorgeMac
Copy link
Contributor

This change adds support for the sending and parsing of an
IdentityToken in an AuthConfiguration. IdentityToken's are retrieved via the /auth call (see
AuthCheck) and can then be used in place of the password. After a
successful docker login a users .dockercfg can contain an identity
token in place of the original username and password in the auth field.

See: https://docs.docker.com/engine/api/v1.25/#section/Authentication

Also see official docker types https://godoc.org/github.com/docker/docker/api/types#AuthConfig

This change adds support for the sending and parsing of an
IdentityToken. IdentityToken's are retrieved via the /auth call (see
AuthCheck) and can then be used in place of the password. After a
successful `docker login` a users `.dockercfg` can contain an identity
token in place of the original username and password in the auth field.
Having this present appears to break the authentication. So I have
dropped it from being populated.
Copy link
Owner

@fsouza fsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth_test.go Outdated
read := strings.NewReader(fmt.Sprintf(`{"auths":{"docker.io":{"auth":"%s","identitytoken":"sometoken"}}}`, auth))
ac, err := NewAuthConfigurations(read)
if err != nil {
t.Error(err)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace this with t.Fatal(err) so the test execution aborts after failing?

@GeorgeMac
Copy link
Contributor Author

🙇 my pleasure. I will jump on that now.

The docker config auths field is still expected to contain a base64
encoded string which is a colon ':' delimited username and password.
Even if the password is blank. This updates the test to include a
trailing colon in the auths payload. The password is empty as an
identitytoken should be provided.
Copy link
Owner

@fsouza fsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

@fsouza fsouza merged commit ddfe58f into fsouza:master Aug 13, 2018
@GeorgeMac
Copy link
Contributor Author

🎉 amazing, thank you for the speedy response!

@GeorgeMac GeorgeMac deleted the gm/identitytoken branch August 13, 2018 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants