Class SecurityConfigurationProperties

java.lang.Object
io.micronaut.security.config.SecurityConfigurationProperties
All Implemented Interfaces:
io.micronaut.core.util.Toggleable, AuthenticationModeConfiguration, SecurityConfiguration

@ConfigurationProperties("micronaut.security") public class SecurityConfigurationProperties extends Object implements SecurityConfiguration
Stores configuration for JWT.
Since:
1.0
Author:
Sergio del Amo
  • Field Details

    • PREFIX

      public static final String PREFIX
      See Also:
    • ANYWHERE

      public static final String ANYWHERE
      See Also:
    • DEFAULT_ENABLED

      public static final boolean DEFAULT_ENABLED
      The default enable value.
      See Also:
    • DEFAULT_INTERCEPT_URL_MAP_PREPEND_PATTERN_WITH_CONTEXT_PATH

      public static final boolean DEFAULT_INTERCEPT_URL_MAP_PREPEND_PATTERN_WITH_CONTEXT_PATH
      The default value whether intercept url patterns should be prepended with the context path.
      See Also:
    • DEFAULT_AUTHENTICATION_STRATEGY

      public static final AuthenticationStrategy DEFAULT_AUTHENTICATION_STRATEGY
      The default enable value.
    • DEFAULT_REJECT_NOT_FOUND

      public static final boolean DEFAULT_REJECT_NOT_FOUND
      The default reject-not-found value.
      See Also:
  • Constructor Details

    • SecurityConfigurationProperties

      public SecurityConfigurationProperties()
  • Method Details

    • getAuthentication

      @Nullable public @Nullable AuthenticationMode getAuthentication()
      Specified by:
      getAuthentication in interface AuthenticationModeConfiguration
      Returns:
      Authentication Model to use
    • setAuthentication

      public void setAuthentication(@Nullable @Nullable AuthenticationMode authentication)
      Defines which authentication to use. Defaults to null. Possible values bearer, session, cookie, idtoken. Should only be supplied if the service handles login and logout requests.
      Parameters:
      authentication - Login Handler Mode
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface io.micronaut.core.util.Toggleable
    • getInterceptUrlMap

      public List<InterceptUrlMapPattern> getInterceptUrlMap()
      Specified by:
      getInterceptUrlMap in interface SecurityConfiguration
      Returns:
      a list of InterceptUrlMapPattern
    • getIpPatterns

      public List<String> getIpPatterns()
      Specified by:
      getIpPatterns in interface SecurityConfiguration
      Returns:
      a list of IP Regex patterns. e.g. [192.168.1.*]
    • setEnabled

      public void setEnabled(boolean enabled)
      If Security is enabled. Default value true
      Parameters:
      enabled - True if security is enabled
    • isInterceptUrlMapPrependPatternWithContextPath

      public boolean isInterceptUrlMapPrependPatternWithContextPath()
      Specified by:
      isInterceptUrlMapPrependPatternWithContextPath in interface SecurityConfiguration
      Returns:
      Whether the intercept URL patterns should be prepended with context path if defined.
    • setInterceptUrlMapPrependPatternWithContextPath

      public void setInterceptUrlMapPrependPatternWithContextPath(boolean interceptUrlMapPrependPatternWithContextPath)
      Whether the intercept URL patterns should be prepended with context path if defined. Defaults to true.
      Parameters:
      interceptUrlMapPrependPatternWithContextPath - Prepend Intercept URL Map pattern with context path
    • setInterceptUrlMap

      public void setInterceptUrlMap(List<InterceptUrlMapPattern> interceptUrlMap)
      Map that defines the interception patterns.
      Parameters:
      interceptUrlMap - The intercept urls maps
    • setIpPatterns

      public void setIpPatterns(List<String> ipPatterns)
      Allowed IP patterns. Default value (["0.0.0.0"])
      Parameters:
      ipPatterns - The IP patterns
    • getAuthenticationProviderStrategy

      public AuthenticationStrategy getAuthenticationProviderStrategy()
      Specified by:
      getAuthenticationProviderStrategy in interface SecurityConfiguration
      Returns:
      The authentication strategy
    • setAuthenticationProviderStrategy

      public void setAuthenticationProviderStrategy(AuthenticationStrategy authenticationProviderStrategy)
      Determines how authentication providers should be processed. Default value ANY. Possible values: ANY or ALL.
      Parameters:
      authenticationProviderStrategy - authentication strategy.
    • isRejectNotFound

      public boolean isRejectNotFound()
      Description copied from interface: SecurityConfiguration
      For cases where no security rule handles a request and it is determined that the request does not match any routes on the server, whether the response should be to reject the request or allow the not found response to be returned.
      Specified by:
      isRejectNotFound in interface SecurityConfiguration
      Returns:
      True if the response should be rejected.
    • setRejectNotFound

      public void setRejectNotFound(boolean rejectNotFound)
      Parameters:
      rejectNotFound - Whether the server should respond with 401 for requests that do not match any routes on the server, if you set it to false, it will return 404 for requests that do not match any routes on the server. Default value (true).