Class BasicAuthentication (1.45.0)

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).

Inheritance

java.lang.Object > BasicAuthentication

Constructors

BasicAuthentication(String username, String password)

public BasicAuthentication(String username, String password)
Parameters
Name Description
username String
password String

Methods

getPassword()

public String getPassword()

Returns the password.

Returns
Type Description
String

getUsername()

public String getUsername()

Returns the username.

Returns
Type Description
String

initialize(HttpRequest request)

public void initialize(HttpRequest request)

Initializes a request.

Parameter
Name Description
request HttpRequest
Exceptions
Type Description
IOException

intercept(HttpRequest request)

public void intercept(HttpRequest request)

Invoked at the start of HttpRequest#execute() before executing the HTTP request.

Parameter
Name Description
request HttpRequest
Exceptions
Type Description
IOException