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

  • 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()
    • matchesPath

      protected boolean matchesPath(@NonNull @NonNull String pattern, @NonNull @NonNull String path)
      Whether a configured pattern matches a request path.

      Subclasses may override this method to accept additional paths for a pattern, for example to match requests for the server context root as the root path.

      Requests for the context root (/context or /context/) are the application's root route. They are matched as the root path / is matched when no context path is set, so that patterns such as /context/ (what the root pattern / becomes once the context path is prepended) and /context/* apply to them.

      Parameters:
      pattern - The configured Ant-style pattern
      path - The request path
      Returns:
      Whether the pattern matches the path
    • check

      public org.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable @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.

      Patterns restricted to the request method take precedence over patterns without a method. A HEAD request matched to the implicit HEAD route the router derives from a @Get method is additionally subject to the patterns restricted to GET, unless a pattern restricted to HEAD matches, because the @Get method answers it. Likewise, a request that no route matches is subject to the patterns restricted to GET whatever its method, because static resources are served for any method when no route matches. A HEAD request matched to an explicitly declared @Head method is matched like any other request: by the patterns restricted to HEAD, then by the patterns without a method.

      Parameters:
      request - The current request
      authentication - The user authentication. Null if not authenticated
      Returns:
      The result
      See Also: