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 Details

    • DEFAULT_COOKIEPATH

      public static final String DEFAULT_COOKIEPATH
      Default Cookie Path.
      See Also:
    • DEFAULT_COOKIENAME

      public static final String DEFAULT_COOKIENAME
      Cookie name.
      See Also:
    • DEFAULT_REMEMBERME

      public static final boolean DEFAULT_REMEMBERME
      The default remember me value.
      See Also:
    • DEFAULT_BASE64ENCODE

      public static final boolean DEFAULT_BASE64ENCODE
      The 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

      public String getCookieName()
      Specified by:
      getCookieName in interface io.micronaut.http.cookie.CookieConfiguration
      Returns:
      The cookie name to use
    • setCookieName

      public void setCookieName(String cookieName)
      Default value ("SESSION").
      Parameters:
      cookieName - Set the cookie name to use
    • getPrefix

      public Optional<String> getPrefix()
      Returns:
      The prefix to use when serializing session ID
    • setPrefix

      public void setPrefix(String prefix)
      Parameters:
      prefix - Set the prefix to use when serializing session ID
    • getHeaderNames

      public String[] getHeaderNames()
      Returns:
      The header names when using a Header strategy
    • setHeaderNames

      public void setHeaderNames(String[] headerNames)
      Default values (["Authorization-Info", "X-Auth-Token"]).
      Parameters:
      headerNames - Set the header names when using a Header strategy
    • getCookiePath

      public Optional<String> getCookiePath()
      Specified by:
      getCookiePath in interface io.micronaut.http.cookie.CookieConfiguration
      Returns:
      The cookie path to use
    • isCookieHttpOnly

      public Optional<Boolean> isCookieHttpOnly()
      Specified by:
      isCookieHttpOnly in interface io.micronaut.http.cookie.CookieConfiguration
    • setCookiePath

      public void setCookiePath(String cookiePath)
      Parameters:
      cookiePath - Set the cookie path to use. Default value ("/").
    • getDomainName

      public Optional<String> getDomainName()
      Returns:
      The domain name to use for the cookie
    • getCookieDomain

      public Optional<String> getCookieDomain()
      Specified by:
      getCookieDomain in interface io.micronaut.http.cookie.CookieConfiguration
    • setDomainName

      public void setDomainName(String domainName)
      Parameters:
      domainName - Set the domain name to use for the cookie
    • setCookieDomain

      public void setCookieDomain(String cookieDomain)
      Parameters:
      cookieDomain - Set the domain name to use for the cookie
    • getCookieMaxAge

      public Optional<TemporalAmount> getCookieMaxAge()
      Specified by:
      getCookieMaxAge in interface io.micronaut.http.cookie.CookieConfiguration
      Returns:
      The max age to use for the cookie
    • setCookieMaxAge

      public void setCookieMaxAge(TemporalAmount cookieMaxAge)
      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

      public Optional<Boolean> isCookieSecure()
      Specified by:
      isCookieSecure in interface io.micronaut.http.cookie.CookieConfiguration
      Returns:
      Is cookie secure
    • setCookieSecure

      public void setCookieSecure(Boolean cookieSecure)
      Sets the secure status of the cookie. Delegates to HttpRequest.isSecure() if not set.
      Parameters:
      cookieSecure - Whether or not the cookie is secure.
    • getCookieSameSite

      public Optional<io.micronaut.http.cookie.SameSite> getCookieSameSite()
      Specified by:
      getCookieSameSite in interface io.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 this Cookie can be sent along cross-site requests. For more information, please look here
      Parameters:
      sameSite - SameSite value