Class BasicAuthorizationInterceptor
- java.lang.Object
- org.springframework.http.client.support.BasicAuthorizationInterceptor
- All Implemented Interfaces:
ClientHttpRequestInterceptor
@Deprecated public class BasicAuthorizationInterceptor extends Object implements ClientHttpRequestInterceptor
Deprecated.as of 5.1.1, in favor ofBasicAuthenticationInterceptor
which reusesHttpHeaders.setBasicAuth(java.lang.String, java.lang.String)
, sharing its default charset ISO-8859-1 instead of UTF-8 as used hereClientHttpRequestInterceptor
to apply a BASIC authorization header.- Since:
- 4.3.1
- Author:
- Phillip Webb
Constructor Summary
Constructors Constructor Description BasicAuthorizationInterceptor(String username, String password)
Deprecated.Create a new interceptor which adds a BASIC authorization header for the given username and password.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ClientHttpResponse
intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
Deprecated.Intercept the given request, and return a response.
Constructor Detail
BasicAuthorizationInterceptor
public BasicAuthorizationInterceptor(@Nullable String username, @Nullable String password)
Deprecated.Create a new interceptor which adds a BASIC authorization header for the given username and password.- Parameters:
username
- the username to usepassword
- the password to use
Method Detail
intercept
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException
Deprecated.Description copied from interface:ClientHttpRequestInterceptor
Intercept the given request, and return a response. The givenClientHttpRequestExecution
allows the interceptor to pass on the request and response to the next entity in the chain.A typical implementation of this method would follow the following pattern:
- Examine the request and body
- Optionally wrap the request to filter HTTP attributes.
- Optionally modify the body of the request.
- Either
- execute the request using
ClientHttpRequestExecution.execute(org.springframework.http.HttpRequest, byte[])
, or - do not execute the request to block the execution altogether.
- execute the request using
- Optionally wrap the response to filter HTTP attributes.
- Specified by:
intercept
in interfaceClientHttpRequestInterceptor
- Parameters:
request
- the request, containing method, URI, and headersbody
- the body of the requestexecution
- the request execution- Returns:
- the response
- Throws:
IOException
- in case of I/O errors