Class 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 Detail

      • 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
    • Constructor Detail

      • JwtCookieConfigurationProperties

        public JwtCookieConfigurationProperties()
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface io.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 interface JwtCookieConfiguration
        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 interface JwtCookieConfiguration
        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 interface JwtCookieConfiguration
        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 interface io.micronaut.http.cookie.CookieConfiguration
        Returns:
        a name for the cookie
      • getCookieDomain

        public java.util.Optional<java.lang.String> getCookieDomain()
        Specified by:
        getCookieDomain in interface io.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 interface io.micronaut.http.cookie.CookieConfiguration
        Returns:
        The path of the cookie.
      • isCookieHttpOnly

        public java.util.Optional<java.lang.Boolean> isCookieHttpOnly()
        Specified by:
        isCookieHttpOnly in interface io.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 interface io.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 interface io.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