For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /specs/scim/test-cases.md.

SCIM Test Cases

This page contains the tests that are done by Edupass for SCIM onboarding.
It should cover:

  1. What resources are created during the test
  2. What is being tested in the test
  3. What is expected from each request in the test

Overview

The suite runs two groups of tests against the RP's SCIM base URL:

  1. JWT Authentication – the RP correctly rejects invalid/missing tokens.
  2. SCIM Operations – the RP correctly implements User and Group CRUD, membership (including full replace), concurrency, error handling, and SCIM discovery endpoints (ResourceTypes, ServiceProviderConfig).

Every request is authenticated with a signed Edupass JWT (issuer = the configured Edupass issuer, audience = the RP's appCode, TTL 900s), except the authentication tests which deliberately send missing/invalid tokens.

Group and Group-membership tests only run if the RP exposes the Group schema at GET /Schemas.


Resources created during the test

All test resources use fixed identifiers so they are recognisable in RP logs. Every resource is deleted before the run finishes (nothing should persist if the run completes). The suite also pre-cleans these identifiers before it starts, so a previous interrupted run cannot block the next one.

ResourceIdentifier / externalIdnamePurpose
Test user 1999900000001Test User 001Create / Update / Patch / Add group membership / Remove group membership / Delete
Test user 2999900000002Test User 002Create / Update / Add group membership / Delete
Concurrent-duplicate user999900000099Test User 001Concurrency test; deleted immediately
Test group 1X_<APPCODE>_TEST1X_<APPCODE>_TEST1Create / Update group membership / Delete
Test group 2X_<APPCODE>_TEST2X_<APPCODE>_TEST2Create / Replace group membership / Delete
Concurrent-duplicate groupX_<APPCODE>_DUPX_<APPCODE>_DUPConcurrency test; deleted immediately

<APPCODE> is the RP's app code (e.g. RBS).

Request payloads

The exact request bodies sent when creating each resource. Which optional fields appear depends on what the RP advertises at GET /Schemas – fields the RP does not declare are omitted. The bodies below show the full schema variant (core User schema plus the Edupass User extension).

User 1 – POST /Users

{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User",
    "urn:ietf:params:scim:schemas:extension:Edupass:2.0:User"
  ],
  "userName": "999900000001",
  "externalId": "999900000001",
  "name": { "formatted": "Test User 001" },
  "title": "Test Title",
  "emails": [
    { "primary": true, "type": "WOG", "value": "test001@test.gov.sg" }
  ],
  "urn:ietf:params:scim:schemas:extension:Edupass:2.0:User": {
    "identitySource": "HRPS",
    "identityType": "Staff",
    "uinFin": null,
    "schoolOrHq": "School"
  }
}

User 2 – POST /Users

{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User",
    "urn:ietf:params:scim:schemas:extension:Edupass:2.0:User"
  ],
  "userName": "999900000002",
  "externalId": "999900000002",
  "name": { "formatted": "Test User 002" },
  "title": "Test Title",
  "emails": [
    { "primary": true, "type": "WOG", "value": "test002@test.gov.sg" }
  ],
  "urn:ietf:params:scim:schemas:extension:Edupass:2.0:User": {
    "identitySource": "MIMS",
    "identityType": "Staff",
    "uinFin": null,
    "schoolOrHq": "School"
  }
}

The concurrent-duplicate user (999900000099) uses an identical body to User 1 with userName / externalId set to 999900000099.

Group – POST /Groups

{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
  "externalId": "X_<APPCODE>_TEST1",
  "displayName": "X_<APPCODE>_TEST1"
}

1. JWT Authentication tests

Each test calls GET /Users with a different token. All are expected to return HTTP 401.

#Test caseRequestExpected
1No auth tokenGET /Users with no Authorization header401
2Unsigned JWTGET /Users with a token using alg: none and an empty signature401
3Expired tokenGET /Users with a correctly-signed token whose exp is in the past401
4Invalid issuerGET /Users with a signed token whose iss is not the Edupass issuer401
5Invalid audienceGET /Users with a signed token whose aud is not the RP's appCode401

2. SCIM Operation tests

Tests are run in the order below. All tests are run if possible.

Setup

  • GET /Schemas – read advertised schemas; determines whether Group tests run.
  • GET /ResourceTypes – read the resource types the RP advertises; expect User present (and Group if the Group schema is exposed).
  • GET /ServiceProviderConfig – read the RP’s service provider configuration; expect patch.supported == true.
  • Pre-clean – for each fixed identifier, GET by userName/displayName and DELETE any match left over from a prior run.

Test 1a – Concurrent duplicate user

  • Two simultaneous POST /Users for user 999900000099 (identical body).
  • Expected: exactly one succeeds (2xx) and one returns 409 Conflict. Not both success (duplicate accepted); not both failed.
  • Cleanup: DELETE /Users/{id} for whichever succeeded.
Info

This tests whether the RP’s server is safe under concurrent / duplicate requests, which may occur in the event of network retries or issues.

Test 1 – Create User

  • POST /Users for 999900000001 → expect 2xx.
  • POST /Users for 999900000002 → expect 2xx.
  • GET /Users?filter=userName eq "999900000001" → expect exactly 1 result with matching externalId.
  • Same GET for 999900000002.

Test 2 – Update User

  • PUT /Users/{user1Id} setting the full name to "Test User 001 Updated" → expect 2xx.
  • GET /Users/{user1Id} → expect name.formatted == "Test User 001 Updated".
Info

This is not run if the user was not found by GET /Users?filter=userName eq "999900000001" above.

Test 2a – Patch User

  • PATCH /Users/{user1Id} with op: replace, path: name.formatted, value "Test User 001 Patched" → expect 2xx/204.
  • GET /Users/{user1Id} → expect name.formatted == "Test User 001 Patched".

Test 2b – Get non-existent User

  • GET /Users/non-existent-user-id → expect 404.

Test 2c – Update non-existent User

  • PUT /Users/non-existent-user-id → expect 404.

The following group tests only run if the RP exposes the Group schema:

Test 3a – Concurrent duplicate group

  • Two simultaneous POST /Groups for X_<APPCODE>_DUP.
  • Expected: exactly one 2xx and one 409. Cleanup: delete the winner.

Test 3 – Create Group

  • POST /Groups for X_<APPCODE>_TEST1 and X_<APPCODE>_TEST2 → expect 2xx each.
  • GET /Groups?filter=displayName eq "..." for each → expect exactly 1 result with matching externalId.

Test 3b – Get non-existent Group

  • GET /Groups/non-existent-group-id → expect 404.

Test 3c – Update memberships for non-existent Group

  • PATCH /Groups/non-existent-group-id (add member) → expect 404.

Test 4 – Add Group membership

  • PATCH /Groups/{group1Id} with op: add, path: members, adding both users → expect 2xx.
  • Verified bidirectionally via GET on each user and the group:
    • Each user's groups array contains group1Id.
    • The group's members array contains both user1Id and user2Id.

Test 5 – Remove Group membership

  • PATCH /Groups/{group1Id} with op: remove, path: members[value eq "{user1Id}"] (remove user 1 only) → expect 2xx.
  • Expected: user 1 no longer in group and no longer in members; user 2 still in group and still in members (removing one member must not drop the other).
  • Then PATCH remove user 2 → expect 2xx (cleanup).

Test 5a – Replace Group membership (full replace)

  • PATCH /Groups/{group2Id} with op: replace, path: members, setting the full member list to [user1Id, user2Id] in one call → expect 2xx/204.
  • Expected: GET /Groups/{group2Id} shows exactly user 1 and user 2 as members (group 2 had no members beforehand – this is a full replace, not an incremental add).
  • PATCH /Groups/{group2Id} with op: replace, path: members, value [] → expect 2xx/204.
  • Expected: GET /Groups/{group2Id} shows an empty members list – confirms a replace can clear membership.

Test 6 – Delete Group

  • DELETE /Groups/{group1Id} → expect 2xx.
  • GET /Groups → expect group 1 absent, group 2 still present.
  • DELETE /Groups/{group2Id} → expect 2xx.

Test 7 – Delete User (Runs at the end)

  • DELETE /Users/{user1Id} → expect 2xx.
  • GET /Users → expect user 1 absent, user 2 still present.
  • DELETE /Users/{user2Id} → expect 2xx.