esendex.sdk.java.service.auth.BasicAuthenticator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.everit.osgi.bundles.com.esendex.javasdk Show documentation
Show all versions of org.everit.osgi.bundles.com.esendex.javasdk Show documentation
The Esendex Java SDK is an easy to use client for our REST API that you can use to integrate SMS and Voice messaging into your Java application.
The newest version!
package esendex.sdk.java.service.auth;
/**
* A (RFC2617) Basic authenticator that writes out the Http header to
* authenticate a request with the UserPassword credentials provided.
* Each request will contain the user and password credentials
* encoded in Base64
* @author Mike Whittaker
*/
public class BasicAuthenticator extends AbstractAuthenticator {
/**
* Create an authenticator for basic authentication with the supplied
* credentials.
* @param userPassword the credentials
*/
public BasicAuthenticator(UserPassword userPassword) {
super(userPassword);
}
/**
* Gets the credentials.
* @return the credentials {@inheritDoc}
*/
@Override
public String getCredentials() {
UserPassword userPassword = getUserPassword();
return userPassword.getUser() + ":" + userPassword.getPassword();
}
}