Class HttpCredential

java.lang.Object
org.mapfish.print.http.HttpCredential
All Implemented Interfaces:
ConfigurationObject
Direct Known Subclasses:
HttpProxy

public class HttpCredential extends 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 Details

    • HttpCredential

      public HttpCredential()
  • Method Details

    • setMatchers

      public void setMatchers(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:
    • getUsername

      protected String getUsername()
      Get the username.
    • setUsername

      public void setUsername(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(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(List<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 SocketException, UnknownHostException, MalformedURLException
      Returns true if this proxy should be used for the provided URI.
      Parameters:
      matchInfo - the information for making the patch
      Throws:
      SocketException
      UnknownHostException
      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.