Class HttpCredential

  • All Implemented Interfaces:
    ConfigurationObject
    Direct Known Subclasses:
    HttpProxy

    public class HttpCredential
    extends java.lang.Object
    implements ConfigurationObject
    Represents a set of credentials to use for an http request. These can be configured in the Configuration yaml file.

    Note: proxies are also HttpCredentials and when searching for credentials, the proxies will also be searched for credentials.

    • Constructor Summary

      Constructors 
      Constructor Description
      HttpCredential()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getUsername()
      Get the username.
      boolean matches​(MatchInfo matchInfo)
      Returns true if this proxy should be used for the provided URI.
      void setMatchers​(java.util.List<? extends URIMatcher> matchers)
      Matchers are used to choose which requests the credentials apply to.
      void setPassword​(java.lang.String password)
      The password for authenticating with the credentials.
      void setUsername​(java.lang.String username)
      The username for authenticating with the credentials.
      org.apache.http.auth.Credentials toCredentials​(org.apache.http.auth.AuthScope authscope)
      Check if this applies to the provided authorization scope and return the credentials for that scope or null if it doesn't apply to the scope.
      void validate​(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
      validate that the configuration was correct.
      • Methods inherited from class java.lang.Object

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

      • HttpCredential

        public HttpCredential()
    • Method Detail

      • setMatchers

        public void setMatchers​(java.util.List<? extends URIMatcher> matchers)
        Matchers are used to choose which requests the credentials apply to.
        Parameters:
        matchers - the matchers to use to determine which requests the credentials can be used for
        See Also:
        URIMatcher, RestrictUrisProcessor
      • getUsername

        protected java.lang.String getUsername()
        Get the username.
      • setUsername

        public void setUsername​(java.lang.String username)
        The username for authenticating with the credentials.

        This is optional

        Parameters:
        username - the username for authenticating with the credentials
      • setPassword

        public void setPassword​(java.lang.String password)
        The password for authenticating with the credentials.

        This is optional

        Parameters:
        password - the password for authenticating with the credentials
      • validate

        public void validate​(java.util.List<java.lang.Throwable> validationErrors,
                             Configuration configuration)
        Description copied from interface: ConfigurationObject
        validate that the configuration was correct.
        Specified by:
        validate in interface ConfigurationObject
        Parameters:
        validationErrors - a list to add any detected errors to.
        configuration - the containing configuration
      • matches

        public boolean matches​(MatchInfo matchInfo)
                        throws java.net.SocketException,
                               java.net.UnknownHostException,
                               java.net.MalformedURLException
        Returns true if this proxy should be used for the provided URI.
        Parameters:
        matchInfo - the information for making the patch
        Throws:
        java.net.SocketException
        java.net.UnknownHostException
        java.net.MalformedURLException
      • toCredentials

        @Nullable
        public final org.apache.http.auth.Credentials toCredentials​(org.apache.http.auth.AuthScope authscope)
        Check if this applies to the provided authorization scope and return the credentials for that scope or null if it doesn't apply to the scope.
        Parameters:
        authscope - the scope to test against.