Class UsernamePassword

  • All Implemented Interfaces:
    CredentialsBuilder

    @ComponentProfile(summary="Providers username+password credentials")
    public class UsernamePassword
    extends java.lang.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.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.http.auth.Credentials build()
      Build the Credentials object.
      java.lang.String getPassword()
      The password.
      java.lang.String getUsername()
      The username.
      void setPassword​(java.lang.String password)
      The password.
      void setUsername​(java.lang.String username)
      The username.
      UsernamePassword withCredentials​(java.lang.String user, java.lang.String password)  
      • Methods inherited from class java.lang.Object

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

      • UsernamePassword

        public UsernamePassword()
    • Method Detail

      • withCredentials

        public UsernamePassword withCredentials​(java.lang.String user,
                                                java.lang.String password)
      • getUsername

        public java.lang.String getUsername()
        The username.
      • setUsername

        public void setUsername​(java.lang.String username)
        The username.
      • getPassword

        public java.lang.String getPassword()
        The password.

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

      • setPassword

        public void setPassword​(java.lang.String password)
        The password.

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