git-credential-manager icon indicating copy to clipboard operation
git-credential-manager copied to clipboard

Issue/573 OAuth2 support for Bitbucket DC

Open mminns opened this issue 4 years ago • 20 comments

(Bloody Hell it works.)

Bitbucket DC 7.20 now supports OAuth 2.0 connections from external applications. https://confluence.atlassian.com/bitbucketserver/bitbucket-data-center-and-server-7-20-release-notes-1101934428.html

This means OAuth 2.0 access_tokens can be used as authentication between Git and Bitbucket DC.

The PR refactors the Bitbucket module provide a more generic framework for supporting OAuth 2.0 and providing implementations for both Bitbucket Cloud and Bitbucket DC as they are unfortunately not exactly the same.

Because each Bitbucket DC installation is a unique instance the OAuth 2.0 ClientId and ClientSecret are unique to each installation and therefore GCM must be configured to support each Bitbucket DC instance.

Documentation is updated to describe how to configure and use the feature.

Tests are extended to cover Bitbucket DC.

I've been dogfooding it for the last month.

mminns avatar Jan 12 '22 15:01 mminns

I'm currently dogfooding this and awaiting some minor tweaks to the OAuth2 support in Bitbucket, once I'm happy it working and the OAuth2 support has been publicly released in Bitbucket I'll open up this PR.

mminns avatar Jan 26 '22 11:01 mminns

I've been dogfooding this for a month and I believe its al working.

Apologies for the size. A significant chunk is refactoring and tests.

Thanks

mminns avatar Mar 11 '22 13:03 mminns

Thanks for the feedback, I'll start taking a look this week 👍

mminns avatar May 16 '22 07:05 mminns

Thanks for the feedback, I'll start taking a look this week 👍

Thanks so much Mike! We're also working on aligning with the Git project on commit formatting/organization. While you're making your changes, would you mind updating the format/organization of your commits per the guidance in this presentation? (There's also an awesome talk you can watch, but the slides are quicker if you're under time constraints 😊).

ldennington avatar May 16 '22 18:05 ldennington

Rebased first 👍

mminns avatar May 17 '22 12:05 mminns

Also apologies for the surprising number of typos/comments/TODOs etc 😬

mminns avatar May 17 '22 13:05 mminns

OK, I think I've addressed the issues mentioned above, I'm just working on restructuring the commits.

mminns avatar May 20 '22 13:05 mminns

OK,I think I have a much better structure for the commits.

I'm going to dogfood for a couple of days next week before pushing the rebase, fixes and revised commits.

Have a good weekend.

mminns avatar May 20 '22 19:05 mminns

Thanks so much for all your efforts here Mike. Take all the time you need to dogfood - I'll keep an eye out for your next push.

ldennington avatar May 23 '22 03:05 ldennington

I've updated the PR. I've covered the issues raised, hopefully. I've restructured the commits, hopefully this will make the review easier.

But please flag anything you think still needs looking at.

mminns avatar May 26 '22 12:05 mminns

Thanks for the feedback, hopefully it feels like we're making progress :)

I've been away but I'll pick it up again this week. 👍

mminns avatar Jun 06 '22 08:06 mminns

Rebased after the latest changes to the Btbucket UI then I'll address the remaining comments 👍

mminns avatar Jun 22 '22 20:06 mminns

Still a few comments to address 👍

mminns avatar Jun 22 '22 21:06 mminns

Well that was a useful way to fill 2 hours of airport hell :)

I believe I've addressed the key comments, let me know if there are any other issues.

I'm dogfooding it as well.

Thanks

mminns avatar Jun 24 '22 17:06 mminns

Thanks for the quick response.

My dogfooding will be a bit thinner than planned, I'm off with Covid for the next few days :(

mminns avatar Jun 27 '22 20:06 mminns

Ah build failures. Everything tests OK on my mac and the error looks systematic, but I'm afraid I can't re-run CI checks.

mminns avatar Jun 27 '22 20:06 mminns

I slightly cheated to re-trigger the CI, I rebased all of the commit messages to give them a meaningful first line.

Fingers crossed CI completes this time :)

mminns avatar Jun 28 '22 10:06 mminns

I slightly cheated to re-trigger the CI, I rebased all of the commit messages to give them a meaningful first line.

That's exactly what I would have done 😊.

ldennington avatar Jun 28 '22 17:06 ldennington

FYI I think there is a bug after all the refactoring.

I'm just investigating

mminns avatar Jul 06 '22 10:07 mminns

FYI I think there is a bug after all the refactoring.

I'm just investigating

This should be fixed now, my dogfooding is working now.

mminns avatar Jul 07 '22 16:07 mminns

Hi just checking in to see if there is any timeline for merging this PR? Cheers 👍

mminns avatar Oct 05 '22 12:10 mminns

Just a few comments on the OAuth2Client ctor and some broken links in the doc updates; but looks good other than that!

+1! We'll plan to go ahead and merge after the links are fixed up.

ldennington avatar Oct 06 '22 01:10 ldennington

Thanks for the feedback. I'll address those issues for the start of next week. 👍

mminns avatar Oct 06 '22 06:10 mminns

🤞

😄

mminns avatar Oct 06 '22 21:10 mminns

Awesome, thank you.

I started messing around with this in 2018 and started looking at it in Git Credential Manager for Windows in 2019 https://github.com/microsoft/Git-Credential-Manager-for-Windows/issues/837 https://github.com/mminns/Git-Credential-Manager-for-Windows/tree/mminns/issue-837-Bitbucket-Server-Support

So it's brilliant to finally get it done.

Thanks for all your help, @ldennington , @mjcheetham 👏

🙇

mminns avatar Oct 10 '22 20:10 mminns

Good

Favourjacobmudiaga avatar Dec 08 '22 07:12 Favourjacobmudiaga

Good

Favourjacobmudiaga avatar Dec 08 '22 07:12 Favourjacobmudiaga