Class 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 class  IPAuthentificator.MODE
      Enum representing the mode of operation for the authenticator.
    • 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.MODE getMode()
      Gets the enum value that defines if the IPs in the set will be allowed or denied.
      AuthenticateRequestInformations getSecurityInformations​(java.util.List<java.lang.String> elements)
      return Security informations to put in the request headers and request parameters
      boolean isRequestAuthenticated​(javax.servlet.http.HttpServletRequest request)
      Check the Authentication of a request
      void setIPs​(java.util.Set<java.lang.String> list)
      Sets the list of IP addresses.
      void setMode​(IPAuthentificator.MODE mode)
      Sets the enum value that defines if the IPs in the set will be allowed or denied.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IPAuthentificator

        public IPAuthentificator()
    • 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:
        isRequestAuthenticated in interface RequestAuthenticator
        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:
        getSecurityInformations in interface RequestAuthenticator
        Parameters:
        elements - The list of elements to include in the security information
        Returns:
        An instance of AuthenticateRequestInformations containing the security information