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

Issue 329 force bitbucket oauth #401

Merged
merged 6 commits into from
Aug 26, 2021

Conversation

mminns
Copy link
Contributor

@mminns mminns commented Jul 20, 2021

The following options allow a user to force the GCMC to use Basic Auth and/or OAuth for interactions with bitbucket.org

By default a combination of Basic Auth and OAuth is used.

See the revised docs in this PR on how to configure.

Expected Behaviour

Assuming there are no existing stored credentials and the git 'host' is identified as bitbucket.org then

AuthModes = "" or AuthModes = "basic, oauth"

  • using Basic Auth a username/password is requested and used to retrieve the user profile
    • if this works the username/password are passed back to git.
    • if this fails with a 403 response, this indicates 2FA is on and OAuth is required
      • The user is prompted to run the OAuth flow
        • If this is successful the access_token is passed back to git

AuthModes = "basic"

  • using Basic Auth a username/password is requested and used to retrieve the user profile
    • if this works the username/password are passed back to git.
  • the OAuth flow is never triggered

AuthModes = "oauth"

  • The Basic Auth step is skipped
  • The user is prompted to run the OAuth flow
    - If this is successful the access_token is passed back to git

Testing

  1. checkout the branch
  2. build it
  3. dotnet build -c MacDebug or dotnet build -c WindowsDebug
  4. find and run the installer in out\osx\Installer.Mac\pkg\Debug or out\windows\Installer.Windows\bin\Debug
  5. configure your git environment as shown in the updated Environment.md or Configuration.md

TBC testing against bitbucket server instances.

@mminns mminns mentioned this pull request Jul 20, 2021
9 tasks
@mminns mminns force-pushed the ISSUE-329-force-bitbucket-oauth branch from 7e579ef to da8f488 Compare July 27, 2021 19:46
@mminns mminns force-pushed the ISSUE-329-force-bitbucket-oauth branch from da8f488 to 59bd8fc Compare July 27, 2021 20:05
@mminns mminns marked this pull request as ready for review August 3, 2021 19:37
@mminns
Copy link
Contributor Author

mminns commented Aug 3, 2021

My local test all seems to work OK.

Very happy if anyone else tests it out too.

@mjcheetham mjcheetham self-requested a review August 10, 2021 10:51
Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

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

Thanks for the effort here! I have a few asks to rename some methods and extract some of the GetCreds* to a new BitbucketAuthentication class.

@mminns
Copy link
Contributor Author

mminns commented Aug 10, 2021

No problem. Thanks for the feedback I'll address it in the next few days.

Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks @mminns :)

@mjcheetham mjcheetham merged commit ff373bc into git-ecosystem:main Aug 26, 2021
@mminns
Copy link
Contributor Author

mminns commented Aug 26, 2021

Thanks 👍

Benny8314 added a commit to Benny8314/Git-Credential-Manager-Core that referenced this pull request Aug 26, 2021
commit ff373bc
Merge: 119e264 5a8fe3c
Author: Matthew John Cheetham <[email protected]>
Date:   Thu Aug 26 10:57:27 2021 +0100

    Merge pull request git-ecosystem#401 from mminns/ISSUE-329-force-bitbucket-oauth

    Allow a user to force the GCMC to use Basic Auth and/or OAuth for interactions with bitbucket.org.
    Issue git-ecosystem#329

commit 5a8fe3c
Author: Mike Minns <[email protected]>
Date:   Thu Aug 26 09:58:25 2021 +0100

    ISSUE 329 address PR comments by simplifying the use of ThrowIfUserInteractionDisabled()

commit c75eb39
Author: Mike Minns <[email protected]>
Date:   Thu Aug 12 11:14:18 2021 +0100

    ISSUE 329 address PR comments with minor updates

commit 59bd8fc
Author: Mike Minns <[email protected]>
Date:   Tue Jul 27 20:39:45 2021 +0100

    ISSUE 329 Ignore auth overrides when calling Bitbucket DC

commit 737f926
Author: Mike Minns <[email protected]>
Date:   Tue Jul 20 20:09:37 2021 +0100

    ISSUE-329 Document the addition of Bitbucket AuthModes

commit 5a2cfd7
Author: Mike Minns <[email protected]>
Date:   Mon Jul 12 15:54:13 2021 +0100

    ISSUE-329 Add configuration option to force Basic Auth or OAuth for Bitbucket

commit a8cc5dd
Author: Mike Minns <[email protected]>
Date:   Fri Jul 2 17:16:25 2021 +0100

    ISSUE-329 Add tests before refactoring and extending provider code.
@mjcheetham mjcheetham mentioned this pull request Oct 8, 2021
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.

3 participants