Add Bitbucket Cloud as an auth provider#46309
Conversation
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 24b5c73 and 57f3ed1 or learn more. Open explanation
|
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 57f3ed1...24b5c73.
|
| // If allowSignup is true, we will create an account using the first verified | ||
| // email address from Bitbucket which we expect to be their primary address. Note | ||
| // that the order of attempts is important. If we manage to connect with an | ||
| // existing account we return early and don't attempt to create a new account. | ||
| if s.allowSignup { | ||
| attempts = append(attempts, attemptConfig{ | ||
| email: emails[0].Email, |
There was a problem hiding this comment.
I'm confused here. The comment says we try the first verified email address, but as far as I can see, we try with the first email address, which might or might not be verified.
Also, should we try with all verified email addresses instead of just the first one?
There was a problem hiding this comment.
+1 here. Why not use verifiedEmails?
There was a problem hiding this comment.
Yep that should be verifiedEmails[0].
I'm mimmicing the way we do the GitHub provider here, which only tries the first verified email. I'm guessing the logic is that, if the account does not exist, this should succeed.
Although I'm curious now how we handle the GitHub scenario if signup is restricted to certain addresses and the verified address that does not match the restriction is not the first address. Will have to check
| "default": "account,email,repository", | ||
| "enum": ["account", "email", "repository:read"] | ||
| }, | ||
| "allowSignup": { |
There was a problem hiding this comment.
We should think about how to filter users for signup, similar to how we allow filtering users who can signup via SAML or Github auth providers.
There was a problem hiding this comment.
Bitbucket has the concept of "Workspaces" which we could probably leverage for this. However, I do think I'd want to add that as a follow-up feature instead of adding more complexity here.
| // If allowSignup is true, we will create an account using the first verified | ||
| // email address from Bitbucket which we expect to be their primary address. Note | ||
| // that the order of attempts is important. If we manage to connect with an | ||
| // existing account we return early and don't attempt to create a new account. | ||
| if s.allowSignup { | ||
| attempts = append(attempts, attemptConfig{ | ||
| email: emails[0].Email, |
There was a problem hiding this comment.
+1 here. Why not use verifiedEmails?
239425f to
88f7b57
Compare
|
❌ Problem: the label |
0c9834e to
4a2747c
Compare
This PR adds Bitbucket Cloud as an Auth Provider option.
This allows users to sign into Sourcegraph using Bitbucket Cloud.
This is for sign-in and account creation only. It does not enable permissions syncing for Bitbucket Cloud.
Loom: https://www.loom.com/share/035a812559fb4e0b9629e74f9772b6b4
Test plan
Unit tests added, as well as a manual test (see Loom)