public final class BasicAuthentication implements HttpRequestInitializer, HttpExecuteInterceptor
Basic authentication HTTP request initializer as specified in Basic Authentication Scheme
Implementation is immutable and thread-safe. It can be used as either an HTTP request initializer or an HTTP request execute interceptor. #initialize(HttpRequest) only sets itself as the interceptor. Authentication is actually done in #intercept(HttpRequest), which is implemented using HttpHeaders#setBasicAuthentication(String, String).
Constructors
BasicAuthentication(String username, String password)
public BasicAuthentication(String username, String password)
Name | Description |
username | String |
password | String |
Methods
getPassword()
public String getPassword()
Returns the password.
Type | Description |
String |
getUsername()
public String getUsername()
Returns the username.
Type | Description |
String |
initialize(HttpRequest request)
public void initialize(HttpRequest request)
Initializes a request.
Name | Description |
request | HttpRequest |
Type | Description |
IOException |
intercept(HttpRequest request)
public void intercept(HttpRequest request)
Invoked at the start of HttpRequest#execute() before executing the HTTP request.
Name | Description |
request | HttpRequest |
Type | Description |
IOException |