Class UsernamePassword

java.lang.Object
interlok.http.apache.credentials.UsernamePassword
All Implemented Interfaces:
CredentialsBuilder

@ComponentProfile(summary="Providers username+password credentials") public class UsernamePassword extends Object implements CredentialsBuilder
Adds support for org.apache.http.client.CredentialsProvider for username and password in a configuration friendly way.

This builds a UsernamePasswordCredentials under the covers, interestingly it allows you to have a non null blank username; there should be no reason why you would want to do that, so validation on the username field is set to be NotBlank.

In the adapter configuration file this class is aliased as apache-http-username-password-credentials which is the preferred alternative to the fully qualified classname when building your configuration.

  • Constructor Details

    • UsernamePassword

      public UsernamePassword()
  • Method Details

    • build

      public org.apache.http.auth.Credentials build()
      Description copied from interface: CredentialsBuilder
      Build the Credentials object.
      Specified by:
      build in interface CredentialsBuilder
    • withCredentials

      public UsernamePassword withCredentials(String user, String password)
    • getUsername

      public String getUsername()
      The username.
    • setUsername

      public void setUsername(String username)
      The username.
    • getPassword

      public String getPassword()
      The password.

      The password may be encoded and/or resolved from system properties / environment variables.

    • setPassword

      public void setPassword(String password)
      The password.

      The password may be encoded and/or resolved from system properties / environment variables.