Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadUserProfile will return roles of last user if current user has no roles assigned #580

Closed
StephanKuehn opened this issue Jul 15, 2019 · 5 comments
Labels
bug For tagging faulty or unexpected behavior. investigation-needed Indication that the maintainer or involved community members may need to investigate more.

Comments

@StephanKuehn
Copy link

This seems to be related to issue #514.

I am using your library against Identity Server 4 using resource owner password grant flow.
Identity Server is running against ASP.Net Core Identity.

I have two roles, user and administrator.

User A is assigned to roles user and administrator.
User B is assigned to roles user.
User C is assigned to no role at all.

If User A logs on, I can see the user info response in fiddler containing both roles >>"role":["user","administrator"]<<. I see the same in userInfo object returned by loadUserProfile().

Subsequently, User C logs on. The user info response in fiddler contains no role at all. However, the userInfo object returned by loadUserProfile() still contains both roles.

@StephanKuehn
Copy link
Author

Pardon me, but it seems that this is a bug that originates in the following two lines in loadUserProfile():

const existingClaims = this.getIdentityClaims() || {};
...
info = Object.assign({}, existingClaims, info);

if info is missing a claim that is present in existingClaims, i.e. stored in oAuthStorage.getItem(''),
the result will contain a claim no longer present on the current user.

@StephanKuehn
Copy link
Author

StephanKuehn commented Jul 15, 2019

The workaround seems to be to call sessionStorage.removeItem('id_token_claims_obj') or whatever storage is configured for the library before calling loadUserProfile().

@manfredsteyer
Copy link
Owner

Thanks for this info. id_token_claims_obj should be overwritten with the user C's claims when they login. Is there an id_token for user C?

@manfredsteyer manfredsteyer added the investigation-needed Indication that the maintainer or involved community members may need to investigate more. label Jul 25, 2019
@jeroenheijmans jeroenheijmans added the bug For tagging faulty or unexpected behavior. label Aug 5, 2019
@StephanKuehn
Copy link
Author

I am using resource owner password grant flow. There is no id token for the any of users A, B or C.

@manfredsteyer
Copy link
Owner

I think this was already resolved with version 8, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For tagging faulty or unexpected behavior. investigation-needed Indication that the maintainer or involved community members may need to investigate more.
Projects
None yet
Development

No branches or pull requests

3 participants