Class CookieStatePersistence

  • All Implemented Interfaces:
    StatePersistence

    @Singleton
    public class CookieStatePersistence
    extends java.lang.Object
    implements StatePersistence
    Persists the state value in a cookie.
    Since:
    1.2.0
    Author:
    James Kleeh
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void persistState​(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse response, State state)
      Persists the state for later retrieval to allow validation.
      java.util.Optional<State> retrieveState​(io.micronaut.http.HttpRequest<?> request)
      Retrieves and removes the state from persistence.
      • Methods inherited from class java.lang.Object

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

      • CookieStatePersistence

        public CookieStatePersistence​(StateSerDes stateSerDes,
                                      CookieStatePersistenceConfiguration configuration)
        Parameters:
        stateSerDes - The state serializer/deserializer
        configuration - The cookie configuration
    • Method Detail

      • retrieveState

        public java.util.Optional<State> retrieveState​(io.micronaut.http.HttpRequest<?> request)
        Description copied from interface: StatePersistence
        Retrieves and removes the state from persistence.
        Specified by:
        retrieveState in interface StatePersistence
        Parameters:
        request - The request
        Returns:
        The optional state
      • persistState

        public void persistState​(io.micronaut.http.HttpRequest<?> request,
                                 io.micronaut.http.MutableHttpResponse response,
                                 State state)
        Description copied from interface: StatePersistence
        Persists the state for later retrieval to allow validation.
        Specified by:
        persistState in interface StatePersistence
        Parameters:
        request - The login request
        response - The authorization redirect response
        state - The state to persist