Class DecryptSession<S,U>
- java.lang.Object
-
- org.rootservices.otter.security.session.between.DecryptSession<S,U>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOOKIE_NOT_PRESENTstatic java.lang.StringCOULD_NOT_CALL_THE_SESSION_COPY_CONSTRUCTORstatic java.lang.StringCOULD_NOT_DECRYPT_JWEstatic java.lang.StringCOULD_NOT_DESERIALIZEstatic java.lang.StringCOULD_NOT_DESERIALIZE_JWEstatic java.lang.StringCOULD_NOT_GET_HEADER_JWEstatic java.lang.StringFAILED_TO_COPY_REQUEST_SESSIONstatic java.lang.StringINVALID_SESSION_COOKIEprotected static org.slf4j.LoggerLOGGERstatic java.lang.StringNOT_A_JWT
-
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 Scopy(S from)Copies S and then returns the copy.protected Sdecrypt(java.lang.String encryptedSession)protected org.rootservices.jwt.entity.jwk.SymmetricKeygetKey(java.lang.String keyId)java.lang.BooleangetRequired()protected voidonHalt(HaltException e, Response response)This method will be called before a Halt Exception is thrown.voidprocess(Method method, Request<S,U> request, Response<S> response)protected voidsetPreferredKey(org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey)protected StoSession(byte[] json)
-
-
-
Field Detail
-
NOT_A_JWT
public static final java.lang.String NOT_A_JWT
- See Also:
- Constant Field Values
-
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
-
process
public void process(Method method, Request<S,U> request, Response<S> response) throws HaltException
- Specified by:
processin interfaceBetween<S,U>- Throws:
HaltException
-
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 HaltExceptionresponse- a Response
-
decrypt
protected S decrypt(java.lang.String encryptedSession) throws InvalidSessionException, SessionDecryptException
-
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()
-
-