Class BasicAuthentication (1.41.8)

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
NameDescription
usernameString
passwordString

Methods

getPassword()

public String getPassword()

Returns the password.

Returns
TypeDescription
String

getUsername()

public String getUsername()

Returns the username.

Returns
TypeDescription
String

initialize(HttpRequest request)

public void initialize(HttpRequest request)

Initializes a request.

Parameter
NameDescription
requestHttpRequest
Exceptions
TypeDescription
IOException

intercept(HttpRequest request)

public void intercept(HttpRequest request)

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

Parameter
NameDescription
requestHttpRequest
Exceptions
TypeDescription
IOException