Class DecryptSession<S,​U>

  • Type Parameters:
    S - Session object, intended to contain user session data.
    U - User object, intended to be a authenticated user.
    All Implemented Interfaces:
    Between<S,​U>

    public class DecryptSession<S,​U>
    extends java.lang.Object
    implements Between<S,​U>
    A Between that will encrypt a session.
    • Constructor Summary

      Constructors 
      Constructor Description
      DecryptSession​(java.lang.reflect.Constructor<S> ctor, java.lang.String sessionCookieName, org.rootservices.jwt.config.JwtAppFactory jwtAppFactory, org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey, java.util.Map<java.lang.String,​org.rootservices.jwt.entity.jwk.SymmetricKey> rotationKeys, com.fasterxml.jackson.databind.ObjectReader objectReader, java.lang.Boolean required)  
    • Method Summary

      Modifier and Type Method Description
      protected S copy​(S from)
      Copies S and then returns the copy.
      protected S decrypt​(java.lang.String encryptedSession)  
      protected org.rootservices.jwt.entity.jwk.SymmetricKey getKey​(java.lang.String keyId)  
      java.lang.Boolean getRequired()  
      protected void onHalt​(HaltException e, Response response)
      This method will be called before a Halt Exception is thrown.
      void process​(Method method, Request<S,​U> request, Response<S> response)  
      protected void setPreferredKey​(org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey)  
      protected S toSession​(byte[] json)  
      • Methods inherited from class java.lang.Object

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

      • COULD_NOT_GET_HEADER_JWE

        public static final java.lang.String COULD_NOT_GET_HEADER_JWE
        See Also:
        Constant Field Values
      • COULD_NOT_DESERIALIZE_JWE

        public static final java.lang.String COULD_NOT_DESERIALIZE_JWE
        See Also:
        Constant Field Values
      • COULD_NOT_DECRYPT_JWE

        public static final java.lang.String COULD_NOT_DECRYPT_JWE
        See Also:
        Constant Field Values
      • COULD_NOT_DESERIALIZE

        public static final java.lang.String COULD_NOT_DESERIALIZE
        See Also:
        Constant Field Values
      • INVALID_SESSION_COOKIE

        public static final java.lang.String INVALID_SESSION_COOKIE
        See Also:
        Constant Field Values
      • COOKIE_NOT_PRESENT

        public static final java.lang.String COOKIE_NOT_PRESENT
        See Also:
        Constant Field Values
      • FAILED_TO_COPY_REQUEST_SESSION

        public static final java.lang.String FAILED_TO_COPY_REQUEST_SESSION
        See Also:
        Constant Field Values
      • COULD_NOT_CALL_THE_SESSION_COPY_CONSTRUCTOR

        public static final java.lang.String COULD_NOT_CALL_THE_SESSION_COPY_CONSTRUCTOR
        See Also:
        Constant Field Values
      • LOGGER

        protected static org.slf4j.Logger LOGGER
    • Constructor Detail

      • DecryptSession

        public DecryptSession​(java.lang.reflect.Constructor<S> ctor,
                              java.lang.String sessionCookieName,
                              org.rootservices.jwt.config.JwtAppFactory jwtAppFactory,
                              org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey,
                              java.util.Map<java.lang.String,​org.rootservices.jwt.entity.jwk.SymmetricKey> rotationKeys,
                              com.fasterxml.jackson.databind.ObjectReader objectReader,
                              java.lang.Boolean required)
    • Method Detail

      • copy

        protected S copy​(S from)
                  throws SessionCtorException
        Copies S and then returns the copy.
        Parameters:
        from - the session to copy
        Returns:
        an instance of T that is a copy of session
        Throws:
        SessionCtorException - when ctor could not executed
      • onHalt

        protected void onHalt​(HaltException e,
                              Response response)
        This method will be called before a Halt Exception is thrown. Override this method if you wish to change the behavior on the response right before a Halt Exception is going to be thrown. An Example would be, you may want to redirect the user to a login page.
        Parameters:
        e - a HaltException
        response - a Response
      • toSession

        protected S toSession​(byte[] json)
      • getKey

        protected org.rootservices.jwt.entity.jwk.SymmetricKey getKey​(java.lang.String keyId)
      • setPreferredKey

        protected void setPreferredKey​(org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey)
      • getRequired

        public java.lang.Boolean getRequired()