Package fr.paris.lutece.util.signrequest
Class IPAuthentificator
- java.lang.Object
-
- fr.paris.lutece.util.signrequest.IPAuthentificator
-
- All Implemented Interfaces:
RequestAuthenticator
public class IPAuthentificator extends java.lang.Object implements 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 Classes Modifier and Type Class Description static classIPAuthentificator.MODEEnum representing the mode of operation for the authenticator.
-
Constructor Summary
Constructors Constructor Description IPAuthentificator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>getIPs()Gets the list of IP addresses.IPAuthentificator.MODEgetMode()Gets the enum value that defines if the IPs in the set will be allowed or denied.AuthenticateRequestInformationsgetSecurityInformations(java.util.List<java.lang.String> elements)return Security informations to put in the request headers and request parametersbooleanisRequestAuthenticated(javax.servlet.http.HttpServletRequest request)Check the Authentication of a requestvoidsetIPs(java.util.Set<java.lang.String> list)Sets the list of IP addresses.voidsetMode(IPAuthentificator.MODE mode)Sets the enum value that defines if the IPs in the set will be allowed or denied.
-
-
-
Method Detail
-
getIPs
public java.util.Set<java.lang.String> getIPs()
Gets the list of IP addresses.- Returns:
- the list of IP addresses
-
setIPs
public void setIPs(java.util.Set<java.lang.String> list)
Sets the list of IP addresses.- Parameters:
list- The list of IP addresses
-
getMode
public IPAuthentificator.MODE 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
public void setMode(IPAuthentificator.MODE mode)
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(javax.servlet.http.HttpServletRequest request)
Check the Authentication of a request Authenticates the request based on the client's IP address.- Specified by:
isRequestAuthenticatedin interfaceRequestAuthenticator- Parameters:
request- The HTTP request to authenticate- Returns:
- true if the request is authenticated, false otherwise
-
getSecurityInformations
public AuthenticateRequestInformations getSecurityInformations(java.util.List<java.lang.String> elements)
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
-
-