Class EncryptSession<S,U>
- java.lang.Object
-
- org.rootservices.otter.security.session.between.EncryptSession<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 EncryptSession<S,U> extends java.lang.Object implements Between<S,U>
Intended to be used after a resource has processed the request. This will encrypt the session which will become a cookie.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOULD_NOT_ENCRYPT_SESSIONprotected static org.slf4j.LoggerLOGGERstatic java.lang.StringNOT_ENCRYPTING
-
Constructor Summary
Constructors Constructor Description EncryptSession(CookieConfig cookieConfig, org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey, com.fasterxml.jackson.databind.ObjectWriter objectWriter)
-
Method Summary
Modifier and Type Method Description protected java.io.ByteArrayOutputStreamencrypt(S session)CookieConfiggetCookieConfig()org.rootservices.jwt.entity.jwk.SymmetricKeygetPreferredKey()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)voidsetCookieConfig(CookieConfig cookieConfig)voidsetPreferredKey(org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey)protected java.lang.BooleanshouldEncrypt(Request<S,U> request, Response<S> response)
-
-
-
Field Detail
-
NOT_ENCRYPTING
public static final java.lang.String NOT_ENCRYPTING
- See Also:
- Constant Field Values
-
COULD_NOT_ENCRYPT_SESSION
public static final java.lang.String COULD_NOT_ENCRYPT_SESSION
- See Also:
- Constant Field Values
-
LOGGER
protected static org.slf4j.Logger LOGGER
-
-
Constructor Detail
-
EncryptSession
public EncryptSession(CookieConfig cookieConfig, org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey, com.fasterxml.jackson.databind.ObjectWriter objectWriter)
-
-
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
-
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
-
shouldEncrypt
protected java.lang.Boolean shouldEncrypt(Request<S,U> request, Response<S> response)
-
encrypt
protected java.io.ByteArrayOutputStream encrypt(S session) throws EncryptSessionException
- Throws:
EncryptSessionException
-
getCookieConfig
public CookieConfig getCookieConfig()
-
setCookieConfig
public void setCookieConfig(CookieConfig cookieConfig)
-
getPreferredKey
public org.rootservices.jwt.entity.jwk.SymmetricKey getPreferredKey()
-
setPreferredKey
public void setPreferredKey(org.rootservices.jwt.entity.jwk.SymmetricKey preferredKey)
-
-