0

我正在使用 SAML v2 Reconcile lambda 从 ADFS 服务器映射角色:

function reconcile(user, registration, samlResponse) {
  var roles = samlResponse.assertion.attributes['http://schemas.xmlsoap.org/claims/Group'] || [];

  registration.roles = roles;
}

添加新角色时,代码似乎可以正常工作。用户注册被正确分配了角色。

但是,当我删除 AD 中的角色时,它不会反映在用户注册中。

在事件日志中,角色似乎已从注册中删除,但是当我在 UI 中查看用户时,它们保持不变。

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.
4

1 回答 1

1

这是外部 IdP 处理的当前行为。FusionAuth 不知道外部 IdP 是否正在处理角色,因此它当前保留 FusionAuth 数据库中的角色并忽略通过 Lambda 设置的角色。这仅在用户已经存在时发生。对于新用户,可以在 Lambda 中设置角色。

我认为造成这种情况的根本原因是某些 IdP 不提供角色,需要在 FusionAuth 中对其进行完全管理。其他 IdP 将提供角色,并且可以在 Lambda 中映射它们。看起来当我们添加 Lambdas 时,我们没有添加指定身份提供者是否会提供角色的功能。

解决这个问题的方法是 FusionAuth 在身份提供者上有一个新标志,指示 IdP 是否将解析和管理角色。

如果您想在我们的 GitHub 问题跟踪器上打开功能请求,我们可能会在路线图上为您提供此功能。如果您需要快速为您构建此功能,您还可以联系专业服务。

于 2019-08-26T16:26:32.360 回答