SCIM
Overview
Edupass will use the System for Cross-domain Identity Management (SCIM) 2.0 protocol to provide live user information updates to RPs that require it. Edupass will be the SCIM client, and RPs will be the SCIM Service Provider (or Server). RPs will need to implement the SCIM endpoints listed below, and expose them for access by Edupass.
Edupass identities which should have access to the RP application will be sent as SCIM User resources.
Application roles managed by Edupass will be encoded as SCIM Group resources.
Required SCIM Endpoints for All RPs
RPs will need to implement all the following endpoints:
- User Operations
- Create User: For RPs to be informed of new Edupass identities that should have access to the RP
- Update User: To update details for an existing identity. RPs should support both
PUTandPATCHupdates. - Delete User: To remove access for a specific identity. RPs may remove the User resource entirely or do a soft delete.
- Read Users
- Get all Users: Return a paginated list of all User resources within the RP. In addition, it should be possible to retrieve a User with a given
userName. - Get by ID: Return a specific user resource with the RP provided user identifier:
id
- Get all Users: Return a paginated list of all User resources within the RP. In addition, it should be possible to retrieve a User with a given
- SCIM discovery Endpoints
Required SCIM Endpoints for RPs with Roles Managed by Edupass
Additionally, RPs with roles managed by Edupass should implement all the Group operation endpoints below. This includes RPs who manage roles internally but have location-specific application access roles.
- Group Operations
- Create Group: To create a new Group, which is used to encode application roles.
- Update Group: To update Group details or membership. Will be used to update a user’s application permissions by adding the user to a Group representing a role. Only
PATCHupdates need to be supported. - Delete Group: To remove a specific Group
- Read Groups
- Get all Groups: Return a paginated list of all groups created within the RP. In addition, it should be possible to retrieve a Group with a given
displayName - Get by ID: Return a specific Group with the RP provided identifier:
id
- Get all Groups: Return a paginated list of all groups created within the RP. In addition, it should be possible to retrieve a Group with a given
Overview of SCIM Endpoint Invocation Workflow by Edupass
Provisioning Group for Application Role
Groups are created in Edupass based on application roles defined by the RP. For each location-scoped role, a Group will be created for the role in each applicable location. For example a Group will be created to encode the application role 1730_APP_admin, which is the application’s admin role at the school with location code 1730.
When MOE registers a new school or branch, Edupass automatically creates Groups for all application roles that are applicable to the school or branch.
RPs will be informed of new Groups created in Edupass for the RP via the following workflow:
- Create Group (POST /Groups)
Provisioning Access for New Identities
RPs will be informed of new Edupass identities and their application role assignments for the RP via the following workflow:
- Create User (POST /Users)
- Update Group Membership (PATCH /Groups/<RP group id> for each RP application role that the user is assigned)
Updating Profile for Existing Identities
RPs will be notified of changes to the attributes of Edupass identities which have access to the RP via the following workflow:
- Update User (PATCH /Users/<RP user id> or PUT /Users/<RP user id>)
Updating Access for Existing Identities
RPs will be notified of changes to application role assignments of Edupass identities known to the RP via the following workflow:
- Update Group Membership (PATCH /Groups/<RP group id>)
If an application role has been removed for a user, an Update Group Membership request will be sent to remove the user from the Group encoding the role.
If an application role has been assigned to a user, an Update Group Membership request will be sent to add the user to the Group encoding the role.
Removing Access for Existing Identities
RPs will be notified of Edupass identities whose access to the RP should be removed via the following workflow:
- Delete User (DELETE /Users/<RP user id>)
This happens when the person’s access to the RP has been completely removed through the Edupass access management portal.
Removing Group for Deprecated Application Role
Application roles will only be deprecated under 2 circumstances:
- The RP raises a request to remove the role
- MOE closes a school. The location-scoped roles for the closed school will eventually be removed.
Groups associated with deprecated application roles will be deleted. RPs will be informed of Groups to be removed via the following workflow:
- Delete Group (DELETE /Groups/<RP group id>)
SCIM Security Requirements
TLS Support Requirements
RPs must support TLS 1.2.
Securing SCIM Endpoints
Edupass will identify itself via a short-lived signed bearer token signed by Edupass, which is a JSON Web Token (JWT), in the request Authorization header. RPs will need to validate the token by doing the following:
- Verify that the signature is valid.
- Check that the following fields are valid
iss: Identifies the token issuer, this should match the value that Edupass uses to identify itself. This will be Edupass' API domain name- In the Edupass preprod environment: https://api.preprod.edupass.moe.gov.sg
- In the Edupass production environment: https://api.edupass.moe.gov.sg
aud: The RP’s application code in Edupassexp: Unix time for when the token expires. Check that the token is not expired yet
RPs hosted on AWS API Gateway or APEX, or RPs that require API keys, should refer to Authentication for Specific RP Hosting Setups.
Verifying Edupass JWT Signature
Edupass' signing public key will be published at the JSON Web Key Set (JWKS) endpoint listed below, which returns one or more public keys in JSON Web Key (JWK) format.
The key to be used for signature validation will have use: "sig" and a kid that matches the Edupass JWT being validated.
Edupass rotates its signing keys. When a rotation occurs, a new key with a different kid is added to the JWKS endpoint, and newly issued JWTs will reference this kid in their headers. RPs should refresh cached keys by re-fetching the JWKS endpoint whenever they encounter an unknown kid.
Sample Signed JWT
Encoded JWT
Format: <base64 url encoded JWT header>.<base64 url encoded JWT payload>.<base64 url encoded signature>
Decoded JWT Header and Payload
JWT Header
JWT Payload
iss values
Sample return from the JWKS endpoint
Understanding SCIM
SCIM Resources
Edupass represents identities as SCIM User resources, and application roles as SCIM Group resources.
In SCIM, User and Group are SCIM resources that can be created, modified, deleted and retrieved through REST API endpoints.
Each SCIM resource has the following common attributes:
meta sub-attributes
SCIM Endpoint Responses
If a request body is present, SCIM endpoints must return responses with media type application/scim+json, which are JSON objects with a schemas attribute – a list of IETF URNs under the namespace urn:ietf:params:scim.
Each URN identifies a schema that defines the structure of the attributes present in the JSON response.
Resource Endpoint Responses
Single Resource Response
The response will contain common attributes - id, externalId and meta, and attributes as defined by the schemas in the schemas attribute. By default, this should include all attributes with returned property set as always or default in the respective schemas returned by the Get All Schemas endpoint.
See the table below for the list of possible values for schemas.
List Response
All list responses will have the following attributes:
Error Responses
HTTP Error Status Codes
RPs should conform to the following HTTP status code convention for error returns.
HTTP Error Response Body
If present, the response body should have the following attributes:
scimType values
SCIM Resource Endpoints
User Operations
User Schema
name sub-attributes
emails sub-attributes
urn:ietf:params:scim:schemas:extension:Edupass:2.0:User sub-attributes
RPs can indicate which fields in the core user schema and Edupass User extension they require through their Get All Schemas endpoint.
Groups Attribute
For RPs with roles managed by Edupass, the groups attribute should be part of the SCIM Core User Schema with returned property set as default. Hence User operations (Create User, Update User - PUT, Get All Users, Get User By ID) should include the groups attribute for each User resource in the response.
Create User
RPs will be informed of new Edupass identities that should have access to the RP via this endpoint.
RPs should check that the given identity does not already exist within the RP’s active User resources. If there are conflicts, the RP should respond with HTTP status 409 with scimType error code uniqueness. Conflicts should not happen with deleted User resources.
Request
POST /Users
Request Body - All fields in the User Schema table supported by the RP, excluding id
Response
Status 201: User resource for Edupass identity is created
In addition to the attributes in the Request SCIM User object, RPs should return the id attribute with their identifier for the created user record.
For RPs with roles returned by Edupass, the groups attribute should be included.
Status 409: User resource for Edupass identity already exists
Update User - PUT
This should overwrite all attributes for the associated user resource with the values provided.
Request
PUT /Users/RPUser1
Request Body - All fields in the User Schema table supported by the RP, excluding id
Response
Status 200: User resource for Edupass identity updated
For RPs with roles returned by Edupass, the groups attribute should be included.
Update User - PATCH
A PATCH request to /Users/<id> is used to selectively update attributes of a User resource using “add”, “remove” or “replace” operations.
Patch Request Body Schema
Operations sub-attributes
Request
The following example updates the associated User resource’s title.
PATCH /Users/RPUser1
Request Body
Response
Status 200: User resource for Edupass identity updated
Returned user schema object should minimally contain the mandatory SCIM user fields and updated values of the User record
Delete User
Edupass identities that should be removed will be deleted via a DELETE request to /Users/<id>. RP should remove the associated user resource.
Request
DELETE /Users/RPUser1
Response
Status 204: User resource for Edupass identity deleted.
Get All Users
This should return a paginated list of User resources created from Edupass identities. Each request may include the following parameters for pagination:
Response Body Schema
Request
GET /Users
Response
Status 200: List of User Resources
Get User by userName
To allow Edupass to retrieve the id of a User resource that had already been created, RPs should implement the filter on userName to allow Edupass to retrieve a User resource by username.
Such queries will be sent as the filter query param in the form userName eq "value".
Request
GET /Users?filter=userName eq "000012345678"
Response
Return a ListResponse with Resources containing the SCIM User resource with the given userName. Resources will be an empty list if there are no matching resources.
Status 200: List containing matching User resource
Get User by ID
This should return the User resource with the given id. The format of the SCIM User resource should match those returned in Get all Users
Request
GET /Users/RPUser1
Response
Status 200: User resource for Edupass identity found
Group Operations
Group Schema
Members Attribute
The members attribute is a SCIM Core Group Schema attribute with returned property set as default. Hence, Group operations (Create Group, Get All Groups, Get Group By ID) that return SCIM Group resource(s), should include the members attribute for each Group resource in the response. However, as each Group can have many members, RPs should implement the excludedAttributes query parameter for GET operations, so that the query parameter excludedAttributes=members excludes the members attribute from the response.
Create Group
RPs will be notified via this endpoint when a new Group encoding an application role for the RP is created in Edupass.
Like for the Create User endpoint, the RP should check if a Group with the same displayName already exists. If it exists, it should return http 409 (Conflict) with scimType error code uniqueness.
Request
POST /Groups
Request Body - All fields in the Group Schema table, excluding id
Response
Status 201: Group created
In addition to the attributes in the Request SCIM Group object, RPs should return the id attribute with their identifier for the created Group
Status 409: Group already exists
Update Group Membership
Changes to a user’s assigned application role are applied through changes in Group membership. RPs are notified of the change through a HTTP PATCH request to the Update Group Membership endpoint for the relevant Group at /Groups/<Group id>. PATCH request body is the same as in Update User - Patch.
Users are added to a Group via a PATCH request with an add operation. This will add the associated application role to the user. This should succeed with a no-op if the application role has already been assigned to the user.
Users are removed from a Group via a PATCH request with a remove operation. This will remove the associated application role from the user. This should succeed with a no-op if the application role has already been removed from the user, or if the user never had the application role.
During a full Group membership sync, the list of users in a group may be updated via a PATCH request with a replace operation.
Each Update Group Membership request could contain operations to modify the Group membership status for multiple Users. Each request could contain add and remove operations for different Users for the same Group. Updates for multiple operations sent in the same PATCH request should be atomic, if a single operation encounters an error, the whole request should fail, and no updates in the request should be applied.
Request
PATCH /Groups/1001_admin
Request Body with add and remove operations
Request Body with replace operation
Response
Status 204: PATCH applied
Delete Group
The group associated with an application role that should be removed will be deleted via a DELETE request to /Groups/<id>. RPs should delete the associated Group resource.
RPs should remove the associated application role from all its users.
Request
DELETE /Groups/1001_admin
Response
Status 204: Group deleted
Get All Groups
This should return a paginated list of Groups. Pagination works the same way as in Get all Users, with optional query parameters startIndex and count.
Response Body Schema
Request
GET /Groups
Response
Status 200: List of Groups
Get Group by displayName
To allow Edupass to retrieve the id of a Group resource that had already been created, RPs should implement the filter on displayName to allow Edupass to retrieve a Group resource by displayName.
Such queries will be sent as the filter query param in the form displayName eq "value".
Request
GET /Groups?filter=displayName eq "1001_app1_admin"
Response
Return a ListResponse with Resources containing the SCIM Group resource with the given displayName. Resources will be an empty list if there are no matching resources.
Status 200: List containing matching Group resource
Get Group by ID
This should return the Group with the given id. The list of Users belonging to the group should be returned in the members attribute.
Request
GET /Groups/1001_admin
Status 200: Group with given id found
SCIM Discovery Endpoints
The SCIM protocol defines a set of endpoints to facilitate the discovery of SCIM features, resources and specific resource schema attributes supported by the RP.
Service Provider Configuration Endpoint
This returns the RP's configuration details for the implemented SCIM endpoints.
Service Provider Configuration Schema
patch sub-attributes
bulk sub-attributes
filter sub-attributes
sort sub-attributes
etag sub-attributes
authenticationSchemes sub-attributes
Request
GET /ServiceProviderConfig
Response
Status 200
Get All Schemas Endpoint
Returns a ListResponse with the list of SCIM resource schemas supported by the service provider. This should minimally include the core User schema (urn:ietf:params:scim:schemas:core:2.0:User). For RPs that support the Group resource, this must include the core Group schema (urn:ietf:params:scim:schemas:core:2.0:Group). RPs using Edupass’s User extension schema should also include the Edupass User extension and the set of attributes in the extension that they support.
Each Schema has the following attributes
attributes sub-attributes
Request
GET /Schemas
Response
Core User Schema
Note that the urn:ietf:params:scim:schemas:core:2.0:User schema should include the userName attribute
For RPs with roles managed by Edupass, urn:ietf:params:scim:schemas:core:2.0:User should also include the groups attribute with the returned property set to default. The groups attribute should be omitted for RPs without roles managed by Edupass.
Core Group Schema
For RPs with roles managed by Edupass, the urn:ietf:params:scim:schemas:core:2.0:Group schema should be present and include all attributes in the example below, namely displayName and members.
Status 200
Get All Resource Types Endpoint
Returns a ListResponse with the list of SCIM resources that the RP supports. RPs must minimally support the User resource.
Resource Type Schema
schemaExtensions sub-attributes
If an RP supports Edupass' user schema extension, this will be a list that includes the object
This can be an empty list if the RP does not require any user schema extensions.
Request
GET /ResourceTypes
Response
Status 200
Rate Limits
To avoid getting overloaded by too many concurrent requests, RPs should implement rate-limits on the Create, Update and Delete endpoints. A response with HTTP 429 should be returned to indicate that the rate-limit is reached.
RPs can indicate when Edupass can make a retry attempt using the Retry-After header.
Authentication for Specific RP Hosting Setups
The standard way to secure SCIM endpoints is described in Securing SCIM Endpoints. This section covers RPs whose hosting setup or credential requirements need something different.
RPs Hosted on AWS API Gateway
RPs that host their SCIM endpoints behind AWS API Gateway can use a built-in JWT authorizer to validate Edupass tokens, instead of writing their own validation code. This works for both API types:
- REST APIs (
aws apigateway) - HTTP APIs (
aws apigatewayv2)
The API Gateway must be able to reach the following Edupass endpoints:
For HTTP APIs (aws apigatewayv2), inform the Edupass team that the JWTs must be signed by RS384.
Setup: REST API / aws apigateway
The REST API authorizer has an explicit list of allowed signing algorithms, which must be set to ES256. Create a file jwt-config.json:
Then create the authorizer, attach it to the SCIM methods, and deploy:
For production, use https://api.edupass.moe.gov.sg as the issuer.
Do not set required scopes on the methods - Edupass tokens do not carry a scope claim.
Setup: HTTP API / aws apigatewayv2
For production, use Issuer=https://api.edupass.moe.gov.sg. Then attach the authorizer to the SCIM routes.
RPs Hosted on APEX
APEX is the WOG's central API management hub. RPs hosting their SCIM endpoints on APEX must use JWT authentication. Edupass does not support API keys as the authentication method for APEX-hosted endpoints.
The JWTs that Edupass sends to APEX-hosted endpoints meet APEX's JWT requirements and are signed with ES256.
Prerequisites
RPs must do the following before Edupass can call their APEX-hosted SCIM endpoints:
- Set up the APEX endpoint for JWT authentication, and register the Edupass JWKS endpoint (see Verifying Edupass JWT Signature) on it. Refer to the APEX documentation "Adding JWKS to application".
- Inform the Edupass team that the SCIM server is hosted on APEX, and provide the APEX API key for their application.
Request Handling and Testing
Edupass will send the x-apex-jwt in the Authorization header, which will be validated by APEX before it reaches the SCIM server.
As APEX requires unique JWTs on each request, the Edupass SCIM Postman collection will not be usable as it uses a long-lived JWT and APEX will reject the JWTs. RPs should test their SCIM servers on a setup that is not on APEX.
Edupass will still perform functional tests on servers hosted in APEX.
RPs Requiring API Keys or Long-Lived Tokens
Edupass SCIM does not support API keys or long-lived tokens. Every request carries a short-lived JWT signed by Edupass.
Workaround: RP-Operated Verification Middleware
RPs whose SCIM server can only authenticate with an API key or long-lived token can run a small middleware / service in front of it. This should:
- Receive the SCIM request from Edupass with
Authorization: Bearer <JWT>. - Fetch and cache the Edupass JWKS from
/.well-known/keys, and re-fetch it whenever it sees an unknownkid. - Verify the signature,
iss,audandexp, following the same rules as Securing SCIM Endpoints. - If the token is valid, forward the request to the RP's SCIM server using the RP's own API key or token, and relay the response unchanged.
- If the token is invalid, return
401.
The RP owns and operates this middleware, so no exchange of long-lived credentials is needed between Edupass and the RP.