Class InetAddressMatchers.Builder
java.lang.Object
org.springframework.security.web.util.matcher.InetAddressMatchers.Builder
- Enclosing class:
InetAddressMatchers
A builder for constructing
InetAddressMatcher instances with various
matching rules.- Since:
- 7.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the configuredInetAddressMatcher.excludeAddresses(List<String> addresses) Adds an exclude list matcher that blocks the specified addresses.includeAddresses(List<String> addresses) Adds an include list matcher that permits only the specified addresses.matchAll(InetAddressMatcher... matchers) Adds custom matchers to the matcher chain.Configures the matcher to operate in report-only mode.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
includeAddresses
Adds an include list matcher that permits only the specified addresses.- Parameters:
addresses- the list of IP address patterns to include (cannot be null or empty)- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if addresses is null or empty
-
excludeAddresses
Adds an exclude list matcher that blocks the specified addresses.- Parameters:
addresses- the list of IP address patterns to exclude (cannot be null or empty)- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if addresses is null or empty
-
matchAll
Adds custom matchers to the matcher chain. All matchers must match for an address to be permitted.- Parameters:
matchers- the customInetAddressMatcherinstances to add (cannot be null or empty)- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if matchers is null or empty
-
reportOnly
Configures the matcher to operate in report-only mode. In this mode, matching logic is evaluated and logged, but all addresses are allowed regardless of match results.- Returns:
- this builder for method chaining
-
build
Builds the configuredInetAddressMatcher.- Returns:
- the constructed
InetAddressMatcher
-