-
Notifications
You must be signed in to change notification settings - Fork 3.7k
test(e2e): cover enterprise integrations #5868
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
Merged
BillLeoutsakosvl346
merged 14 commits into
e2e/settings-playwright
from
e2e/06b-enterprise-integrations
Jul 23, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7031d3f
test(e2e): cover enterprise integrations
2577ee0
fix(sso): preserve uniqueness during migration replay
0094304
fix settings e2e and sso route contracts
5481f44
serialize sso provider mutations
38dd541
close sso account link races
1a6a54c
normalize sso overlap comparisons
763b9eb
serialize sso domain verification
425be1a
allow sso cleanup after plan loss
66d0a96
refresh sso provider inside mutation lock
b116323
harden sso update and delete concurrency
7f52ea6
fix(sso): avoid long-held callback mutation locks
a499ecd
fix(sso): release mutation lock during DNS verification
50b1605
fix(sso): normalize audited domain overlaps
f4c52c4
fix(e2e): override auth endpoint rate limits
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
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
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
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
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
71 changes: 71 additions & 0 deletions
71
apps/sim/app/api/auth/sso/providers/[id]/domain-verification/request/route.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { withSSOProviderMutationLock } from '@sim/db' | ||
| import { createLogger } from '@sim/logger' | ||
| import { getErrorMessage } from '@sim/utils/errors' | ||
| import type { NextRequest } from 'next/server' | ||
| import { NextResponse } from 'next/server' | ||
| import { requestSsoDomainVerificationContract } from '@/lib/api/contracts/auth' | ||
| import { parseRequest } from '@/lib/api/server' | ||
| import { auth, getSession } from '@/lib/auth' | ||
| import { | ||
| collectAuthHeaders, | ||
| getDomainVerificationRecordName, | ||
| getDomainVerificationRecordValue, | ||
| getManagedSSOProvider, | ||
| ssoManagementErrorResponse, | ||
| } from '@/lib/auth/sso/management' | ||
| import { env, isTruthy } from '@/lib/core/config/env' | ||
| import { withRouteHandler } from '@/lib/core/utils/with-route-handler' | ||
|
|
||
| const logger = createLogger('SSODomainVerificationRequestRoute') | ||
|
|
||
| type RouteContext = { params: Promise<{ id: string }> } | ||
|
|
||
| export const POST = withRouteHandler(async (request: NextRequest, context: RouteContext) => { | ||
| try { | ||
| if (!env.SSO_ENABLED) { | ||
| return NextResponse.json({ error: 'SSO is not enabled' }, { status: 400 }) | ||
| } | ||
| if (!isTruthy(env.SSO_DOMAIN_VERIFICATION_ENABLED)) { | ||
| return NextResponse.json({ error: 'SSO domain verification is not enabled' }, { status: 404 }) | ||
| } | ||
| const session = await getSession() | ||
| if (!session?.user?.id) { | ||
| return NextResponse.json({ error: 'Authentication required' }, { status: 401 }) | ||
| } | ||
|
|
||
| const parsed = await parseRequest(requestSsoDomainVerificationContract, request, context) | ||
| if (!parsed.success) return parsed.response | ||
|
|
||
| const { provider, result } = await withSSOProviderMutationLock(async () => { | ||
| const provider = await getManagedSSOProvider(parsed.data.params.id, session.user.id, { | ||
| requireCreator: true, | ||
| }) | ||
| const result = await auth.api.requestDomainVerification({ | ||
| body: { providerId: provider.providerId }, | ||
| headers: collectAuthHeaders(request), | ||
| }) | ||
| return { provider, result } | ||
| }) | ||
|
|
||
| return NextResponse.json( | ||
| { | ||
| recordName: getDomainVerificationRecordName(provider.providerId, provider.domain), | ||
| recordValue: getDomainVerificationRecordValue( | ||
| provider.providerId, | ||
| result.domainVerificationToken | ||
| ), | ||
| }, | ||
| { status: 201 } | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| ) | ||
| } catch (error) { | ||
| const managedResponse = ssoManagementErrorResponse(error) | ||
| if (managedResponse) return managedResponse | ||
| logger.error('Failed to request SSO domain verification', { | ||
| error: getErrorMessage(error, 'Unknown error'), | ||
| }) | ||
| return NextResponse.json( | ||
| { error: 'Failed to request SSO domain verification' }, | ||
| { status: 500 } | ||
| ) | ||
| } | ||
| }) | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.