-
Notifications
You must be signed in to change notification settings - Fork 85
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 OAuth for Git-over-HTTP #173
Comments
Good point.
Nobody has contributed it until now.
👍 @lucamilanesio how |
Note, that @Override
public OAuthUserInfo login(String username, String secret)
throws IOException {
if (username == null || secret == null) {
throw new IOException("Authentication error");
}
AccessToken accessToken;
try {
if (uaaClient.isAccessTokenForClient(username, secret)) {
// "secret" is an access token for a client, i.e. a
// technical user; send it to UAA for verification
if (!uaaClient.verifyAccessToken(secret)) {
throw new IOException("Authentication error");
}
return getAsOAuthUserInfo(username);
} else {
if (uaaClient.isAccessTokenForUser(username, secret)) {
// "secret" is an access token for an ordinary user;
// send it to UAA for verification
if (!uaaClient.verifyAccessToken(secret)) {
throw new IOException("Authentication error");
}
accessToken = uaaClient.toAccessToken(secret, EMPTY_STRING);
} else {
// "secret" is not an access token but likely a password;
// send username and password to UAA and try to get an access
// token; if that succeeds the user is authenticated
accessToken = uaaClient.getAccessToken(username, secret);
}
return getAsOAuthUserInfo(accessToken);
}
} catch (UAAClientException e) {
throw new IOException("Authentication error", e);
}
} |
However, to access the accessToken from the
However, the password grant type is prohibited in the latest OAuth 2.0 Security Best Current Practice specification. That's why it's not implemented. |
Sorry, could you elaborate a little bit on what |
Apparently I confused the current implementation in |
Hello @rohanj1 I use the git-credential-oauth plugin for the git client. My configuration is the following: I only get a Before a more deep dive into the Error I would like to ensure the right configuration. Can you please share your configuration and how you tested your implementation (if other method for the git client was used)? |
Hi @tfree-coding, The git-credential-oauth plugin should work. However, for testing I'd recommend using your username and token as password without the helper. The helper might need some patches for it to work with gerrit correctly. For the dex plugin the password is expected to be in a json format (this may or may not be the case for you) ex: I also found that Gerrit requires a patch to work correctly as well which I have posted here Additionally, if you are already using a different OAuth provider and want to use a different one with the git helper you may run into external-id conflicts within gerrit. So you may want to play around with this parameter which helps migrate between different providers |
Hi, we are trying to move away from SSH and HTTP-password-based authentication to OAuth for git operations. Are there any plans to support OAuth-token authentication for Git-over-HTTP? Based on #84, it seems like the OAuthLoginProvider interface has to be implemented. Is there a specific reason/issue for which this was not implemented? I would be happy to contribute. Thanks.
The text was updated successfully, but these errors were encountered: