I'm using the SAML v2 Reconcile lambda to map roles from a ADFS-server:
function reconcile(user, registration, samlResponse) {
var roles = samlResponse.assertion.attributes['http://schemas.xmlsoap.org/claims/Group'] || [];
registration.roles = roles;
}
The code seems to works correctly when adding new roles. The user registration is assigned the roles correctly.
However when I remove roles in the AD it is not reflected in the user registration.
In the event log it does seem like the roles has been removed from the registration but when I view the user in the UI they remain the same.
8/26/2019 02:11:26 PM EEST Invoke configured lambda with Id [f9b358a9-63a2-4a28-b126-e70f9e0445f3]
8/26/2019 02:11:26 PM EEST User to reconcile:
{
"encryptionScheme" : null,
"factor" : null,
"id" : null,
"password" : null,
"passwordChangeRequired" : false,
"passwordLastUpdateInstant" : null,
"salt" : null,
"verified" : false,
"preferredLanguages" : [ ],
"memberships" : [ ],
"registrations" : [ {
"data" : { },
"preferredLanguages" : [ ],
"tokens" : { },
"applicationId" : "e6bc6d79-98b1-4a3b-8621-2a0a4dc9465c",
"authenticationToken" : null,
"cleanSpeakId" : null,
"id" : null,
"insertInstant" : null,
"lastLoginInstant" : null,
"roles" : [ ], <------------ roles are empty
"timezone" : null,
"username" : null,
"usernameStatus" : null,
"verified" : false
} ],
"active" : false,
"birthDate" : null,
"cleanSpeakId" : null,
"data" : { },
"email" : "johanad@xx",
"expiry" : null,
"firstName" : null,
"fullName" : null,
"imageUrl" : null,
"insertInstant" : null,
"lastLoginInstant" : null,
"lastName" : null,
"middleName" : null,
"mobilePhone" : null,
"parentEmail" : null,
"tenantId" : null,
"timezone" : null,
"twoFactorDelivery" : null,
"twoFactorEnabled" : false,
"twoFactorSecret" : null,
"username" : null,
"usernameStatus" : null
}
8/26/2019 02:11:26 PM EEST The user with the email address [johanad@xx] already exists.
8/26/2019 02:11:26 PM EEST Merge the reconciled user from the Identity Provider into the FusionAuth user.
8/26/2019 02:11:26 PM EEST User is already registered for application with Id [e6bc6d79-98b1-4a3b-8621-2a0a4dc9465c].
8/26/2019 02:11:26 PM EEST User has successfully been reconciled and logged into FusionAuth.