Class JwtCookieConfigurationProperties
- java.lang.Object
-
- io.micronaut.security.token.jwt.cookie.JwtCookieConfigurationProperties
-
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
,io.micronaut.http.cookie.CookieConfiguration
,JwtCookieConfiguration
@ConfigurationProperties("micronaut.security.token.jwt.cookie") public class JwtCookieConfigurationProperties extends java.lang.Object implements JwtCookieConfiguration
- Since:
- 1.0
- Author:
- Sergio del Amo
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_COOKIENAME
The default cookie name.static java.lang.String
DEFAULT_COOKIEPATH
Default Cookie Path.static boolean
DEFAULT_ENABLED
The default enable value.static boolean
DEFAULT_HTTPONLY
The default http only value.static java.lang.String
DEFAULT_LOGINFAILURETARGETURL
The default login failure target URL.static java.lang.String
DEFAULT_LOGINSUCCESSTARGETURL
The default login success target URL.static java.lang.String
DEFAULT_LOGOUTTARGETURL
The default logout target URL.static boolean
DEFAULT_SECURE
The default secure value.static java.lang.String
PREFIX
-
Constructor Summary
Constructors Constructor Description JwtCookieConfigurationProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
getCookieDomain()
java.util.Optional<java.time.temporal.TemporalAmount>
getCookieMaxAge()
java.lang.String
getCookieName()
java.util.Optional<java.lang.String>
getCookiePath()
java.lang.String
getLoginFailureTargetUrl()
java.lang.String
getLoginSuccessTargetUrl()
java.lang.String
getLogoutTargetUrl()
java.util.Optional<java.lang.Boolean>
isCookieHttpOnly()
java.util.Optional<java.lang.Boolean>
isCookieSecure()
boolean
isEnabled()
void
setCookieDomain(java.lang.String cookieDomain)
Sets the domain name of this Cookie.void
setCookieHttpOnly(java.lang.Boolean cookieHttpOnly)
Whether the Cookie can only be accessed via HTTP.void
setCookieMaxAge(java.time.Duration cookieMaxAge)
Sets the maximum age of the cookie.void
setCookieName(java.lang.String cookieName)
Cookie Name.void
setCookiePath(java.lang.String cookiePath)
Sets the path of the cookie.void
setCookieSecure(java.lang.Boolean cookieSecure)
Sets whether the cookie is secured.void
setEnabled(boolean enabled)
Sets whether JWT cookie based security is enabled.void
setLoginFailureTargetUrl(java.lang.String loginFailureTargetUrl)
Sets the login failure target URL.void
setLoginSuccessTargetUrl(java.lang.String loginSuccessTargetUrl)
Sets the login success target URL.void
setLogoutTargetUrl(java.lang.String logoutTargetUrl)
Sets the logout target URL.
-
-
-
Field Detail
-
PREFIX
public static final java.lang.String PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
The default enable value.- See Also:
- Constant Field Values
-
DEFAULT_SECURE
public static final boolean DEFAULT_SECURE
The default secure value.- See Also:
- Constant Field Values
-
DEFAULT_HTTPONLY
public static final boolean DEFAULT_HTTPONLY
The default http only value.- See Also:
- Constant Field Values
-
DEFAULT_COOKIENAME
public static final java.lang.String DEFAULT_COOKIENAME
The default cookie name.- See Also:
- Constant Field Values
-
DEFAULT_COOKIEPATH
public static final java.lang.String DEFAULT_COOKIEPATH
Default Cookie Path.- See Also:
- Constant Field Values
-
DEFAULT_LOGOUTTARGETURL
public static final java.lang.String DEFAULT_LOGOUTTARGETURL
The default logout target URL.- See Also:
- Constant Field Values
-
DEFAULT_LOGINSUCCESSTARGETURL
public static final java.lang.String DEFAULT_LOGINSUCCESSTARGETURL
The default login success target URL.- See Also:
- Constant Field Values
-
DEFAULT_LOGINFAILURETARGETURL
public static final java.lang.String DEFAULT_LOGINFAILURETARGETURL
The default login failure target URL.- See Also:
- Constant Field Values
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
- Returns:
- a boolean flag indicating whether the JwtCookieTokenReader should be enabled or not
-
getLogoutTargetUrl
public java.lang.String getLogoutTargetUrl()
- Specified by:
getLogoutTargetUrl
in interfaceJwtCookieConfiguration
- Returns:
- String to be parsed into a URI which represents where the user is redirected to after logout.
-
getLoginSuccessTargetUrl
public java.lang.String getLoginSuccessTargetUrl()
- Specified by:
getLoginSuccessTargetUrl
in interfaceJwtCookieConfiguration
- Returns:
- String to be parsed into a URI which represents where the user is redirected to after a successful login.
-
getLoginFailureTargetUrl
public java.lang.String getLoginFailureTargetUrl()
- Specified by:
getLoginFailureTargetUrl
in interfaceJwtCookieConfiguration
- Returns:
- String to be parsed into a URI which represents where the user is redirected to after a failed login.
-
setLogoutTargetUrl
public void setLogoutTargetUrl(java.lang.String logoutTargetUrl)
Sets the logout target URL. Default value ("/").- Parameters:
logoutTargetUrl
- The URL
-
setLoginSuccessTargetUrl
public void setLoginSuccessTargetUrl(java.lang.String loginSuccessTargetUrl)
Sets the login success target URL. Default value ("/").- Parameters:
loginSuccessTargetUrl
- The URL
-
setLoginFailureTargetUrl
public void setLoginFailureTargetUrl(java.lang.String loginFailureTargetUrl)
Sets the login failure target URL. Default value ("/").- Parameters:
loginFailureTargetUrl
- The URL
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether JWT cookie based security is enabled. Default value (false).- Parameters:
enabled
- True if it is enabled
-
setCookieName
public void setCookieName(java.lang.String cookieName)
Cookie Name. Default value ("JWT").- Parameters:
cookieName
- Cookie name
-
getCookieName
@Nonnull public java.lang.String getCookieName()
- Specified by:
getCookieName
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- a name for the cookie
-
getCookieDomain
public java.util.Optional<java.lang.String> getCookieDomain()
- Specified by:
getCookieDomain
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- the domain name of this Cookie
-
getCookiePath
@Nullable public java.util.Optional<java.lang.String> getCookiePath()
- Specified by:
getCookiePath
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- The path of the cookie.
-
isCookieHttpOnly
public java.util.Optional<java.lang.Boolean> isCookieHttpOnly()
- Specified by:
isCookieHttpOnly
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- Whether the Cookie can only be accessed via HTTP.
-
isCookieSecure
public java.util.Optional<java.lang.Boolean> isCookieSecure()
- Specified by:
isCookieSecure
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- True if the cookie is secure
-
getCookieMaxAge
public java.util.Optional<java.time.temporal.TemporalAmount> getCookieMaxAge()
- Specified by:
getCookieMaxAge
in interfaceio.micronaut.http.cookie.CookieConfiguration
- Returns:
- The max age to use for the cookie
-
setCookieDomain
public void setCookieDomain(@Nullable java.lang.String cookieDomain)
Sets the domain name of this Cookie.- Parameters:
cookieDomain
- the domain name of this Cookie
-
setCookiePath
public void setCookiePath(@Nullable java.lang.String cookiePath)
Sets the path of the cookie. Default value ("/".- Parameters:
cookiePath
- The path of the cookie.
-
setCookieHttpOnly
public void setCookieHttpOnly(java.lang.Boolean cookieHttpOnly)
Whether the Cookie can only be accessed via HTTP. Default value (true.- Parameters:
cookieHttpOnly
- Whether the Cookie can only be accessed via HTTP
-
setCookieSecure
public void setCookieSecure(java.lang.Boolean cookieSecure)
Sets whether the cookie is secured. Default value (true.- Parameters:
cookieSecure
- True if the cookie is secure
-
setCookieMaxAge
public void setCookieMaxAge(java.time.Duration cookieMaxAge)
Sets the maximum age of the cookie.- Parameters:
cookieMaxAge
- The maximum age of the cookie
-
-