-
Notifications
You must be signed in to change notification settings - Fork 564
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
Conversation
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.
This reverts commit ae31b47.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @GeorgeMac, thank you very much for contributing!
Can you take a look at the build failure?
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) |
There was a problem hiding this comment.
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?
🙇 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.
There was a problem hiding this 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!
🎉 amazing, thank you for the speedy response! |
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 identitytoken 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