Class ServletSessionDao

java.lang.Object
se.swedenconnect.bankid.idp.authn.session.ServletSessionDao
All Implemented Interfaces:
SessionDao

public class ServletSessionDao extends Object implements SessionDao
Implements the SessionDao interface using the session extracted from the HttpServletRequest. If using Spring session the session objects will be distributed.
Author:
Martin Lindström, Felix Hellman
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    read(String key, Class<T> tClass, jakarta.servlet.http.HttpServletRequest request)
    Reads the object identified by key of type tClass.
    void
    remove(String key, jakarta.servlet.http.HttpServletRequest request)
    Removes the object identified by key.
    void
    write(String key, Object value, jakarta.servlet.http.HttpServletRequest request)
    Writes object value under the key key.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServletSessionDao

      public ServletSessionDao()
  • Method Details

    • write

      public void write(String key, Object value, jakarta.servlet.http.HttpServletRequest request)
      Writes object value under the key key.
      Specified by:
      write in interface SessionDao
      Parameters:
      key - the object key
      value - the object
      request - the HTTP servlet request
    • read

      public <T> T read(String key, Class<T> tClass, jakarta.servlet.http.HttpServletRequest request)
      Reads the object identified by key of type tClass.
      Specified by:
      read in interface SessionDao
      Type Parameters:
      T - the type
      Parameters:
      key - the object key
      tClass - the type of the object to read
      request - the HTTP servlet request
      Returns:
      the object, or null if none is available
    • remove

      public void remove(String key, jakarta.servlet.http.HttpServletRequest request)
      Removes the object identified by key.
      Specified by:
      remove in interface SessionDao
      Parameters:
      key - the object key
      request - the HTTP servlet request