public class ClientSideSessionConfig extends Object
Constructor and Description |
---|
ClientSideSessionConfig() |
Modifier and Type | Method and Description |
---|---|
String |
getCipherAlgorithm()
The
Cipher algorithm used to encrypt/decrypt the serialized session |
String |
getDomain()
Use the session cookie only when requesting from the
domain . |
String |
getLastAccessTimeCookieName()
The name of the
cookie used to store session's last access time. |
String |
getMacAlgorithm()
The
Mac algorithm used to sign the serialized session with the secretToken. |
Duration |
getMaxInactivityInterval()
Maximum inactivity time (in units defined by
TimeUnit ) after which session will be invalidated. |
int |
getMaxSessionCookieSize()
Maximum size of the session cookie.
|
String |
getPath()
Use the session cookie only when requesting from the
path . |
String |
getSecretKey()
The secret key used in the symmetric-key encyrption/decryption of the serialized session.
|
String |
getSecretToken()
The token used to sign the serialized session to prevent tampering.
|
String |
getSessionCookieName()
The name of the
cookie used to store serialized and encrypted session data. |
void |
setCipherAlgorithm(String cipherAlgorithm)
Set the cipher algorithm used to encrypt/decrypt the serialized session data.
|
void |
setDomain(String domain)
Set the
domain for session cookie. |
void |
setMacAlgorithm(String macAlgorithm)
Set mac algorithm used to sign the serialized and encrypted session data.
|
void |
setMaxInactivityInterval(Duration maxInactivityInterval)
Set maximum inactivity time (in seconds) of the cookie session.
|
void |
setMaxSessionCookieSize(int maxSessionCookieSize)
Set maximum size of the session cookie.
|
void |
setPath(String path)
Set the
path for session cookie. |
void |
setSecretKey(String secretKey)
Set the secret key used in the symmetric-key encryption/decryption of the serialized session data.
|
void |
setSecretToken(String secretToken)
Set the {code secretToken} used to sign the serialized and encrypted session data.
|
void |
setSessionCookieName(String sessionCookieName)
Set the
cookie name used to store session data. |
public String getSessionCookieName()
cookie
used to store serialized and encrypted session data.
If length of the serialized session is greater than getMaxSessionCookieSize()
it is partioned into more
cookies. Every session cookie has a postfix _index
, where index
is the partition number.
Defaults to: ratpack_session
cookie
used to store session data.public void setSessionCookieName(String sessionCookieName)
cookie
name used to store session data.sessionCookieName
- a cookie
name used to store session datapublic String getLastAccessTimeCookieName()
cookie
used to store session's last access time.
Last access time is updated on every session load or store
cookie
with session's last access timepublic String getSecretToken()
If not set, this is set to a time based value.
Important: if working with clustered sessions, not being tied to any ratpack app instance,
secretToken
has to be the same in every ratpack instance configuration.
public void setSecretToken(String secretToken)
secretToken
- a token used to sign the serialized and encrypted session data.public String getMacAlgorithm()
Mac
algorithm used to sign the serialized session with the secretToken.public void setMacAlgorithm(String macAlgorithm)
macAlgorithm
- the name of mac algorithmpublic String getSecretKey()
public void setSecretKey(String secretKey)
secretKey
- a secret keypublic String getCipherAlgorithm()
Cipher
algorithm used to encrypt/decrypt the serialized session
e.g. AES/CBC/PKCS5Padding which is also the default value.
public void setCipherAlgorithm(String cipherAlgorithm)
cipherAlgorithm
- a cipher algorithmpublic String getPath()
path
.
Define the scope of the cookie.
Session should be send for every request. The path
of value "/"
does this.
public void setPath(String path)
path
for session cookie.
Define the scope of the cookie.
path
- a path to which session cookie will be attached topublic String getDomain()
domain
.
Define the scope for the cookie.
public void setDomain(String domain)
domain
for session cookie.
Define the scope of the cookie
domain
- a domain to which session cokkie will be attached topublic int getMaxSessionCookieSize()
According to the RFC 2109 web cookies should be at least 4096 bytes per cookie and at least 20 cookies per domain should be supported.
Defaults to: 1932
.
public void setMaxSessionCookieSize(int maxSessionCookieSize)
If it is less than 1024
or greater than 4096
default value will be used.
maxSessionCookieSize
- a maximum size of one session cookie.public Duration getMaxInactivityInterval()
TimeUnit
) after which session will be invalidated.
Defaults to: 24 hours. If time between last access and current time is less than or equal to max inactive time, session will become valid.
public void setMaxInactivityInterval(Duration maxInactivityInterval)
maxInactivityInterval
- a maximum inactivity time of the cookie session