ref(auth): Extract reusable methods from SSO identity handler - #121013
Open
nora-shap wants to merge 2 commits into
Open
ref(auth): Extract reusable methods from SSO identity handler#121013nora-shap wants to merge 2 commits into
nora-shap wants to merge 2 commits into
Conversation
Member
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 935fd03. Configure here.
nora-shap
marked this pull request as ready for review
July 31, 2026 21:37
frifri
reviewed
Jul 31, 2026
|
|
||
| @control_silo_test | ||
| class HandleNewUserTest(AuthIdentityHandlerTest, HybridCloudTestMixin): | ||
| @mock.patch("sentry.analytics.record") |
frifri
reviewed
Jul 31, 2026
| def test_skip_confirm_emails_suppresses_email(self, mock_record: mock.MagicMock) -> None: | ||
| with mock.patch.object(User, "send_confirm_emails") as mock_send: | ||
| self.handler.handle_new_user(skip_confirm_emails=True) | ||
| mock_send.assert_not_called() |
Contributor
There was a problem hiding this comment.
Should we add the inverse too? Nothing currently asserts the email is sent when skip_confirm_emails=False, so a future default flip would go unnoticed.
frifri
reviewed
Jul 31, 2026
| If False: the identity requires our own verification step. | ||
| """ | ||
| return ( | ||
| provider_key in TRUSTED_EMAIL_VERIFIED_PROVIDERS and identity.get("email_verified") is True |
Contributor
There was a problem hiding this comment.
This might not be relevant but are you sure email_verified output a Boolean?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preparatory refactors for the upcoming SSO email verification at signup feature. No behavior changes.
is_email_verified_by_trusted_provider()utility toemail_verification.py— centralizes the trust check for Google/GitHubemail_verifiedclaims so bothsentryandgetsentrycan share itcomplete_and_login()fromhandle_unknown_identity()— the login + state cleanup tail is now callable independently (needed by the future verification view)skip_confirm_emailsparam tohandle_new_user()— allows skipping the advisory confirmation email when the address has already been verified_post_login_redirect()to accept an explicitis_new_userflag, falling back to the existingrequest.POSTcheck whenNone