/** Initialize the session attributes. */
 public void initializeSession() {
   ApplicationSessionInitializer asi = getApplicationSessionInitializer();
   if (asi != null) {
     asi.initializeSession();
     Map<String, Object> sessionAttributes = asi.getSessionAttributes();
     if (sessionAttributes != null) {
       setSessionAttributes(sessionAttributes);
     }
     propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
   }
 }
 /**
  * When a correct login occurs, read all relevant userinformation into session.
  *
  * @param event the loginEvent that triggered this handler.
  */
 protected void handleLoginEvent(LoginEvent event) {
   ApplicationSessionInitializer asi = getApplicationSessionInitializer();
   if (asi != null) {
     asi.initializeUser();
     Map<String, Object> userAttributes = asi.getUserAttributes();
     if (userAttributes != null) {
       setUserAttributes(userAttributes);
     }
   }
   Authentication auth = (Authentication) event.getSource();
   propertyChangeSupport.firePropertyChange(USER, null, auth);
 }
 /**
  * When a logout occurs, remove all user related information from the session.
  *
  * @param event the logoutEvent that triggered this handler.
  */
 protected void handleLogoutEvent(LogoutEvent event) {
   clearUser();
   Authentication auth = (Authentication) event.getSource();
   propertyChangeSupport.firePropertyChange(USER, auth, null);
 }
 /** Clear all session attributes. */
 public void clearSession() {
   this.sessionAttributes.clear();
   propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
 }
 /**
  * Add the given key/value pairs to the session attributes.
  *
  * @param attributes a map of key/value pairs.
  */
 public void setSessionAttributes(Map<String, Object> attributes) {
   this.sessionAttributes.putAll(attributes);
   propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
 }
 /**
  * Add a key/value pair to the session attributes map.
  *
  * @param key a unique string code.
  * @param newValue the associated value.
  */
 public void setSessionAttribute(String key, Object newValue) {
   Object oldValue = sessionAttributes.put(key, newValue);
   propertyChangeSupport.firePropertyChange(key, oldValue, newValue);
   propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
 }
 /** Clear all user attributes. */
 public void clearUser() {
   this.userAttributes.clear();
   propertyChangeSupport.firePropertyChange(USER_ATTRIBUTES, null, null);
 }
 /**
  * Add the given key/value pairs to the user attributes.
  *
  * @param attributes a map of key/value pairs.
  */
 public void setUserAttributes(Map<String, Object> attributes) {
   userAttributes.putAll(attributes);
   propertyChangeSupport.firePropertyChange(USER_ATTRIBUTES, null, userAttributes);
 }
 /**
  * Add a key/value pair to the user attributes map.
  *
  * @param key a unique string code.
  * @param newValue the associated value.
  */
 public void setUserAttribute(String key, Object newValue) {
   Object oldValue = userAttributes.put(key, newValue);
   propertyChangeSupport.firePropertyChange(key, oldValue, newValue);
   propertyChangeSupport.firePropertyChange(USER_ATTRIBUTES, null, userAttributes);
 }
 /**
  * Unregister a listener from the specified property.
  *
  * @param property Property that currently is being monitored.
  * @param listener PropertyChangeListener to remove.
  */
 public void removePropertyChangeListener(String property, PropertyChangeListener listener) {
   propertyChangeSupport.removePropertyChangeListener(property, listener);
 }
 /**
  * Register a listener on the specified property.
  *
  * @param property Property to monitor.
  * @param listener PropertyChangeListener to add.
  */
 public void addPropertyChangeListener(String property, PropertyChangeListener listener) {
   propertyChangeSupport.addPropertyChangeListener(property, listener);
 }