-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: add sso enforcement for invite signup #25808
Merged
Merged
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
09eb327
Add sso enforcement for invite signup
zlwaterfield dc04f25
Update InviteSignup.tsx
zlwaterfield 08ea827
Update UI snapshots for `chromium` (1)
github-actions[bot] 8c9f853
Update UI snapshots for `chromium` (2)
github-actions[bot] 39b1b4f
Update UI snapshots for `chromium` (1)
github-actions[bot] 0b1ee25
Update UI snapshots for `chromium` (1)
github-actions[bot] 4e2ada6
Update UI snapshots for `chromium` (1)
github-actions[bot] 416a18f
Update UI snapshots for `chromium` (1)
github-actions[bot] 98909d5
Add signup validation for sso enforcement
zlwaterfield b22f8d6
Update InviteSignup.stories.tsx
zlwaterfield c10b9ff
LINT
zlwaterfield 037054a
Update UI snapshots for `chromium` (1)
github-actions[bot] 223103d
Update query snapshots
github-actions[bot] 8d87b2d
Update query snapshots
github-actions[bot] 885ddaf
Update UI snapshots for `chromium` (2)
github-actions[bot] 1c48106
LINT
zlwaterfield ef28610
remove test
zlwaterfield 372cae7
Update query snapshots
github-actions[bot] 35f9a7a
Update UI snapshots for `chromium` (1)
github-actions[bot] bdf4076
Update query snapshots
github-actions[bot] edb0408
Update UI snapshots for `chromium` (1)
github-actions[bot] b1a6a13
Improve the logic for SSO auth buttons
zlwaterfield 654c527
Update Login.tsx
zlwaterfield cb3cb55
Update Login.tsx
zlwaterfield ba6ad87
Update UI snapshots for `chromium` (1)
github-actions[bot] edccf27
Merge branch 'master' into zach/add-sso-enforcement-invite-signup
zlwaterfield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
+46 Bytes
(100%)
frontend/__snapshots__/exporter-exporter--trends-line-insight-detailed--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+41 Bytes
(100%)
frontend/__snapshots__/exporter-exporter--trends-line-insight-detailed--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.67 KB
(120%)
frontend/__snapshots__/exporter-exporter--trends-line-insight-legend--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.68 KB
(120%)
frontend/__snapshots__/exporter-exporter--trends-line-insight-legend--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+258 Bytes
(100%)
frontend/__snapshots__/scenes-other-invitesignup--cloud--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-908 Bytes
(99%)
frontend/__snapshots__/scenes-other-invitesignup--cloud--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+191 Bytes
(100%)
frontend/__snapshots__/scenes-other-invitesignup--cloud-eu--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-636 Bytes
(99%)
frontend/__snapshots__/scenes-other-invitesignup--cloud-eu--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+233 Bytes
(100%)
frontend/__snapshots__/scenes-other-invitesignup--self-hosted--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+268 Bytes
(100%)
frontend/__snapshots__/scenes-other-invitesignup--self-hosted--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+98 KB
frontend/__snapshots__/scenes-other-invitesignup--sso-enforced-google--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+114 KB
frontend/__snapshots__/scenes-other-invitesignup--sso-enforced-google--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+97.4 KB
frontend/__snapshots__/scenes-other-invitesignup--sso-enforced-saml--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+115 KB
frontend/__snapshots__/scenes-other-invitesignup--sso-enforced-saml--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1558,6 +1558,46 @@ def test_cant_claim_expired_invite(self): | |
self.assertEqual(Team.objects.count(), team_count) | ||
self.assertEqual(Organization.objects.count(), org_count) | ||
|
||
def test_api_signup_with_sso_enforced_fails(self): | ||
"""Test that users cannot sign up with email/password when SSO is enforced.""" | ||
|
||
organization = Organization.objects.create(name="Test Org") | ||
organization.available_product_features = [ | ||
{"key": AvailableFeature.SSO_ENFORCEMENT, "name": AvailableFeature.SSO_ENFORCEMENT}, | ||
{"key": AvailableFeature.SAML, "name": AvailableFeature.SAML}, | ||
] | ||
organization.save() | ||
OrganizationDomain.objects.create( | ||
domain="posthog_sss_test.com", organization=organization, sso_enforcement="saml", verified_at=timezone.now() | ||
) | ||
|
||
invite: OrganizationInvite = OrganizationInvite.objects.create( | ||
target_email="test+sso@posthog_sss_test.com", organization=organization | ||
) | ||
|
||
response = self.client.post( | ||
f"/api/signup/{invite.id}/", | ||
{ | ||
"first_name": "Alice", | ||
"password": VALID_TEST_PASSWORD, | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual( | ||
response.json(), | ||
{ | ||
"type": "validation_error", | ||
"code": "sso_enforced", | ||
"detail": "Sign up with a password is disabled because SSO login is enforced for this domain. Please log in with your SSO credentials.", | ||
"attr": None, | ||
}, | ||
) | ||
|
||
# Verify no user was created and invite was not used | ||
self.assertFalse(User.objects.filter(email="[email protected]").exists()) | ||
self.assertFalse(OrganizationInvite.objects.filter(target_email="[email protected]").exists()) | ||
|
||
# Social signup (use invite) | ||
|
||
def test_api_social_invite_sign_up(self): | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these conditionals correct? If the response status is pending do we want to show the "continue" button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will test a few things and confirm / improve.