Class WebSecurityExpressionRoot
java.lang.Object
org.springframework.security.access.expression.SecurityExpressionRoot
org.springframework.security.web.access.expression.WebSecurityExpressionRoot
- All Implemented Interfaces:
SecurityExpressionOperations
- Since:
- 3.0
-
Field Summary
Modifier and TypeFieldDescriptionfinal jakarta.servlet.http.HttpServletRequest
Allows direct access to the request object -
Constructor Summary
ConstructorDescriptionWebSecurityExpressionRoot
(Supplier<Authentication> authentication, jakarta.servlet.http.HttpServletRequest request) -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasIpAddress
(String ipAddress) Takes a specific IP address or a range using the IP/Netmask (e.g.Methods inherited from class org.springframework.security.access.expression.SecurityExpressionRoot
denyAll, getAuthentication, getPrincipal, hasAnyAuthority, hasAnyRole, hasAuthority, hasPermission, hasPermission, hasRole, isAnonymous, isAuthenticated, isFullyAuthenticated, isRememberMe, permitAll, setDefaultRolePrefix, setPermissionEvaluator, setRoleHierarchy, setTrustResolver
-
Field Details
-
request
public final jakarta.servlet.http.HttpServletRequest requestAllows direct access to the request object
-
-
Constructor Details
-
WebSecurityExpressionRoot
-
WebSecurityExpressionRoot
public WebSecurityExpressionRoot(Supplier<Authentication> authentication, jakarta.servlet.http.HttpServletRequest request) - Parameters:
authentication
- theSupplier
of theAuthentication
to userequest
- theHttpServletRequest
to use- Since:
- 5.8
-
-
Method Details
-
hasIpAddress
Takes a specific IP address or a range using the IP/Netmask (e.g. 192.168.1.0/24 or 202.24.0.0/14).- Parameters:
ipAddress
- the address or range of addresses from which the request must come.- Returns:
- true if the IP address of the current request is in the required range.
-