ClientHttpRequestInterceptor to apply a given HTTP Basic Authentication
username/password pair, unless a custom Authorization header has
already been set.
HttpHeaders#setBasicAuth, HttpHeaders#AUTHORIZATION
| Modifier and Type | Field and Description |
|---|---|
| private final String |
| Access | Constructor and Description |
|---|---|
| public | BasicAuthenticationInterceptor(String
the username to use username, String the password to use password)Create a new interceptor which adds Basic Authentication for the given username and password. |
| public | BasicAuthenticationInterceptor(String
the username to use username, String the password to use password, Charset the charset to use charset)Create a new interceptor which adds Basic Authentication for the given username and password, encoded using the specified charset. |
| Modifier and Type | Method and Description |
|---|---|
| public ClientHttpResponse | intercept(HttpRequest
the request, containing method, URI, and headers request, byte[] the body of the request body, ClientHttpRequestExecution the request execution execution)Implements org. Intercept the given request, and return a response. |
| encodedCredentials | back to summary |
|---|---|
| private final String encodedCredentials | |
| BasicAuthenticationInterceptor | back to summary |
|---|---|
| public BasicAuthenticationInterceptor(String username, String password) Create a new interceptor which adds Basic Authentication for the given username and password. | |
| BasicAuthenticationInterceptor | back to summary |
|---|---|
| public BasicAuthenticationInterceptor(String username, String password, Charset charset) Create a new interceptor which adds Basic Authentication for the given username and password, encoded using the specified charset. | |
| intercept | back to summary |
|---|---|
| public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException Implements org. Doc from org. Intercept the given request, and return a response. The given
A typical implementation of this method would follow the following pattern:
Note if the interceptor throws an exception after receiving a response,
it must close the response via
| |