Class IpPatternsRule
java.lang.Object
io.micronaut.security.rules.AbstractSecurityRule<io.micronaut.http.HttpRequest<?>>
io.micronaut.security.rules.IpPatternsRule
- All Implemented Interfaces:
io.micronaut.core.order.Ordered, SecurityRule<io.micronaut.http.HttpRequest<?>>
@Requires(classes=io.micronaut.http.HttpRequest.class)
@Singleton
public class IpPatternsRule
extends AbstractSecurityRule<io.micronaut.http.HttpRequest<?>>
A security rule implementation backed by the
SecurityConfigurationProperties.getIpPatterns() ()}.
Each configured pattern is interpreted in one of two ways:
- A pattern made only of hexadecimal digits, dots, colons and
*(for example127.0.0.1,192.168.1.*orfe80:*) is an IP wildcard: dots and colons match literally, a*inside the pattern matches within one address segment and a trailing*matches the rest of the address.192.168.1.*therefore matches192.168.1.0to192.168.1.255only, and not192.168.10.5;192.168.*.1matches192.168.2.1but not192.168.2.3.1. Hexadecimal digits match regardless of case. - Any other pattern (for example
192\.168\.1\.\d+), including one starting with a dot such as.*, is compiled as a regular expression and must match the whole host address.
- 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 SecurityRule
DENY_ALL, IS_ANONYMOUS, IS_AUTHENTICATED -
Constructor Summary
ConstructorsConstructorDescriptionIpPatternsRule(RolesFinder rolesFinder, SecurityConfiguration securityConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) Returns a publisher that is required to emit a single security result based on any conditions.intgetOrder()Methods inherited from class AbstractSecurityRule
compareRoles, getRoles
-
Field Details
-
ORDER
The order of the rule.
-
-
Constructor Details
-
IpPatternsRule
- Parameters:
rolesFinder- Roles ParsersecurityConfiguration- Security Configuration
-
-
Method Details
-
getOrder
public int getOrder() -
check
public org.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) Description copied from interface:SecurityRuleReturns a publisher that is required to emit a single security result based on any conditions.- Parameters:
request- The current requestauthentication- The user authentication. Null if not authenticated- Returns:
- The result
- See Also:
-