Class BankIdSessions

java.lang.Object
se.swedenconnect.bankid.idp.authn.session.BankIdSessions
All Implemented Interfaces:
BankIdSessionReader, BankIdSessionWriter

@Service public class BankIdSessions extends Object implements BankIdSessionWriter, BankIdSessionReader
Implements the writing and reading of BankID session data.
Author:
Martin Lindström, Felix Hellman
  • Constructor Details

    • BankIdSessions

      public BankIdSessions(SessionDao sessionDao)
      Constructor.
      Parameters:
      sessionDao - the underlying data access object for storing BankID sessions
  • Method Details

    • save

      public void save(jakarta.servlet.http.HttpServletRequest request, BankIdSessionData data)
      Saves BankIdSessionData to repository. Overwrites data if order reference is the same.
      Specified by:
      save in interface BankIdSessionWriter
      Parameters:
      request - to determine session key
      data - to be saved
    • save

      public void save(jakarta.servlet.http.HttpServletRequest request, CollectResponse data)
      Saves the final CollectResponse that contains CompletionData.
      Specified by:
      save in interface BankIdSessionWriter
      Parameters:
      request - to determine session key
      data - to be saved
    • delete

      public void delete(jakarta.servlet.http.HttpServletRequest request)
      Deletes everything except device selection for finalized authentication.
      Specified by:
      delete in interface BankIdSessionWriter
      Parameters:
      request - to determine session key
    • save

      public void save(jakarta.servlet.http.HttpServletRequest request, PreviousDeviceSelection previousDeviceSelection)
      Loads previous device selection from successful authentication.
      Specified by:
      save in interface BankIdSessionWriter
      Parameters:
      request - to determine session key
      previousDeviceSelection - device used for authentication
    • loadSessionData

      public BankIdSessionState loadSessionData(jakarta.servlet.http.HttpServletRequest request)
      Loads session data.
      Specified by:
      loadSessionData in interface BankIdSessionReader
      Parameters:
      request - the current request for the user to determine session key
      Returns:
      a BankIdSessionState
    • loadCompletionData

      public CollectResponse loadCompletionData(jakarta.servlet.http.HttpServletRequest request)
      Loads final CollectResponse.
      Specified by:
      loadCompletionData in interface BankIdSessionReader
      Parameters:
      request - the current request for the user to determine session key
      Returns:
      the final CollectResponse from the BankID API containing CompletionData
    • loadPreviousSelectedDevice

      public PreviousDeviceSelection loadPreviousSelectedDevice(jakarta.servlet.http.HttpServletRequest request)
      Loads device selection.
      Specified by:
      loadPreviousSelectedDevice in interface BankIdSessionReader
      Parameters:
      request - the current request for the user to determine session key
      Returns:
      device selection from last successful authentication for the current user
    • loadUserVisibleData

      public UserVisibleData loadUserVisibleData(jakarta.servlet.http.HttpServletRequest request)
      Loads uservisible data.
      Specified by:
      loadUserVisibleData in interface BankIdSessionReader
      Parameters:
      request - the current request for the user to determine session key
      Returns:
      user visible data to be displayed in app
    • save

      public void save(jakarta.servlet.http.HttpServletRequest request, UserVisibleData userVisibleData)
      Loads user visible data to be displayed in BankID application.
      Specified by:
      save in interface BankIdSessionWriter
      Parameters:
      request - to determine session key
      userVisibleData - message that should be displayed in app
    • loadContext

      public BankIdContext loadContext(jakarta.servlet.http.HttpServletRequest request)
      Loads the BankID context.
      Specified by:
      loadContext in interface BankIdSessionReader
      Parameters:
      request - the servlet request
      Returns:
      a BankIdContext