Change user-logged authorities on the fly
I am a newbie with Acegi, and I only know how to use it in the basic way. But now I need to do some advanced things ...
I am currently looking for the way to modify the authorities binded to a logged user by himself, in order to change the menu options for that user in "real time" (with no logout). If the user performs a logout and then get logged in again, everything works ok and the new menu options for the new grant are available.
I get the current authorities with this code:
After this, I add some new grants to gas array, and then put it again into the currentUser
Authentication currentUser = securityContextHolder.getContext().getAuthentication();
UserDetailsImpl userDetails = (UserDetailsImpl) currentUser.getPrincipal();
GrantedAuthority gas =userDetails.getAuthorities();
My web interface is made using acegi taglibs in order to render the menu only with granted options:
But, after refreshing or rendering again the JSP, it looks like the new granted options are not available (or the user authorities are not updated) and I can't see the new menu options that I should see.
Anyone could help me whit this? Any idea?
Thanks in advance!