Skip to content

chore(scim): mount the SCIM router in the main route tree - #2658

Merged
xlgmokha merged 2 commits into
masterfrom
xlgmokha/auth-1362b
Aug 4, 2026
Merged

chore(scim): mount the SCIM router in the main route tree#2658
xlgmokha merged 2 commits into
masterfrom
xlgmokha/auth-1362b

Conversation

@xlgmokha

@xlgmokha xlgmokha commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Moves the SCIM routes into the main route tree and hands the feature-flag check to the API layer, so the SCIM package stops carrying that concern.

Extracted from #2643.

What is the current behavior?

/scim/v2 is mounted at the top level of the router, outside the r.Route("/") block, so it does not run isValidExternalHost the way the rest of the API does.

The feature flag is enforced by scim.Server.Middleware, which means the SCIM package has to know about Experimental.ScimEnabled and depend on apierrors.

What is the new behavior?

  • The routes move into the r.Route("/") subtree, so they run isValidExternalHost alongside every other endpoint.
  • (*API).requireScimServerEnabled replaces scim.Server.Middleware, following the existing requireOAuthServerEnabled, requirePasskeyEnabled, and requireCustomOAuthEnabled.

The three endpoints still return 501. With the flag off they still return the same 404, which the test now pins on the body rather than the status code alone:

{
  "code": 404,
  "error_code": "feature_disabled",
  "msg": "SCIM server is disabled"
}

Additional context

@xlgmokha xlgmokha self-assigned this Jul 30, 2026
@xlgmokha
xlgmokha changed the base branch from master to xlgmokha/auth-1362a July 30, 2026 21:34
@xlgmokha
xlgmokha marked this pull request as ready for review July 30, 2026 21:37
@xlgmokha
xlgmokha requested a review from a team as a code owner July 30, 2026 21:37
@xlgmokha
xlgmokha force-pushed the xlgmokha/auth-1362b branch from 52eee62 to 8a28f88 Compare August 4, 2026 16:18
Base automatically changed from xlgmokha/auth-1362a to master August 4, 2026 16:19
Move the `/scim/v2` routes from the top level into the `r.Route("/")`
subtree so they pick up isValidExternalHost along with the rest of
the API.
@xlgmokha
xlgmokha force-pushed the xlgmokha/auth-1362b branch from f1a6d3c to 6ea716d Compare August 4, 2026 16:43

@annabkr annabkr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

@xlgmokha
xlgmokha merged commit 928aa01 into master Aug 4, 2026
12 checks passed
@xlgmokha
xlgmokha deleted the xlgmokha/auth-1362b branch August 4, 2026 17:19

@cstockton cstockton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one has been approved but I did prefer the previous SendJSONAs - Helpers like this often end up simply duplicating the API's the libraries they wrap overtime.

Not blocking this or anything, am okay with the shared/json.go file but we should include tests for it if we think keeping it is valuable.

xlgmokha commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

I added tests for this in https://github.com/supabase/auth/pull/2672/files#diff-73c59f4aa706921ea09d2aabd60a0987e451274119ea06d325f6142a1193b66cR12 but I can revert back to my original implementation of SendJSONAs if you prefer.

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