Integrate jGuard with Servlets and other "web" classes (Struts Actions, etc.)
Getting the Subject Object
- in 1.0.x release
HttpAuthenticationUtils auth= (HttpAuthenticationUtils)request.getSession(true).getAttribute(HttpConstants.AUTHN_UTILS);
Subject subject = auth.getSubject();- in 0.80 release
AuthenticationUtils authUtils = (AuthenticationUtils)request.getSession().getAttribute(HttpConstants.AUTH_UTILS); Subject subject = authUtils.getSubject();
- in 0.70 release
Subject subj = (Subject)request.getSession().getAttribute(HttpConstants.SUBJECT_ID);
- in release prior to 0.70 release:
Subject subj = (Subject)request.getSession().getAttribute(Constants.SUBJECT_ID);
Getting the 'identity' credential
the 'identity' credential is the credential(i.e user attribute) which identify uniquely the user.- in 1.0.x release
//get the Subject AuthenticationUtils authUtils = (AuthenticationUtils)request.getSession().getAttribute(HttpConstants.AUTH_UTILS); Subject subject = authUtils.getSubject(); //get the SubjectTemplate AuthenticationManager am = (AuthenticationManager) request.getSession().getServletContext().getAttribute(SecurityConstants.AUTHENTICATION_MANAGER); SubjectTemplate defaultTemplate = am.getDefaultSubjectTemplate(); JGuardCredential identityCredential = SubjectUtils.getIdentityCredential(subject,defaultTemplate);
Version 1.13 last modified by Charles Gay on 29/01/2007 at 22:13
Document data
Attachments:
No attachments for this document
Comments: 0