user2659694
user2659694

Reputation: 1290

How to get all User Profile Claims of a user in Wso2 Identity server

I have a question relating to get all profiles ( email, phone, address ) after logging successfully in WSO2 Identity Server.

After login, we can have cookie(sessionID) and then based on this, we can use UserStoreManager to get roles, list user, profiles... and as mentioned in the below link.

I can get use function to get profiles getProfileNames() but the result when I call is only ["default"] while I inputted my email, phone, address, etc in userprofile section in console.

I appreciate your help in this case. Hope that you can help me. Thanks

https://docs.wso2.com/display/IS510/Managing+Users+and+Roles+with+APIs

Upvotes: 1

Views: 1371

Answers (1)

farasath
farasath

Reputation: 3011

Right, so what you are trying to achieve is to get claim values(email, phone etc.) of a user.

for this, you can use the getUserClaimValue()[1] or getUserClaimValuesForClaims()[2]

Both these method take in three arguments,

  1. Username of user
  2. Claim name / Claim names you are trying to retrieve (email, gender etc.)
  3. Profile name (you can pass null, then values from default profile will return)

[1] https://docs.wso2.com/display/IS510/Managing+Users+and+Roles+with+APIs#ManagingUsersandRoleswithAPIs-getUserClaimValue()

[2] https://docs.wso2.com/display/IS510/Managing+Users+and+Roles+with+APIs#ManagingUsersandRoleswithAPIs-getUserClaimValuesForClaims()

Upvotes: 1

Related Questions