WSO2 JWT声明返回错误的用户 环境

WSO2 JWT声明返回错误的用户 环境,wso2,jwt,wso2is,wso2-am,Wso2,Jwt,Wso2is,Wso2 Am,群集API管理器2.1.0(两个工作人员,一个管理人员)和Identity Server 5.3.0(两个工作人员) 问题 登录网页时,我以应用程序创建者的身份登录。这导致JWT声称自己是应用程序的创建者,而不是登录的用户 发行理念 我的想法是,由于应用程序是由一个用户创建的,因此它使用应用程序客户端id作为授权。由于应用程序链接到创建应用程序的用户,因此它会以该用户的身份登录其他用户。因此,当我们收回JWT声明时,它拥有创建应用程序的用户的信息,而不是登录的用户的信息 我应该考虑什么类型的事情

群集API管理器2.1.0(两个工作人员,一个管理人员)和Identity Server 5.3.0(两个工作人员)

问题 登录网页时,我以应用程序创建者的身份登录。这导致JWT声称自己是应用程序的创建者,而不是登录的用户

发行理念 我的想法是,由于应用程序是由一个用户创建的,因此它使用应用程序客户端id作为授权。由于应用程序链接到创建应用程序的用户,因此它会以该用户的身份登录其他用户。因此,当我们收回JWT声明时,它拥有创建应用程序的用户的信息,而不是登录的用户的信息

我应该考虑什么类型的事情来解决这个问题?我相信JWT配置可以解决这个问题。我知道api-manager.xml或identity.xml可能有答案

如何从访问令牌获取正确的JWT声明

JWT样品
{
“sub”:“12345678”,
"http://wso2.org/claims/applicationtier“:“无限”,
"http://wso2.org/claims/client_id“:“bzuM29gewg5gxazegXiNfkwsgz”,
"http://wso2.org/claims/keytype“:“沙盒”,
"http://wso2.org/claims/version": "1.0.1",
“iss”:“wso2.org/products/am”,
"http://wso2.org/claims/applicationname“:“手机”,
"http://wso2.org/claims/enduser“:“空”,
"http://wso2.org/claims/enduserTenantId“:“空”,
"http://ourdomain.com/claims/client_rest_of_name“:“本”,
"http://ourdomain.com/claims/client_surname“:“克诺比”,
"http://wso2.org/claims/subscriber“:“域/benk”,
"http://wso2.org/claims/tier“:“青铜”,
"http://ourdomain.com/claims/client_claim_source“:“客户端\用户”,
"http://ourdomain.com/claims/client_roles": [
“全职员工”,
“雇员”,
“技术工程师”
],
"http://wso2.org/claims/applicationid": "8",

"http://wso2.org/claims/usertype“:“APPLICATION_USER”,这是自定义声明的一个问题。只需更改代码。

在您的用例中有很多假设,很难精确定位..JWT-您是指从API传递到后端的令牌?您使用哪个OAuth配置文件来验证您的应用程序?(隐式、代码、客户端凭据、密码、saml)无法从多个登录中混合web会话?(您使用的是跨站点请求还是对APIM的请求被代理?)您是否将IS配置为密钥管理器?1.是的,我们有将最终用户属性传递到后端的自定义声明。最终传递的属性是应用程序创建者的属性。我想获取登录到应用程序的人员的属性。2.应用程序正在使用授权代码。3.据我所知,我同意ing说不。没有代理,会话也没有混合。如果这有帮助的话,还有一些关于登录的额外信息。到的应用程序链接是shibboleth/cas登录页面,我们的用户和角色存储在LDAP中。4.是的,identity server是密钥管理器。所以你编写了一个自定义jwt生成器?你能确认用于获取用户声明的令牌吗s是用户令牌类型,而不是应用程序令牌?(尝试查明用户身份的来源)是。正如@GabrielVince指出的,如果它是用户访问令牌,则声明应为登录用户声明。如果它是应用程序令牌(使用客户端凭据授予),则您将拥有与应用程序创建者相关的详细信息/
{
  "sub": "12345678",
  "http://wso2.org/claims/applicationtier": "Unlimited",
  "http://wso2.org/claims/client_id": "bzuM29gewg5gxazegXiNfkwsgz",
  "http://wso2.org/claims/keytype": "SANDBOX",
  "http://wso2.org/claims/version": "1.0.1",
  "iss": "wso2.org/products/am",
  "http://wso2.org/claims/applicationname": "CellPhones",
  "http://wso2.org/claims/enduser": "null",
  "http://wso2.org/claims/enduserTenantId": "null",
  "http://ourdomain.com/claims/client_rest_of_name": "Ben",
  "http://ourdomain.com/claims/client_surname": "Kenobi",
  "http://wso2.org/claims/subscriber": "DOMAIN/benk",
  "http://wso2.org/claims/tier": "Bronze",
  "http://ourdomain.com/claims/client_claim_source": "CLIENT_SUBSCRIBER",
  "http://ourdomain.com/claims/client_roles": [
    "Full-Time Employee",
    "Employee",
    "Technology Engineer"
  ],
  "http://wso2.org/claims/applicationid": "8",
  "http://wso2.org/claims/usertype": "APPLICATION_USER", <- Client app
  "exp": 1493232200,
  "email": "user@gmail.com",
  "http://wso2.org/claims/apicontext": "/jwt/1.0.1"
}