Class MemcachedSessionManager

java.lang.Object
com.predic8.membrane.core.interceptor.session.SessionManager
com.predic8.membrane.core.interceptor.session.MemcachedSessionManager

public class MemcachedSessionManager extends SessionManager
For testing, the class FakeSyncSessionStoreManager is used instead.
  • Field Details

    • cookiePrefix

      protected String cookiePrefix
  • Constructor Details

    • MemcachedSessionManager

      public MemcachedSessionManager()
  • Method Details

    • init

      public void init(Router router) throws Exception
      Specified by:
      init in class SessionManager
      Throws:
      Exception
    • cookieValueToAttributes

      protected Map<String,Object> cookieValueToAttributes(String cookie)
      Description copied from class: SessionManager
      Transforms a cookie value into its attributes. The cookie should be assumed valid as @isValidCookieForThisSessionManager was called beforehand
      Specified by:
      cookieValueToAttributes in class SessionManager
    • getCookieValues

      protected Map<Session,String> getCookieValues(Session... session)
      Description copied from class: SessionManager
      Get the String identifier of the sessions to be used as cookie value.
      Specified by:
      getCookieValues in class SessionManager
    • getInvalidCookies

      public List<String> getInvalidCookies(Exchange exc, String validCookie)
      Description copied from class: SessionManager
      Get all cookies String representations from the request that are not valid anymore, e.g. because the cookie is a self contained value and has changed or expired (e.g. jwt). Should return cookie values in the form of key=value.
      Specified by:
      getInvalidCookies in class SessionManager
      validCookie - is the cookie value representation of the currently active session. Is key=value
    • isValidCookieForThisSessionManager

      protected boolean isValidCookieForThisSessionManager(String cookie)
      Description copied from class: SessionManager
      Gets called for every cookie value. Returns if the cookie value is valid and managed by this manager instance, e.g. jwt session manager checks if the cookie is a jwt, if it has the correct issuer, if it is not expired and if the signature is valid. Cookie is in format key=value
      Specified by:
      isValidCookieForThisSessionManager in class SessionManager
    • cookieRenewalNeeded

      protected boolean cookieRenewalNeeded(String originalCookie)
      Description copied from class: SessionManager
      Gets called when session was not modified. Should check, if session needs to be renewed (e.g. jwt expiration).
      Specified by:
      cookieRenewalNeeded in class SessionManager
      Parameters:
      originalCookie - the original cookie from which the session was created (can be different from current session)
      Returns:
    • removeSession

      public void removeSession(Exchange exc)
      Overrides:
      removeSession in class SessionManager
    • getConnector

      public MemcachedConnector getConnector()
    • setConnector

      public void setConnector(MemcachedConnector connector)
    • getCookiePrefix

      public String getCookiePrefix()
    • setCookiePrefix

      public void setCookiePrefix(String cookiePrefix)
      Set this, if you are running multiple parallel Membrane instances.
      Default
      randomly chosen 8-character long string.