Package interlok.http.apache.credentials
Class UsernamePassword
- java.lang.Object
-
- interlok.http.apache.credentials.UsernamePassword
-
- All Implemented Interfaces:
CredentialsBuilder
@ComponentProfile(summary="Providers username+password credentials") public class UsernamePassword extends java.lang.Object implements CredentialsBuilder
Adds support fororg.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 beNotBlank
.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 Summary
Constructors Constructor Description UsernamePassword()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.auth.Credentials
build()
Build theCredentials
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)
-
-
-
Method Detail
-
build
public org.apache.http.auth.Credentials build()
Description copied from interface:CredentialsBuilder
Build theCredentials
object.- Specified by:
build
in interfaceCredentialsBuilder
-
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.
-
-