Module bus.http

Interface Authenticator

All Known Implementing Classes:
NetAuthenticator

public interface Authenticator
Responds to authentication challenges from origin web servers or proxies. Implementations may either attempt to authenticate preemptively (before a challenge is received) or reactively (in response to a challenge). An application can supply a single authenticator for both origin and proxy authentication, or separate authenticators for each.
Since:
Java 17+
Author:
Kimi Liu
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Authenticator
    An authenticator that does not attempt to authenticate and always returns null.
  • Method Summary

    Modifier and Type
    Method
    Description
    authenticate(Route route, Response response)
    Returns a request that includes a credential to satisfy an authentication challenge in response.
  • Field Details

    • NONE

      static final Authenticator NONE
      An authenticator that does not attempt to authenticate and always returns null.
  • Method Details

    • authenticate

      Request authenticate(Route route, Response response) throws IOException
      Returns a request that includes a credential to satisfy an authentication challenge in response. Returns null if the challenge cannot be satisfied.

      The route parameter is a best-effort and may not always be provided, especially when an authenticator is invoked manually in an application interceptor (e.g., for client-specific retries).

      Parameters:
      route - The route that resulted in the challenge, or null if not available.
      response - The response containing the authentication challenge.
      Returns:
      A new request with the appropriate authentication header, or null if no response is possible.
      Throws:
      IOException - if an I/O error occurs.