Interface SessionStore<A,B extends Session<A>>

Type Parameters:
A - the session data type
B - the session type
All Known Subinterfaces:
BasicSessionStore<A>, JWTSessionStore<A,B>
All Known Implementing Classes:
AbstractSessionStore, InMemoryBasicSessionStore, InMemoryJWTSessionStore, RedisBasicSessionStore, RedisJWTSessionStore

public interface SessionStore<A,B extends Session<A>>

A session store is used to create, get, save, move and remove session and its data uniquely identified by a session id in a data store.

Since:
1.13
Author:
Jeremy Kuhn
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new session in the session store.
    get(String sessionId)
    Returns the session identified by the specified session id.
    getData(String sessionId)
    Returns the data of the session identified by the specified session id.
    move(String sessionId, String newSessionId)
    Moves the session identified by the specified identifier to a new identifier.
    remove(String sessionId)
    Removes the session identified by the specified identifier.
    save(B session)
    Saves the specified session.
  • Method Details

    • create

      Mono<B> create()

      Creates a new session in the session store.

      This shall physically create a new session in the data store.

      Returns:
      a mono for creating a session
    • get

      Mono<B> get(String sessionId)

      Returns the session identified by the specified session id.

      Parameters:
      sessionId - a session id
      Returns:
      a mono emitting the session or an empty mono if no session exists with the specified identifier
    • getData

      Mono<A> getData(String sessionId)

      Returns the data of the session identified by the specified session id.

      Parameters:
      sessionId - a session id
      Returns:
      a mono emitting the session data or an empty mono if no session exists with specified identifier or if a session exists which does not define any data
    • move

      Mono<Void> move(String sessionId, String newSessionId) throws IllegalStateException

      Moves the session identified by the specified identifier to a new identifier.

      Parameters:
      sessionId - a session id
      newSessionId - a new session id
      Returns:
      a mono for moving a session
      Throws:
      IllegalStateException - if there is no session with the specified identifier or if a session already exists at the specified new identifier
    • remove

      Mono<Void> remove(String sessionId)

      Removes the session identified by the specified identifier.

      Parameters:
      sessionId - a session id
      Returns:
      a mono for removing a session
    • save

      Saves the specified session.

      Whether resolved session data are saved along with the session is implementation specific. Implementors must however at least guarantee that data that is explicitly set on a session using Session.setData(Object) are saved.

      Parameters:
      session - a session
      Returns:
      a mono for saving a session
      Throws:
      IllegalArgumentException - if the specified session does not originate from this session store
      IllegalStateException - if the specified session does not exist in the store or if it was invalidated