Class SessionPropertyUpgrader

java.lang.Object
org.forgerock.openam.authentication.service.SessionPropertyUpgrader
Direct Known Subclasses:
DefaultSessionPropertyUpgrader

@SupportedAll public abstract class SessionPropertyUpgrader extends Object
This class is used in case of session upgrade for copying session properties from the old session into the new one. Subclasses should implement shouldCopy(java.lang.String) in order to control which properties are needed to copy into the new session. In case you want to modify the copyable session property you are encouraged to override updateProperty(com.iplanet.dpro.session.service.SessionBuilder, java.lang.String, java.lang.String) method.
  • Constructor Details

    • SessionPropertyUpgrader

      public SessionPropertyUpgrader()
  • Method Details

    • loadPropertyUpgrader

      public static SessionPropertyUpgrader loadPropertyUpgrader()
      Attempts to load the configured session property upgrader class.
    • populateProperties

      public final void populateProperties(org.forgerock.openam.session.Session oldSession, com.iplanet.dpro.session.service.SessionBuilder newSession, boolean forceAuth) throws com.iplanet.dpro.session.SessionException
      Entry point for LoginState. This method is called during session upgrade in order to copy session attributes from one session to another.
      Parameters:
      oldSession - The previous session
      newSession - The new sessions builder
      forceAuth - Whether the authentication was forced
      Throws:
      com.iplanet.dpro.session.SessionException - If there was an error whilst retrieving the old session's properties.
    • updateProperty

      public void updateProperty(com.iplanet.dpro.session.service.SessionBuilder session, String property, String value)
      This method updates a session property in the session with the given value. Override this method if you want to change some properties during the upgrade process. NOTE: If you override this, you SHOULD call super.updateProperty(..) at the end of your implementation with the updated values.
      Parameters:
      session - Session builder where the property should be set
      property - Name of the property to set
      value - Value of the given session property
    • shouldCopy

      public abstract boolean shouldCopy(String key)
      This method decides whether a given session property should be copied to the new session.
      Parameters:
      key - The name of the session property which we want to decide to copy
      Returns:
      true if the property with the given key should be copied into the new session