-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
OAuth2 flow fails against docker trusted registry (missing client_id) #1545
Comments
Note that the following fix: @@ -269,7 +269,7 @@ public class RegistryAuthenticator {
String serviceScope = getServiceScopeRequestParameters(scope);
return isOAuth2Auth()
? serviceScope
- + "&grant_type=refresh_token&refresh_token="
+ + "&client_id=jib&grant_type=refresh_token&refresh_token="
// If OAuth2, credential.getPassword() is a refresh token.
+ Verify.verifyNotNull(credential).getPassword()
: serviceScope; Fixes this issue for me, but I imagine it might cause problems with other OAuth2 endpoints. Does anyone know if ACR (for example) will be affected by a dummy client_id in the request? |
Aha! Thanks @apwil for the detailed information and a pointer for a potential fix. Since the spec says |
@chanseokoh I have tested your PR over ACR, it passes. |
Thanks @chanseokoh for the very quick turnaround of this issue! |
@apwil Jib 1.1.0 with the fix released. |
Description of the issue:
When pulling/pushing to a docker trusted registry, authentication fails with error:
400 Bad Request {"details":"invalid client ID"}
Docker registry (DTR) requires a client_id parameter to be passed with the refresh_token when making a login request.
From
https://docs.docker.com/registry/spec/auth/oauth/
Expected behavior:
It should be possible to pull a base image from an internal docker registry (DTR) using OAuth2 authentication flow.
Steps to reproduce:
Observe that the login is stored as an OAuth token
mvn jib:dockerBuild
Build fails with error:
Unauthorized for internalregistry/base/custom-base-image: 400 Bad Request
[ERROR] {"details":"invalid client ID"}
Environment:
jib-maven-plugin 1.0.2
maven 3.5.0
jdk 1.8.0_131
jib-maven-plugin
Configuration:Log output:
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.0.2:dockerBuild (default-cli) on project my-project Build to Docker daemon failed, perhaps you should set a credential helper name with the configuration '' or set credentials for 'internalregistry' in your Maven settings: Unauthorized for internalregistry/base/custom-base-image: 400 Bad Request
[ERROR] {"details":"invalid client ID"}
The text was updated successfully, but these errors were encountered: