我正在使用WSO2身份服务器作为我们网站的身份提供者。这些网站正在 ASP.net 开发,我们使用内置的Owin-Katana框架以及Oauth 2来验证用户。我可以访问 SCIM REST API 以创建新用户及其在 WSO2 中的声明。声明被添加到方言"urn:scim:schemas:core:1.0"下。我需要在通过 Oauth 2 对用户进行身份验证时检索这些声明。服务提供商设置不允许我从方言"urn:scim:schemas:core:1.0"中选择声明。
有没有办法检索我添加到用户的声明?这里的答案建议我们安装WSO2的升级版本。这是唯一的解决方案吗?
我的 Owin 设置是(使用 NuGet 包 Owin.Security.Providers.WSO2(:
app.UseWSO2Authentication(new WSO2AuthenticationOptions()
{
BaseUrl = "https://identityserver:9443/",
CallbackPath = new PathString("/Account/ExternalLoginConfirmation"),
ClientId = "xxxxxxxxx",
ClientSecret = "yyyyyyyyy"
});
可以通过 SCIM API 检索用户的声明。
获取请求示例:
curl -X GET -H "Authorization: Basic
(base64 adminUsername:adminPassword)
" "https://ishost
:ismgtport
/wso2/scim/Users?filter=userNameEquserstoredomain
/userId
">
{
"schemas": [
"urn:scim:schemas:core:1.0",
"urn:scim:schemas:extension:wso2:1.0"
],
"totalResults": 1,
"Resources": [
{
"wso2Extension": {
"nodeId": "2800",
"employeeNumber": "TEST01"
},
"id": "e8a1791f-af81-4d61-ad33-51fd80c4d716",
"roles": [
"STORE_MANAGER"
],
"name": {
"familyName": "Manager",
"givenName": "Mr"
},
"userName": "userstoredomain/userId",
"phoneNumbers": [
"0000000000"
],
"externalId": "1_TEST01",
"meta": {
"lastModified": "2017-03-27T14:33:05",
"created": "2017-03-27T14:33:05",
"location": "https://localhost:9443/wso2/scim/Users/e8a1791f-af81-4d61-ad33-51fd80c4d716"
}
}
]
}
https://docs.wso2.com/display/IS510/SCIM+APIs
上面的示例是通过版本 5.0.0 检索的
正如第 1 点在此链接中所说,您需要选择在"http://wso2.org/oidc/claim"方言到"http://wso2.org/claims"方言之间具有映射的声明。
从每个声明的映射属性值检查映射。假设方言中的电子邮件声明和方言中的电子邮件声明 http://wso2.org/oidc/claim http://wso2.org/claims 方言中的 Mapped 属性为 mail,请尝试将邮件属性映射到 urn:scim:schemas:core:1.0 方言中的必需声明。在服务提供商中请求声明时,请使用具有声明映射属性值 http://wso2.org/oidc/claim 方言请求声明。
希望这会有所帮助。