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

Set Github token through workspace master Rest API. Added a force act… #4438

Merged
merged 3 commits into from
Mar 16, 2017

Conversation

sunix
Copy link
Contributor

@sunix sunix commented Mar 15, 2017

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan sutan@redhat.com

What does this PR do?

  • add a new REST operation to set a Oauth token to an existing provider
  • add a property che.oauth.github.forceactivation to force registration of Github Oauth provider, even without client id/secret (actually set NULL string for these value)

What issues does this PR fix or reference?

https://issues.jboss.org/browse/CHE-151

Changelog

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Release Notes

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Docs PR

…ivation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
@sunix sunix requested review from l0rd and skabashnyuk March 15, 2017 16:21

@POST
@Path("token")
@Produces(MediaType.APPLICATION_JSON)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove produces

@JamesDrummond JamesDrummond self-requested a review March 15, 2017 17:03
@JamesDrummond
Copy link
Contributor

@codenvy-ci
Copy link

…rce activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
@sunix
Copy link
Contributor Author

sunix commented Mar 15, 2017

Copy link
Contributor

@skabashnyuk skabashnyuk left a comment

Choose a reason for hiding this comment

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

I don't like the idea to change existed OAuthAuthenticationService.java it's potential security hole. Can you do
OpenshiftOAuthTokenSetterService with single method POST and OpenshiftOAuthTokenProvider that connected to OpenshiftOAuthTokenSetterService ?

@codenvy-ci
Copy link

@sunix
Copy link
Contributor Author

sunix commented Mar 15, 2017

GET token is a potential security hole, POST isn't. It is not secured to get its token stolen, but setting a token ... I don't see how it can be a security hole

@skabashnyuk
Copy link
Contributor

I don't see it either (now). But my butt told be that this is too risky to have it on non-openshift specific environment. And I would like to do that by moving such code in openshift specific REST service and custom OAuthTokenProvider.

@sunix
Copy link
Contributor Author

sunix commented Mar 15, 2017

@skabashnyuk sorry I don't get why you think this is risky. Please provide good reasons not to approve it. This is a very generic use case that may be used not only by openshift: a third party application that want to integrate Che and not recreate another clientid/secret to perform another oauth flow. We could even add a UI and let the user set his personal token created in Github.

@l0rd
Copy link
Contributor

l0rd commented Mar 15, 2017

@skabashnyuk I don't see why this should be related to OpenShift

@sunix sunix requested a review from benoitf March 15, 2017 22:50
@skabashnyuk
Copy link
Contributor

The reason is that the method you want to add is not a part of general OAuth flow and is made only for some specific rare use case.

@skabashnyuk
Copy link
Contributor

BTW how are you going to protect the system from attack of such kind
while(true){
curl post token
}
I think it will take less when a minute before OOM
?

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

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

I agree with Sergii that this functionality is not part of OAuth flow, so it should not be integrated into OAuth service.
Here is my view on why it doesn't fit:
Our app uses tokens to access Github API.
OAuth specifies how to retrieve these tokens.
Setting token from personal application tokens list/from file/from another source is not part of OAuth flow.
This looks like part of single sign on process, which is not part of OAuth.
So generally I'm +1 in addition possibility to provide API token in a way that is not supposed by OAuth flow. But it should be done separately from our OAuth service.

@@ -45,6 +45,7 @@ che.oauth.github.clientsecret=oauth.github.clientsecret
che.oauth.github.authuri=oauth.github.authuri
che.oauth.github.tokenuri=oauth.github.tokenuri
che.oauth.github.redirecturis=oauth.github.redirecturis
che.oauth.github.forceactivation=oauth.github.forceactivation

Choose a reason for hiding this comment

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

BTW aliases file is for renaming of properties. So you should not modify it when you add new property.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will remove it in a fixup

@sunix
Copy link
Contributor Author

sunix commented Mar 16, 2017

I'm going to create a new PR to master and make few fixup ( the one from @garagatyi , + use createAndStoreCredential method) so we can discuss about that for a merge to master. I'm going to merge that in our branch for the time being as we need this

About the flow. If it's not in the flow, then we should ask Google not make createAndStoreCredential public in their google-oauth-java-client. https://github.com/google/google-oauth-java-client/blob/dev/google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/AuthorizationCodeFlow.java#L221
This is the OAuth flow, but the first part is done by another microservice or process.

I guess if you loop curl post ... it will store in a map in the same entry so no OOM

…rce activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
@sunix
Copy link
Contributor Author

sunix commented Mar 16, 2017

#4444 for a merge to master, I'm merging this one to openshift-connector

@sunix sunix merged commit 1818cb8 into eclipse-che:openshift-connector Mar 16, 2017
@codenvy-ci
Copy link

sunix added a commit that referenced this pull request Mar 17, 2017
…rce act… (#4438)

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
@JamesDrummond JamesDrummond added this to the 5.6.0 milestone Mar 17, 2017
l0rd pushed a commit that referenced this pull request Mar 20, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
l0rd pushed a commit that referenced this pull request Mar 20, 2017
…rce act… (#4438)

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
@JamesDrummond JamesDrummond mentioned this pull request Apr 2, 2017
9 tasks
@sunix
Copy link
Contributor Author

sunix commented Apr 2, 2017

@JamesDrummond this will not be part of 5.6.0

@JamesDrummond JamesDrummond modified the milestones: 5.7.0, 5.6.0 Apr 2, 2017
@JamesDrummond
Copy link
Contributor

@sunix I have a lot of pr's to go through so I can check to the hour which ones are part of current release. The ones that are merged same day of release I try to get right but again there are many to go through. Be sure to put a milestone label, anytime you merge, to the next release milestone which in this case 5.7.0 .

@skabashnyuk skabashnyuk removed this from the 5.7.0 milestone Apr 3, 2017
sunix added a commit to sunix/che that referenced this pull request May 4, 2017
eclipse-che#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit to sunix/che that referenced this pull request May 10, 2017
eclipse-che#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request May 11, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request May 17, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request May 17, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request May 19, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request May 19, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request Jun 2, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request Jun 6, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request Jun 12, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
sunix added a commit that referenced this pull request Jun 13, 2017
#4438)

Set Github token through workspace master Rest API. Added a force activation property variable to register Github Oauth provider even without client id/secret

Signed-off-by: Sun Seng David Tan <sutan@redhat.com>
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.

6 participants