Class ConfigurationInterceptUrlMapRule
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,SecurityRule<io.micronaut.http.HttpRequest<?>>
SecurityConfiguration.getInterceptUrlMap().- Since:
- 1.0
- Author:
- Sergio del Amo
-
Field Summary
FieldsFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface io.micronaut.security.rules.SecurityRule
DENY_ALL, IS_ANONYMOUS, IS_AUTHENTICATED -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationInterceptUrlMapRule(RolesFinder rolesFinder, SecurityConfiguration securityConfiguration, InterceptUrlPatternModifier interceptUrlPatternModifier) Deprecated, for removal: This API element is subject to removal in a future version.ConfigurationInterceptUrlMapRule(RolesFinder rolesFinder, SecurityConfiguration securityConfiguration, InterceptUrlPatternModifier interceptUrlPatternModifier, @Nullable io.micronaut.http.context.ServerContextPathProvider serverContextPathProvider) -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) If no configured pattern matches the request, returnSecurityRuleResult.UNKNOWN.intgetOrder()protected List<InterceptUrlMapPattern> Provides a list ofInterceptUrlMapPatternwhich will be used to provideSecurityRule.protected booleanmatchesPath(@NonNull String pattern, @NonNull String path) Whether a configured pattern matches a request path.Methods inherited from class io.micronaut.security.rules.AbstractSecurityRule
compareRoles, getRoles
-
Field Details
-
ORDER
The order of the rule.
-
-
Constructor Details
-
ConfigurationInterceptUrlMapRule
@Deprecated(forRemoval=true, since="4.18.2") public ConfigurationInterceptUrlMapRule(RolesFinder rolesFinder, SecurityConfiguration securityConfiguration, InterceptUrlPatternModifier interceptUrlPatternModifier) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
rolesFinder- Roles ParsersecurityConfiguration- The Security ConfigurationinterceptUrlPatternModifier- InterceptURLMap modifier
-
ConfigurationInterceptUrlMapRule
@Inject public ConfigurationInterceptUrlMapRule(RolesFinder rolesFinder, SecurityConfiguration securityConfiguration, InterceptUrlPatternModifier interceptUrlPatternModifier, @Nullable @Nullable io.micronaut.http.context.ServerContextPathProvider serverContextPathProvider) - Parameters:
rolesFinder- Roles ParsersecurityConfiguration- The Security ConfigurationinterceptUrlPatternModifier- InterceptURLMap modifierserverContextPathProvider- Server context path provider- Since:
- 4.18.2
-
-
Method Details
-
getPatternList
Provides a list ofInterceptUrlMapPatternwhich will be used to provideSecurityRule.- Returns:
- List of
InterceptUrlMapPattern
-
getOrder
public int getOrder() -
matchesPath
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 (
/contextor/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 patternpath- 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, returnSecurityRuleResult.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
@Getmethod is additionally subject to the patterns restricted to GET, unless a pattern restricted to HEAD matches, because the@Getmethod 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@Headmethod is matched like any other request: by the patterns restricted to HEAD, then by the patterns without a method.- Parameters:
request- The current requestauthentication- The user authentication. Null if not authenticated- Returns:
- The result
- See Also:
-
ConfigurationInterceptUrlMapRule(RolesFinder, SecurityConfiguration, InterceptUrlPatternModifier, ServerContextPathProvider)instead.