User in Session and in Users panels don't match?


I’ve come across a strange behaviour which I don’t fully understand, and I need some advice/help on how to solve it.
I’m implementing a CustomUserStorageProvider and a AbstractOIDCProtocolMapper.

I’ve managed to get my users to show up on the Users screen on the Admin panel and I see all custom attributes the user should have. This seems to be working just fine.

However, when I try to personalize the AccessToken (by Overriding transformAccessToken), when I get the UserModel by using UserSessionModels getUser() method, there is missing information on this user, especially the custom attributes are not there.

I then went to check the Admin panel and compare the user loaded on the sessions and the user loaded on the Users and to my surprise, they seem to be different/not the same user… See the screenshot bellow.

So I guess it boils down to 3 questions:

  • Why would this happen?
  • Why are these not the same user?
  • And how do I fix this?

Any help is appreciated. Thanks