无法根据帐户的属性列向 ID 或访问令牌添加声明 table

unable to add claim to id or access token based on attributes column of accounts table

经过多次测试,我无法弄清楚如何根据 SCIM 2.0 格式为帐户 table.

中的属性列添加对 userinfo/id 令牌/访问令牌的声明

一步一步:

我试过 (return attributes.userType) 并且没有任何映射,但没办法... 唯一有效的测试是带有模拟的测试:return {userType: 'test'} 或 return 'test'.

属性查询 SELECT * FROM accounts WHERE username = :subject 似乎不允许使用属性列的子字段。 尽管它似乎在使用代码

进行身份验证的 https://curity.io/resources/learn/claims-from-authenticated-subject/ 主题属性中正常工作
function transform(attributes) {
  //Transform the attributes and return the appropriate value for the claim
     if(attributes.emails !== undefined 
        && attributes.emails.length > 0 
        && attributes.emails[0].value !== null) {
        //return {"email" : attributes.email};      
        return attributes.emails[0].value;
    }
  return null;
}

任何帮助将不胜感激指出我做错了什么

听起来你大部分都做对了,但还有一些细节需要调整。 首先,要使用属性查询,您不能使用 Account Manager claims provider,它使用帐户查询进行查找并且不可配置。相反,请使用数据源声明提供程序。 其次,claim配置不能多步查询,所以你需要转换你的结果。

在下图中,我在您的查询中使用了数据源提供程序,并将我的 attributes.timezone 中的值放入“电子邮件”声明中。

请注意 logger.warn,它有助于找出您从数据源返回的内容。