Skip to content

add OAuth authentication #262

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

Merged
merged 18 commits into from
Apr 14, 2020
Merged

add OAuth authentication #262

merged 18 commits into from
Apr 14, 2020

Conversation

kurddt
Copy link
Contributor

@kurddt kurddt commented Dec 4, 2019

Your checklist for this pull request

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

I tried to revive #69 by re-basing on master and adapting the code to the changes that was made since especially #101 .

The functionality is working, but the normal user/password is broken. I don't really have any idea how to make both work so any suggestion would be greatly appreciated

I'm not sure how to deal with real username/password after that
@jetersen
Copy link
Member

Thanks for picking up the effort :)

@kurddt
Copy link
Contributor Author

kurddt commented Dec 12, 2019

@Casz Any idea on whom could help me / give me some pointer on how to support both OAuth and user/password credentials ?

Check if the provided credential match a valid Bitbucket OAuth key/secret
@kurddt kurddt marked this pull request as ready for review December 18, 2019 12:34
@kurddt
Copy link
Contributor Author

kurddt commented Dec 18, 2019

I made a test case for the OAuth authenticator but it requires an access to bitbucket.org and to generate a OAuth key/secret so I didn't include it in the PR

@jetersen
Copy link
Member

I'd appreciate if you could avoid force pushing 😓

@kurddt
Copy link
Contributor Author

kurddt commented Dec 20, 2019

Sure. Any idea why the integration failed on jenkins ?

@jetersen
Copy link
Member

@kurddt
Copy link
Contributor Author

kurddt commented Dec 23, 2019

@Casz Is there any way to re-start it ?

@jetersen jetersen closed this Dec 23, 2019
@jetersen jetersen reopened this Dec 23, 2019
Co-Authored-By: Joseph Petersen <[email protected]>
Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

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

LGTM one nit pick

@jetersen jetersen changed the title add OAuth authentificator add OAuth authentication Jan 28, 2020
@jetersen
Copy link
Member

Problem atm is both Oauth and username password uses the same base class StandardUsernamePasswordCredentials

@jetersen
Copy link
Member

I would love some documentation on how to set this up.
Cause I will need the docs to test this 😓

@kurddt
Copy link
Contributor Author

kurddt commented Jan 29, 2020

I could write a small documentation, about the usage of this feature just tell me in which format and/or where you want want it.

Concerning, the base class. Even if they use the same base class, the class can detect if the credentials match a API key and secret. The other solution would be to introduce an other type of credentials in Jenkins but I had no idea how to do so.

@jetersen
Copy link
Member

@jetersen
Copy link
Member

jetersen commented Feb 3, 2020

link to see current commit author: https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/262/commits/13ca375e745844106dba199de36ac202b9959d9f.patch

@kurddt
You might want to set up an email alias on your GitHub account 🥇
https://help.github.com/articles/adding-an-email-address-to-your-github-account/

Or look into fixing your git user.email config 😅
https://help.github.com/articles/setting-your-commit-email-address-in-git
then you would need to amend your commits: https://stackoverflow.com/a/3042512
after changing author

to get proper credit for your commits 🏆

@kurddt
Copy link
Contributor Author

kurddt commented Feb 3, 2020

@Casz Thanks, I made a new clone of the repo but forgot to change the local git config 😅

@stale
Copy link

stale bot commented Apr 3, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 3, 2020
@jetersen jetersen removed the stale label Apr 3, 2020
@cblakkan
Copy link

cblakkan commented Apr 8, 2020

It would be awesome to have this functionality supported, did this go stale?

@jetersen
Copy link
Member

jetersen commented Apr 8, 2020

hopefully #299 should remove the blocker


public class BitbucketOAuthAuthenticator extends BitbucketAuthenticator {

private Token token;
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps a good idea to cache the token, I assume it has a validity time 🤔

Copy link
Member

@jetersen jetersen Apr 14, 2020

Choose a reason for hiding this comment

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

I think we can move forward without caching. Perhaps a future PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants