-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support of BasicAuthentication Authentication to Git #1940
Add support of BasicAuthentication Authentication to Git #1940
Conversation
Can one of the admins verify this patch? |
Where this user and password is come from. How they are stored? |
It should come from the client. for example in the POST call it will be added to the oData in format of for example |
Can one of the admins verify this patch? |
0b9f6d3
to
34eeb7d
Compare
ok. @vinokurig ? |
final String pass = parameters.get("password"); | ||
if (user != null && pass != null) { | ||
setCredentials = true; | ||
GitBasicAuthenticationCredentialsProvider.setCurrentCredentials(user, pass); |
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.
Please add static import
34eeb7d
to
4c52b09
Compare
@vinokurig - I fixed the comment |
private static final String GIT_PROJECT_ID = "git-project-id"; | ||
|
||
@Override | ||
public UserCredential getUserCredential() throws GitException { |
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.
This method never throws GitException, I think you should remove this 'throws'
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.
@vinokurig - Its is how the interfce CredentialsProvider
UserCredential getUserCredential() throws GitException;
also GitHubOAuthCredentialProvider has the same logic
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.
Yes, but you are not obligated to add throws GitException
in overridden method.
In this case you will get rid of of try-catch in canProvideCredentials()
method
4c52b09
to
c4735b2
Compare
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - API |
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.
Wrong license: * Codenvy, S.A. - initial API and implementation
Please fix |
c4735b2
to
e769fb8
Compare
@vinokurig - Fixed the comment |
Please remove new line (1593) in |
e769fb8
to
5ab7896
Compare
@vinokurig - fixed the last issue |
ok for me |
|
||
private static final Logger LOG = LoggerFactory.getLogger(GitBasicAuthenticationCredentialsProvider.class); | ||
private static ThreadLocal<UserCredential> currRequestCredentials = new ThreadLocal<>(); | ||
private static final String GIT_PROJECT_ID = "git-project-id"; |
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.
Are you sure that git-project-id
is good name for CredentialsProvider? Mb git-basic
or just basic
would be better?
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.
I will fix it
public ProviderInfo(@NotNull String providerName) { | ||
info.put(PROVIDER_NAME, providerName); | ||
} | ||
|
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.
also please fix java doc of getAuthenticateUrl method and describe that it can return null value and add org.eclipse.che.commons.annotation.Nullable for it
da69e82
to
2db28d8
Compare
@sleshchenko - fixed the comments |
@i053322 What about #1940 (comment) ? |
return info.get(AUTHENTICATE_URL); | ||
} | ||
/** | ||
* @return authenticate URL. It could retrun null value. |
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.
typo retrun
2db28d8
to
20ffbb0
Compare
@sleshchenko - fixed the comments |
@Override | ||
public UserCredential getUserCredential() { | ||
UserCredential credentials = currRequestCredentials.get(); | ||
return credentials; |
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.
just return currRequestCredentials.get();
?
LGTM |
@vinokurig wdyt? |
20ffbb0
to
b3e54e0
Compare
@sleshchenko - fixed the last comment |
Ok for me |
@vinokurig please continue merging this pr in appropriate moment of our release cycle |
@skabashnyuk - can I create PR for 3.x ? |
@i053322 Yes, you can create a PR to 3.x. We have merged big changes to 4.x and it became unstable. This PR will be merged when 4.x master will become stable. |
@Singleton | ||
public class GitBasicAuthenticationCredentialsProvider implements CredentialsProvider { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(GitBasicAuthenticationCredentialsProvider.class); |
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.
this is unused here, please remove it
Signed-off-by: i053322 <[email protected]>
b3e54e0
to
2047a5b
Compare
…#1940) Signed-off-by: i053322 <[email protected]>
What does this PR do?
Add support of Basic Authenticationt git.
It will support in operation of import,clone,fetch,rebase,push,pull.
The user will provide the user and password for the request and it will create credentials provider
What issues does this PR fix or reference?
Add support to clone and work with repository that support basic authentication
Previous Behavior
Remove this section if not relevant
It was not possible to work with repository that need basic Authentication
New Behavior
This content may also be included in the release notes.
Tests written?
Yes/No
It exist for our scenario
Docs requirements?
Include the content for all the docs changes required.
Please review Che's Contributing Guide for best practices.
Signed-off-by: i053322 [email protected]