1 28 package net.sf.jguard.jee.listeners; 29 30 import javax.servlet.http.HttpSessionAttributeListener ; 31 import javax.servlet.http.HttpSessionBindingEvent ; 32 33 import net.sf.jguard.ext.audit.AuditManager; 34 import net.sf.jguard.jee.authentication.http.HttpAuthenticationUtils; 35 import net.sf.jguard.jee.authentication.http.HttpConstants; 36 37 44 public class SessionAttributeListener implements HttpSessionAttributeListener { 45 46 public void attributeAdded(HttpSessionBindingEvent event) { 47 if (event.getName().equals(HttpConstants.AUTHN_UTILS)) { 48 AuditManager.addEvent(((HttpAuthenticationUtils) event.getValue()).getSubject(), " was created ", " subject available to webapp "); 49 } 50 } 51 52 public void attributeRemoved(HttpSessionBindingEvent event) { 53 if (event.getName().equals(HttpConstants.AUTHN_UTILS)) { 54 AuditManager.addEvent(((HttpAuthenticationUtils) event.getValue()).getSubject(), " was removed ", " subject not available anymore to webapp "); 55 } 56 } 57 58 public void attributeReplaced(HttpSessionBindingEvent event) { 59 if (event.getName().equals(HttpConstants.AUTHN_UTILS)) { 60 AuditManager.addEvent(((HttpAuthenticationUtils) event.getValue()).getSubject(), " was modified ", " a different subject is now available to webapp "); 61 } 62 } 63 64 } 65 | Popular Tags |