Class BasicAuthenticator

java.lang.Object
org.glassfish.jersey.client.authentication.BasicAuthenticator

final class BasicAuthenticator extends Object
Implementation of Basic Http Authentication method (RFC 2617).
  • Field Details

  • Constructor Details

    • BasicAuthenticator

      BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials)
      Creates a new instance of basic authenticator.
      Parameters:
      defaultCredentials - Credentials. Can be null if no default credentials should be used.
  • Method Details

    • calculateAuthentication

      private String calculateAuthentication(HttpAuthenticationFilter.Credentials credentials)
    • filterRequest

      public void filterRequest(javax.ws.rs.client.ClientRequestContext request) throws RequestAuthenticationException
      Adds authentication information to the request.
      Parameters:
      request - Request context.
      Throws:
      RequestAuthenticationException - in case that basic credentials missing or are in invalid format
    • filterResponseAndAuthenticate

      public boolean filterResponseAndAuthenticate(javax.ws.rs.client.ClientRequestContext request, javax.ws.rs.client.ClientResponseContext response)
      Checks the response and if basic authentication is required then performs a new request with basic authentication.
      Parameters:
      request - Request context.
      response - Response context (will be updated with newest response data if the request was repeated).
      Returns:
      true if response does not require authentication or if authentication is required, new request was done with digest authentication information and authentication was successful.
      Throws:
      ResponseAuthenticationException - in case that basic credentials missing or are in invalid format