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());