feat(scim): serve the User ResourceType and Schema - #2672
Draft
xlgmokha wants to merge 3 commits into
Draft
Conversation
The RFC 7644 message URIs share the urn:ietf:params:scim:api:messages:2.0 namespace, so declare it once and derive Error, ListResponse and the Bulk, PatchOp and SearchRequest URIs the upcoming endpoints will need. scimType becomes a named type carrying the ten detail error keywords of RFC 7644, Table 9. Nothing produces one yet -- filtering is the first real producer -- but NewError no longer takes a bare string for it.
The schema this server advertises named five attributes while the mapper populated two. Close the gap: name is mapped best effort from user metadata, preferring the SCIM spelling over the snake_case fallback, and active is derived from the ban state. externalId is carried on the resource but stays empty until something writes it. active is serialized unconditionally. Omitting it on false would report a deactivated user as unknown, which a provisioning client reads as "still provisioned". Along the way core gains the vocabulary the resources are built from: the schema URIs composed from one namespace, named types for the RFC 7643 keywords so a Mutability cannot be assigned where a Returned belongs, and NewMeta so the location layout is stated once rather than per resource.
Adds GET /scim/v2/ResourceTypes/{id} and
GET /scim/v2/Schemas/{id}, and fills the list endpoints that until now
answered with an empty ListResponse. A conformant client discovers before
it fetches, so /Users was unreachable in practice without these.
The published User schema advertises userName, name, emails, active and
externalId. externalId is a deviation: RFC 7643 defines it as a common
attribute in Section 3.1 rather than a User attribute, so the spec's own
User schema omits it, but provisioning clients map it.
The ResourceType is built from the Schema rather than from its URI, which
is what makes Section 6's "schema MUST be equal to the id attribute of the
associated Schema resource" hold by construction.
https://linear.app/supabase/issue/AUTH-1369/scim-user-resourcetype-and-schema-reflection-endpoints
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.
What kind of change does this PR introduce?
Feature. Adds
GET /scim/v2/ResourceTypes/{id}andGET /scim/v2/Schemas/{id}.https://linear.app/supabase/issue/AUTH-1369/scim-user-resourcetype-and-schema-reflection-endpoints
What is the current behavior?
/ResourceTypesand/Schemasreturn an emptyListResponseand have no by-id route, so nothing on this server describes the User resource.A conformant client discovers before it fetches, which makes
/Users/{id}unreachable in practice.The User resource itself publishes
userNameandemails.What is the new behavior?
GET /ResourceTypes200+ListResponsewith oneResourceTypeGET /ResourceTypes/User200+ theResourceTypeGET /Schemas200+ListResponsewith oneSchemaGET /Schemas/urn:ietf:params:scim:schemas:core:2.0:User200+ theSchemaAdditional context