jGuard install on j2ee

  1. required librairies
  2. AccessFilter and web.xml
  3. integrate jGuard in your jsp
  4. integrate jGuard in your servlets

Login Modules

Authorization Managers

Advanced jGuard

jGuard install on jvm

  1. java.home
  2. libraries and bootclasspath
  3. java.security
  4. jGuard.loginScheme
  5. jGuard.policy







Integrate jGuard in your servlets (or Struts action or others ....)

get the Subject

When authentication is done by AccessFilter, it stores the newly created Subject object in your httpSession with the subjectID key. So, you can retrieve it by this code (HttpServletRequest reference of your servlet is request, and we use the net.sf.jguard.filters.Constants interface):

 Subject subj =  (Subject)request.getSession().getAttribute(Constants.SUBJECT_ID);

refresh authentication and authorization data (only those of your webapp jGuard mechanisms)

Authorisation and authentication data changes are followed 'on the fly', with this code:


    Policy policy = (Policy)Policy.getPolicy();
    JGuardPolicy jg = (JGuardPolicy)policy;
    jg.refresh(this.getClass().getClassLoader());