Welcome to the jGuard's wiki » jGuard Documentation » role activation/passivation by the user

role activation/passivation by the user

Last modified by RaffaelloPelagalli on 2007/01/02 13:29
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);
Tags:
Created by diabolo512 on 2007/01/02 13:25

jGuard team copyright 2004-2009
3.1.1