Package fr.paris.lutece.util.signrequest
Class IPAuthentificator
java.lang.Object
fr.paris.lutece.util.signrequest.IPAuthentificator
- All Implemented Interfaces:
RequestAuthenticator
IPAuthentificator is a class that authenticates requests based on the client's IP address.
It can be configured to either allow or block requests from specific IP addresses.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing the mode of operation for the authenticator. -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionGets the list of authorized path exclusions for IP restrictiongetIPs()Gets the list of IP addresses.getMode()Gets the enum value that defines if the IPs in the set will be allowed or denied.getSecurityInformations(List<String> elements) return Security informations to put in the request headers and request parametersbooleanisRequestAuthenticated(jakarta.servlet.http.HttpServletRequest request) Check the Authentication of a requestvoidsetAuthorizedPaths(Set<String> list) Sets the list of authorized path exclusions for IP restrictionvoidSets the list of IP addresses.voidSets the enum value that defines if the IPs in the set will be allowed or denied.
-
Constructor Details
-
IPAuthentificator
public IPAuthentificator() -
IPAuthentificator
-
-
Method Details
-
getIPs
Gets the list of IP addresses.- Returns:
- the list of IP addresses
-
setIPs
Sets the list of IP addresses.- Parameters:
list- The list of IP addresses
-
setAuthorizedPaths
Sets the list of authorized path exclusions for IP restriction- Parameters:
list- The list of excluded paths
-
getAuthorizedPaths
Gets the list of authorized path exclusions for IP restriction- Returns:
- the list of excluded paths
-
getMode
Gets the enum value that defines if the IPs in the set will be allowed or denied.- Returns:
- the enum case (either ALLOW or BLOCK)
-
setMode
Sets the enum value that defines if the IPs in the set will be allowed or denied.- Parameters:
mode- The enum value of allow or block
-
isRequestAuthenticated
public boolean isRequestAuthenticated(jakarta.servlet.http.HttpServletRequest request) Check the Authentication of a request Authenticates the request based on the client's IP address. (Do not apply IP restriction if the Servlet path starts with one of the authorized path)- Specified by:
isRequestAuthenticatedin interfaceRequestAuthenticator- Parameters:
request- The HTTP request to authenticate- Returns:
- true if the request is authenticated, false otherwise
-
getSecurityInformations
return Security informations to put in the request headers and request parameters Gets security information for the request.- Specified by:
getSecurityInformationsin interfaceRequestAuthenticator- Parameters:
elements- The list of elements to include in the security information- Returns:
- An instance of AuthenticateRequestInformations containing the security information
-