I am trying to do non-preemptive authentication (get 401-unauthorized with request round trip) with Jetty client. But I'm unable to get request round trip after using below code snippet.
AuthenticationStore authStore = client.getAuthenticationStore();
if(config.getIdentityResource() != null){
Authentication basicAuthentication = new BasicAuthentication(uri, uri+"" , (getCredentials(config))[0], getCredentials(config)[1]);
if(config.isUseNonPreemptiveAuth())
{
authStore.addAuthentication(basicAuthentication);
}
else if (config.isAuthEnabled() && !config.isUseNonPreemptiveAuth())
{
authStore.addAuthenticationResult(new BasicAuthentication.BasicResult(uri, (getCredentials(config))[0], getCredentials(config)[1]));
}
}
I'm using jetty-client-9.4.51 jars. Did I miss something in the above code snippet or any Jetty specific property?
I'm expecting to see round trip request based on Jetty documentation as mentioned in text.