How do I clear the permission cache for a specific user when an
administrative user updates properties that affect that user's permissions?
I've been doing this when I want to update the current user's permissions:
realm.clearCachedAuthorizationInfo(SecurityUtils.getSubject().getPrincipals());
But how can I access the permissions cache of another user? Note that this
user might be currently active, but they might not as well.
I'm assuming I need to create a SimplePrincipalCollection, but what's the
best way to do that and where is the best location for that code? I believe
I need access to the realm name and the user id to do this. I'm thinking of
adding a method to my realm:
public void clearCachedAuthorizationInfo(User user) {
Long id = User.getId();
String realmName = this.getName();
SimplePrincipalCollection spc = // do something with id and
realmName
this.clearCachedAuthorizationInfo(spc);
}
Thanks,
Tauren