SCIM Group Response Converter Lambda
On this page
A SCIMAn open standard defining an HTTP REST protocol and schema for automating user and group provisioning across systems. Group Response Converter lambda converts a FusionAuth group into the SCIM Group response that FusionAuth returns to the SCIM client. FusionAuth runs the lambda after FusionAuth acts on the group.
When you create a lambda in the Admin UI, FusionAuth provides an empty function for you to implement.
Lambda Structure#
If you create the lambda with the API, the function must have the following signature:
function convert(scimGroup, group, members, context) {
// Lambda code goes here
}
The lambda must contain a function named convert that accepts the following parameters:
scimGroup: the SCIM response. You can modify this object.group: the FusionAuth group. This object is read-only.members: the memberships of the group. This array is read-only. Each membership has theuserIdof the member, the membershipdata, thegroupId, the membershipid, and theinsertInstant.context: Available since1.64.0the context of the request, including access to secrets. This object is read-only.
The Group API documents the FusionAuth group and the memberships. The scimGroup object holds the SCIM Group response JSON. See SCIM Group.
Before the lambda runs, FusionAuth fills in the following scimGroup fields:
id: the FusionAuth group Id.externalIdschemas: the Group schema.meta:created,lastModified,resourceType, andlocation, the URI of the group resource.members: one entry for each member, withvalue,display, and$ref. FusionAuth leaves out members whose user no longer exists.
FusionAuth doesn't set displayName, so the lambda must set displayName.
Assign the Lambda#
After you create the lambda, assign the lambda to a tenant on the SCIM tab of the tenant configuration.
Default Lambda#
FusionAuth provides a default SCIM Group Response Converter lambda. The default lambda sets the SCIM displayName to the FusionAuth group name.
function convert(scimGroup, group, members) {
// Un-comment this line to see the group object printed to the event log
// console.info(JSON.stringify(group, null, 2));
// Set the outgoing displayName on the SCIM group using the FusionAuth group name.
scimGroup.displayName = group.name;
}Example: Return the Original Display Name#
The role mapping example for the SCIM Group Request Converter adds a prefix to the group name. The following lambda returns the original name from group.data.scimDisplayName instead. For a group created in FusionAuth, the lambda falls back to the group name.
// returns the group name the SCIM client sent, without the prefix the request converter added
function convert(scimGroup, group, members, context) {
scimGroup.displayName = (group.data && group.data.scimDisplayName) || group.name;
}Related
Learn how to convert an incoming SCIM group request into a FusionAuth group with a lambda.
Learn how to convert a FusionAuth user into the SCIM user response a SCIM client expects.
Learn how to convert an incoming SCIM user request into a FusionAuth user with a lambda.
Learn how to configure Azure AD/Microsoft Entra ID as a SCIM client.