Class ConfigurationInterceptUrlMapRule

java.lang.Object
io.micronaut.security.rules.AbstractSecurityRule<io.micronaut.http.HttpRequest<?>>
io.micronaut.security.rules.ConfigurationInterceptUrlMapRule
All Implemented Interfaces:
io.micronaut.core.order.Ordered, SecurityRule<io.micronaut.http.HttpRequest<?>>

@Requires(classes=io.micronaut.http.HttpRequest.class) @Requires(beans={RolesFinder.class,SecurityConfiguration.class,InterceptUrlPatternModifier.class}) @Singleton public class ConfigurationInterceptUrlMapRule extends AbstractSecurityRule<io.micronaut.http.HttpRequest<?>>
A security rule implementation backed by the SecurityConfiguration.getInterceptUrlMap().
Since:
1.0
Author:
Sergio del Amo
  • Field Details

    • ORDER

      public static final Integer ORDER
      The order of the rule.
  • Constructor Details

    • ConfigurationInterceptUrlMapRule

      public ConfigurationInterceptUrlMapRule(RolesFinder rolesFinder, SecurityConfiguration securityConfiguration, InterceptUrlPatternModifier interceptUrlPatternModifier)
      Parameters:
      rolesFinder - Roles Parser
      securityConfiguration - The Security Configuration
      interceptUrlPatternModifier - InterceptURLMap modifier
  • Method Details

    • getPatternList

      protected List<InterceptUrlMapPattern> getPatternList()
      Provides a list of InterceptUrlMapPattern which will be used to provide SecurityRule.
      Returns:
      List of InterceptUrlMapPattern
    • getOrder

      public int getOrder()
    • isAnonymous

      @Internal public boolean isAnonymous(io.micronaut.http.HttpRequest<?> request)
      Whether the first configured pattern that applies to the request allows anonymous access.
      Parameters:
      request - The current request
      Returns:
      Whether authentication resolution can be skipped for the request
      Since:
      5.4.0
    • check

      public org.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication)
      If no configured pattern matches the request, return SecurityRuleResult.UNKNOWN. Reads the rules in order. The first matched rule will be used for determining authorization.
      Parameters:
      request - The current request
      authentication - The user authentication. Null if not authenticated
      Returns:
      The result
      See Also:
    • findPattern

      protected Optional<InterceptUrlMapPattern> findPattern(io.micronaut.http.HttpRequest<?> request)
      Finds the first configured pattern that applies to the request, using the same method-specific precedence as SecurityRule.check(HttpRequest, Authentication).
      Parameters:
      request - The current request
      Returns:
      The matching pattern, if any