与Oauth2一起使用时,未收到WSO2 Identity Server(v5.1.0)的声明

时间:2017-03-29 05:07:46

标签: asp.net-mvc oauth-2.0 owin wso2is

我使用WSO2 Identity Server作为我们网站的身份提供商。这些网站正在ASP.net中开发,我们使用内置的Owin-Katana框架和Oauth 2来验证用户身份。我可以访问SCIM REST Api来创建新用户及其对WSO2的声明。索赔是在方言“urn:scim:schemas:core:1.0”下添加的。我需要在通过Oauth 2对用户进行身份验证时检索这些声明。服务提供商设置不允许我从方言“urn:scim:schemas:core:1.0”中选择声明。

有没有办法可以检索我添加给用户的声明?这里的answer表明我们安装了WSO2的升级版本。这是唯一的解决方案吗?

我的Owin设置是(使用NuGet包Owin.Security.Providers.WSO2):

app.UseWSO2Authentication(new WSO2AuthenticationOptions()
{
    BaseUrl = "https://identityserver:9443/",                
    CallbackPath = new PathString("/Account/ExternalLoginConfirmation"),
    ClientId = "xxxxxxxxx",
    ClientSecret = "yyyyyyyyy"
});

2 个答案:

答案 0 :(得分:0)

您可以通过SCIM API检索用户的声明。

获取请求的示例:

  

curl -X GET -H“授权:基本(base64 adminUsername:adminPassword)”“https:// ishostismgtport / wso2 / scim / Users?filter = userNameEq userstoredomain / 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 :(得分:0)

正如第1点在this link中所述,您需要选择具有“http://wso2.org/oidc/claim”方言与“http://wso2.org/claims”方言之间映射的声明。

从每个声明的映射属性值检查映射。用http://wso2.org/oidc/claim方言中的电子邮件声明和http://wso2.org/claims方言中的电子邮件声明将Mapped属性作为邮件,尝试将邮件属性映射到urn中所需的声明:scim:schemas:core:1.0 dialect。在服务提供商处请求声明时,请使用http://wso2.org/oidc/claim方言声明具有映射属性值的声明。

希望这会有所帮助。