Hello,
I've implemented a User Storage Provider following the Example User
Storage Provider with EJB and JPA.
It works fine, I can fetch tokens for the users in external storage and
now I would like to add roles to the users.
For that I have overwritten UserAdapter#getRoleMappings:
@Override
public Set<RoleModel> getRoleMappings() {
final Set<RoleModel> roles = super.getRoleMappings();
final RoleModel role = new RoleAdapter(this, "my-role-id",
"my-role-name");
roles.add(role);
return roles;
}
RoleAdapter is my own minimal implementation of RoleModel.
While this works, there are now many calls to getUserById() which I
think is because my RoleModel implementation is not cached.
I suppose this could be solved by using
org.keycloak.models.cache.infinispan.RoleAdapter but how can I create an
instance of it?
In particular, I have trouble of getting an instance of
RealmCacheSession that needs to be passed to the constructor.
Cheers,
Torsten
Show replies by date