org.springframework.http.client.support

## Class BasicAuthorizationInterceptor

- java.lang.Object
- - org.springframework.http.client.support.BasicAuthorizationInterceptor

- All Implemented Interfaces:
    ClientHttpRequestInterceptor

  Deprecated.
  as of 5.1.1, in favor of `BasicAuthenticationInterceptor` which reuses `HttpHeaders.setBasicAuth(java.lang.String, java.lang.String)`, sharing its default charset ISO-8859-1 instead of UTF-8 as used here

      @Deprecated
      public class BasicAuthorizationInterceptor
      extends Object
      implements ClientHttpRequestInterceptor

  `ClientHttpRequestInterceptor` to apply a BASIC authorization header.
  Since:
    4.3.1
  Author:
    Phillip Webb

- - ### Constructor Summary

    Constructors
    Constructor and 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 and Description
    --- | ---
    `ClientHttpResponse` | `intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)` Deprecated. Intercept the given request, and return a response.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 use
        `password` - 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 given `ClientHttpRequestExecution` 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:

      1. Examine the request and body.
      2. Optionally wrap the request to filter HTTP attributes.
      3. 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.
      4. Optionally wrap the response to filter HTTP attributes.
      Specified by:
        `intercept` in interface `ClientHttpRequestInterceptor`
      Parameters:
        `request` - the request, containing method, URI, and headers
        `body` - the body of the request
        `execution` - the request execution
      Returns:
        the response
      Throws:
        `IOException` - in case of I/O errors