Skip to content

feat(scim): Add configurable core attribute inclusion for SCIM user responses - #4954

Open
ravindu439 wants to merge 4 commits into
thunder-id:feature/scim-supportfrom
ravindu439:SCIM-response-improvements
Open

feat(scim): Add configurable core attribute inclusion for SCIM user responses#4954
ravindu439 wants to merge 4 commits into
thunder-id:feature/scim-supportfrom
ravindu439:SCIM-response-improvements

Conversation

@ravindu439

Copy link
Copy Markdown
Contributor

Purpose

SCIM user responses always included mapped core schema fields (userName, emails, name, etc.), even for requests that only used a custom extension schema. This mixed core attribute noise into responses that had no core attributes in the request payload.

Approach

  • buildSCIMUserResource now takes an includeCoreAttrs flag; core attrs are only mapped onto the response when true.
  • Write operations (CreateUser, ReplaceUser) derive the flag from whether the request payload itself carried core attributes (len(payload.CoreAttrs) > 0), so the response mirrors what was sent.
  • Read operations (ListUsers, GetUser) derive the flag from a new scimconfig.ReturnMappedCoreAttrsOnGet var, since there's no request payload to inspect. Currently defaults to false; intended to become request/deployment-configurable once a frontend toggle exists.

Related Issues

  • N/A

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided.
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

…rtise pagination support

Allow POST /Users to omit the ThunderID extension schema URN when the
request carries only core SCIM attributes. CreateUser then defaults to
the sole configured user type via resolveDefaultEntityTypeName, erroring
if zero or more than one type is configured. ReplaceUser (and Me PUT)
still require the extension URN explicitly; no fallback on update.

Also advertise the RFC 9865 pagination attribute on
GET /ServiceProviderConfig: index-based pagination supported, cursor
based pagination not implemented.
Split the generic handler.go/service.go into discovery_handler.go and
discovery_service.go, and rename group_*.go to groups_*.go to match the
existing users_*.go convention. Extract shared response/error handling
into response.go and filter parsing into scim_filter.go so all three
resource handlers use the same code paths instead of duplicating them.

Normalize license headers across the SCIM package and its integration
tests from the WSO2 Apache boilerplate to the ThunderID SPDX header.

Fix bugs found while doing the split:
- getCredentialKeys silently swallowed entity-type lookup failures and
  returned an empty credential set instead of surfacing an error
- filter parse errors on GET /Users and POST /Users/.search bypassed
  the SCIM error/i18n pipeline with a hardcoded, untranslated response
- unsupported SCIM route stubs were registered without CORS middleware
- /Me GET and PUT ignored the attributes/excludedAttributes query
  parameters and always returned the full resource

Rename scimService/scimHandler to scimDiscoveryService/scimDiscoveryHandler
to match the discovery_*.go file names, and drop the unused userService
dependency from the discovery service, since only scimUsersService needs it.

Regenerate api/scim.yaml to reflect the above.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dd65195-5d32-4c70-bb55-050ecb93be4a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ravindu439
ravindu439 force-pushed the SCIM-response-improvements branch from cb71659 to d7421f2 Compare August 14, 2026 05:44
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.

1 participant