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.StringDEFAULT_COOKIENAMEThe default cookie name.static java.lang.StringDEFAULT_COOKIEPATHDefault Cookie Path.static booleanDEFAULT_ENABLEDThe default enable value.static booleanDEFAULT_HTTPONLYThe default http only value.static java.lang.StringDEFAULT_LOGINFAILURETARGETURLThe default login failure target URL.static java.lang.StringDEFAULT_LOGINSUCCESSTARGETURLThe default login success target URL.static java.lang.StringDEFAULT_LOGOUTTARGETURLThe default logout target URL.static booleanDEFAULT_SECUREThe default secure value.static java.lang.StringPREFIX
-
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.StringgetCookieName()java.util.Optional<java.lang.String>getCookiePath()java.lang.StringgetLoginFailureTargetUrl()java.lang.StringgetLoginSuccessTargetUrl()java.lang.StringgetLogoutTargetUrl()java.util.Optional<java.lang.Boolean>isCookieHttpOnly()java.util.Optional<java.lang.Boolean>isCookieSecure()booleanisEnabled()voidsetCookieDomain(java.lang.String cookieDomain)Sets the domain name of this Cookie.voidsetCookieHttpOnly(java.lang.Boolean cookieHttpOnly)Whether the Cookie can only be accessed via HTTP.voidsetCookieMaxAge(java.time.Duration cookieMaxAge)Sets the maximum age of the cookie.voidsetCookieName(java.lang.String cookieName)Cookie Name.voidsetCookiePath(java.lang.String cookiePath)Sets the path of the cookie.voidsetCookieSecure(java.lang.Boolean cookieSecure)Sets whether the cookie is secured.voidsetEnabled(boolean enabled)Sets whether JWT cookie based security is enabled.voidsetLoginFailureTargetUrl(java.lang.String loginFailureTargetUrl)Sets the login failure target URL.voidsetLoginSuccessTargetUrl(java.lang.String loginSuccessTargetUrl)Sets the login success target URL.voidsetLogoutTargetUrl(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:
isEnabledin 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:
getLogoutTargetUrlin 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:
getLoginSuccessTargetUrlin 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:
getLoginFailureTargetUrlin 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:
getCookieNamein interfaceio.micronaut.http.cookie.CookieConfiguration- Returns:
- a name for the cookie
-
getCookieDomain
public java.util.Optional<java.lang.String> getCookieDomain()
- Specified by:
getCookieDomainin interfaceio.micronaut.http.cookie.CookieConfiguration- Returns:
- the domain name of this Cookie
-
getCookiePath
@Nullable public java.util.Optional<java.lang.String> getCookiePath()
- Specified by:
getCookiePathin interfaceio.micronaut.http.cookie.CookieConfiguration- Returns:
- The path of the cookie.
-
isCookieHttpOnly
public java.util.Optional<java.lang.Boolean> isCookieHttpOnly()
- Specified by:
isCookieHttpOnlyin 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:
isCookieSecurein interfaceio.micronaut.http.cookie.CookieConfiguration- Returns:
- True if the cookie is secure
-
getCookieMaxAge
public java.util.Optional<java.time.temporal.TemporalAmount> getCookieMaxAge()
- Specified by:
getCookieMaxAgein 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
-
-