2014-08-07 5 views
1

У меня установлен сервер WSO2 Identiy, и я написал код Java для получения информации о пользователях с oauth 2. Для этого я использую OLTU. Я подключен правильно и после того, как переговоры о access_code, я прошу для UserInfo конечной точки, как это:сервер идентификации wso2 oauth userinfo no role

https://<serverIP>:9443/oauth2/userinfo?schema=openid 

я получаю информацию о пользователе правильно в формате JSON:

{"email":"[email protected]","name":"xxx","family_name":"xx","preferred_username":"xxx","given_name":"xx"} 

Что я нахожу, что никакой информации роли возвращается. Я создал некоторые пользовательские роли и назначил пользователей. У них нет каких-либо разрешений.

Нужно ли мне что-либо настраивать на сервере? Запрос должен быть сделан любым другим способом? Что я делаю не так?

ответ

2

There are two ways to add this claim mapping. It's depends on your requirement.

To get this done has to add a role claim mapping under " http://wso2.org/oidc/claim " claim dialect. This can be done in following ways

Case 1 : For fresh WSO2IS before first startup

Go to <IS_HOME>/repository/conf/claim-config.xml file<br/> Add following configuration under <Dialect dialectURI="http://wso2.org/oidc/claim"><br/> <Claim> <ClaimURI>Roles</ClaimURI> <DisplayName>Roles</DisplayName> <AttributeID>role</AttributeID> <Description>role of the user</Description> <DisplayOrder>10</DisplayOrder> <SupportedByDefault/> </Claim> Case 2: For already running server. Login to the Identity server management console as admin user. Click the Configure button to access the Configure menu Click on http://wso2.org/oidc/claim Dialect. Click on "Add New Claim Mapping" and set the above details. (There you will get an error which is known issues. But that value will store. Then again edit it and set Mapped Attribute again)

Then restart the server. Now you can get user info with roles

Смежные вопросы