Package io.micronaut.session.http
Class HttpSessionConfiguration
java.lang.Object
io.micronaut.session.SessionConfiguration
io.micronaut.session.http.HttpSessionConfiguration
- All Implemented Interfaces:
io.micronaut.http.cookie.CookieConfiguration
@ConfigurationProperties("http")
public class HttpSessionConfiguration
extends SessionConfiguration
implements io.micronaut.http.cookie.CookieConfiguration
Allows configuration of the session.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
The default base64 encode value.static final String
Cookie name.static final String
Default Cookie Path.static final boolean
The default remember me value.Fields inherited from class io.micronaut.session.SessionConfiguration
DEFAULT_MAXINACTIVEINTERVAL_MINUTES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionOptional<io.micronaut.http.cookie.SameSite>
String[]
boolean
boolean
void
setBase64Encode
(boolean base64Encode) Default value (true).void
setCookieDomain
(String cookieDomain) void
setCookieMaxAge
(TemporalAmount cookieMaxAge) Sets the maximum age of the cookie.void
setCookieName
(String cookieName) Default value ("SESSION").void
setCookiePath
(String cookiePath) void
setCookieSameSite
(io.micronaut.http.cookie.SameSite sameSite) Determines if this thisCookie
can be sent along cross-site requests.void
setCookieSecure
(Boolean cookieSecure) Sets the secure status of the cookie.void
setDomainName
(String domainName) void
setHeaderNames
(String[] headerNames) Default values (["Authorization-Info", "X-Auth-Token"]).void
void
setRememberMe
(boolean rememberMe) Default value (false).Methods inherited from class io.micronaut.session.SessionConfiguration
getExecutorService, getMaxActiveSessions, getMaxInactiveInterval, isPromptExpiration, setExecutorService, setMaxActiveSessions, setMaxInactiveInterval, setPromptExpiration
-
Field Details
-
DEFAULT_COOKIEPATH
Default Cookie Path.- See Also:
-
DEFAULT_COOKIENAME
Cookie name.- See Also:
-
DEFAULT_REMEMBERME
public static final boolean DEFAULT_REMEMBERMEThe default remember me value.- See Also:
-
DEFAULT_BASE64ENCODE
public static final boolean DEFAULT_BASE64ENCODEThe default base64 encode value.- See Also:
-
-
Constructor Details
-
HttpSessionConfiguration
public HttpSessionConfiguration()
-
-
Method Details
-
isBase64Encode
public boolean isBase64Encode()- Returns:
- Whether the Base64 encode sessions IDs sent back to clients
-
setBase64Encode
public void setBase64Encode(boolean base64Encode) Default value (true).- Parameters:
base64Encode
- Enable the Base64 encode for sessions IDs sent back to clients
-
getCookieName
- Specified by:
getCookieName
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- The cookie name to use
-
setCookieName
Default value ("SESSION").- Parameters:
cookieName
- Set the cookie name to use
-
getPrefix
- Returns:
- The prefix to use when serializing session ID
-
setPrefix
- Parameters:
prefix
- Set the prefix to use when serializing session ID
-
getHeaderNames
- Returns:
- The header names when using a Header strategy
-
setHeaderNames
Default values (["Authorization-Info", "X-Auth-Token"]).- Parameters:
headerNames
- Set the header names when using a Header strategy
-
getCookiePath
- Specified by:
getCookiePath
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- The cookie path to use
-
isCookieHttpOnly
- Specified by:
isCookieHttpOnly
in interfaceio.micronaut.http.cookie.CookieConfiguration
-
setCookiePath
- Parameters:
cookiePath
- Set the cookie path to use. Default value ("/").
-
getDomainName
- Returns:
- The domain name to use for the cookie
-
getCookieDomain
- Specified by:
getCookieDomain
in interfaceio.micronaut.http.cookie.CookieConfiguration
-
setDomainName
- Parameters:
domainName
- Set the domain name to use for the cookie
-
setCookieDomain
- Parameters:
cookieDomain
- Set the domain name to use for the cookie
-
getCookieMaxAge
- Specified by:
getCookieMaxAge
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- The max age to use for the cookie
-
setCookieMaxAge
Sets the maximum age of the cookie.- Parameters:
cookieMaxAge
- The maximum age of the cookie
-
isRememberMe
public boolean isRememberMe()- Returns:
- Is remember me config
-
setRememberMe
public void setRememberMe(boolean rememberMe) Default value (false).- Parameters:
rememberMe
- Enable the remember me setting
-
isCookieSecure
- Specified by:
isCookieSecure
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- Is cookie secure
-
setCookieSecure
Sets the secure status of the cookie. Delegates toHttpRequest.isSecure()
if not set.- Parameters:
cookieSecure
- Whether or not the cookie is secure.
-
getCookieSameSite
- Specified by:
getCookieSameSite
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- return the SameSite to use for the cookie.
-
setCookieSameSite
public void setCookieSameSite(io.micronaut.http.cookie.SameSite sameSite) Determines if this thisCookie
can be sent along cross-site requests. For more information, please look here- Parameters:
sameSite
- SameSite value
-