无法根据帐户的属性列向 ID 或访问令牌添加声明 table
unable to add claim to id or access token based on attributes column of accounts table
经过多次测试,我无法弄清楚如何根据 SCIM 2.0 格式为帐户 table.
中的属性列添加对 userinfo/id 令牌/访问令牌的声明
- Curity 6.6.0
- Mysql 配置为默认数据源也用于用户管理
- Mysql 在数据源中配置的属性查询:SELECT * FROM accounts WHERE username = :subject
- 通过用户 SCIM 端点添加的用户在帐户 table 的 'attributes' 列中有他们的数据(当 Curity 中存在 onyl one DS 时似乎是设计使然)
- family_name、given_name 作为已连接用户正确出现在 ID 标记中
- 我正在使用 BFF 令牌处理程序 SPA 代码 (nodejs) 并验证了整个流程
一步一步:
- 创建一个名为 'user_type'
的声明
- select default-account-manager 与索赔提供者相关联
- 在 'select value' 组合中搜索并添加用户类型(组合中引用了 SCIM 2.0 架构的所有属性)
- 将声明添加到自定义范围和配置文件范围
- 将声明配置为在 userInfo & Id Token & access token
- 提交
--> 任何令牌或 userInfo
中都没有 user_type 字段
我试过 (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
,它有助于找出您从数据源返回的内容。
经过多次测试,我无法弄清楚如何根据 SCIM 2.0 格式为帐户 table.
中的属性列添加对 userinfo/id 令牌/访问令牌的声明- Curity 6.6.0
- Mysql 配置为默认数据源也用于用户管理
- Mysql 在数据源中配置的属性查询:SELECT * FROM accounts WHERE username = :subject
- 通过用户 SCIM 端点添加的用户在帐户 table 的 'attributes' 列中有他们的数据(当 Curity 中存在 onyl one DS 时似乎是设计使然)
- family_name、given_name 作为已连接用户正确出现在 ID 标记中
- 我正在使用 BFF 令牌处理程序 SPA 代码 (nodejs) 并验证了整个流程
一步一步:
- 创建一个名为 'user_type' 的声明
- select default-account-manager 与索赔提供者相关联
- 在 'select value' 组合中搜索并添加用户类型(组合中引用了 SCIM 2.0 架构的所有属性)
- 将声明添加到自定义范围和配置文件范围
- 将声明配置为在 userInfo & Id Token & access token
- 提交 --> 任何令牌或 userInfo 中都没有 user_type 字段
我试过 (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
,它有助于找出您从数据源返回的内容。