Class AbstractAccessTokenCookieConfigurationProperties
java.lang.Object
io.micronaut.security.token.cookie.AbstractAccessTokenCookieConfigurationProperties
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
,io.micronaut.http.cookie.CookieConfiguration
,TokenCookieConfiguration
- Direct Known Subclasses:
RefreshTokenCookieConfigurationProperties
,TokenCookieConfigurationProperties
public abstract class AbstractAccessTokenCookieConfigurationProperties
extends Object
implements TokenCookieConfiguration
Base class for cookie configuration properties classes.
- Since:
- 3.4.2
- Author:
- Álvaro Sánchez-Mariscal
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected Boolean
protected Duration
protected io.micronaut.http.cookie.SameSite
protected Boolean
static final io.micronaut.http.cookie.SameSite
The default same-site setting for the JWT cookie.static final boolean
The default http only value.protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOptional<io.micronaut.http.cookie.SameSite>
boolean
void
setCookieDomain
(@Nullable String cookieDomain) Sets the domain name of this Cookie.void
setCookieHttpOnly
(Boolean cookieHttpOnly) Whether the Cookie can only be accessed via HTTP.void
setCookieMaxAge
(Duration cookieMaxAge) Sets the maximum age of the cookie.void
setCookieSameSite
(@Nullable io.micronaut.http.cookie.SameSite cookieSameSite) Sets the same-site setting of the cookie.void
setCookieSecure
(Boolean cookieSecure) Sets whether the cookie is secured.void
setSessionCookie
(boolean sessionCookie) Whether the cookie is a session cookie.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.cookie.CookieConfiguration
getCookieName, getCookiePath
Methods inherited from interface io.micronaut.core.util.Toggleable
isEnabled
-
Field Details
-
DEFAULT_HTTPONLY
public static final boolean DEFAULT_HTTPONLYThe default http only value.- See Also:
-
DEFAULT_COOKIESAMESITE
public static final io.micronaut.http.cookie.SameSite DEFAULT_COOKIESAMESITEThe default same-site setting for the JWT cookie. -
cookieDomain
-
cookieHttpOnly
-
cookieSecure
-
cookieMaxAge
-
cookieSameSite
protected io.micronaut.http.cookie.SameSite cookieSameSite -
sessionCookie
protected boolean sessionCookie
-
-
Constructor Details
-
AbstractAccessTokenCookieConfigurationProperties
public AbstractAccessTokenCookieConfigurationProperties()
-
-
Method Details
-
isSessionCookie
public boolean isSessionCookie()- Specified by:
isSessionCookie
in interfaceTokenCookieConfiguration
- Returns:
- whether the cookie is a session cookie. A session cookie does not have an expiration date. If set to true, then
CookieConfiguration.getCookieMaxAge()
is ignored.
-
setSessionCookie
public void setSessionCookie(boolean sessionCookie) Whether the cookie is a session cookie. A session cookie does not have an expiration date. `cookie-max-age` is ignored if session cookie is set to true. Default value (false).- Parameters:
sessionCookie
- Whether the cookie is a session cookie.- Since:
- 4.12.0
-
getCookieDomain
- Specified by:
getCookieDomain
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- the domain name of this Cookie
-
isCookieHttpOnly
- Specified by:
isCookieHttpOnly
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- Whether the Cookie can only be accessed via HTTP.
-
isCookieSecure
- Specified by:
isCookieSecure
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- True if the cookie is secure
-
getCookieMaxAge
- Specified by:
getCookieMaxAge
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- The max age to use for the cookie
-
getCookieSameSite
- Specified by:
getCookieSameSite
in interfaceio.micronaut.http.cookie.CookieConfiguration
-
setCookieDomain
Sets the domain name of this Cookie.- Parameters:
cookieDomain
- the domain name of this Cookie
-
setCookieHttpOnly
Whether the Cookie can only be accessed via HTTP. Default value (true).- Parameters:
cookieHttpOnly
- Whether the Cookie can only be accessed via HTTP
-
setCookieSecure
Sets whether the cookie is secured. Defaults to the secure status of the request.- Parameters:
cookieSecure
- True if the cookie is secure
-
setCookieMaxAge
Sets the maximum age of the cookie.- Parameters:
cookieMaxAge
- The maximum age of the cookie
-
setCookieSameSite
public void setCookieSameSite(@Nullable @Nullable io.micronaut.http.cookie.SameSite cookieSameSite) Sets the same-site setting of the cookie. Default value null. Value is case sensitive. Allowed values: `Strict`, `Lax` or `None`.- Parameters:
cookieSameSite
- The same-site setting of the cookie.
-