public void authPullByWwwAuthenticate(String wwwAuthenticate) throws RegistryException {
    Optional<RegistryAuthenticator> authenticator =
        RegistryAuthenticator.fromAuthenticationMethod(
            wwwAuthenticate, registryEndpointRequestProperties, getUserAgent(), httpClient);
    if (authenticator.isPresent()) {
      doBearerAuth(true, authenticator.get());
    } else if (credential != null && !credential.isOAuth2RefreshToken()) {
      configureBasicAuth();
    }
  }
Configure basic authentication or attempts bearer authentication for pulling based on the
specified authentication method in a server response.

@param wwwAuthenticate {@code WWW-Authenticate} HTTP header value from a server response
    specifying a required authentication method
@throws RegistryException if communicating with the endpoint fails
@throws RegistryAuthenticationFailedException if authentication fails
@throws RegistryCredentialsNotSentException if authentication failed and credentials were not
jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryClient.java