to activate/passivate a role owned by a user, we need to:

  • grab the current AuthenticationManager
AuthenticationManager authenticationManager =(AuthenticationManager)request.getSession().getServletContext().getAttribute(SecurityConstants.AUTHENTICATION_MANAGER);

  • grab the User (i.e the Subject)
HttpAuthenticationUtils auth= (HttpAuthenticationUtils)request.getSession(true).getAttribute(HttpConstants.AUTHN_UTILS);
Subject user = auth.getSubject();

  • define the active flag on the role
authenticationManager.setActiveOnRolePrincipal(user,roleName,applicationName,active);
last modified by RaffaelloPelagalli on 02/01/2007 at 13:29

Creator: Charles Gay on 2007/01/02 13:25
jGuard team copyright 2004-2009
1.4.1.14796