I have a jersey client code that tries to access glassfish monitoring api, glassfish has secure admin (ssl+basic auth). Glassfish returns "Invalid user name or password" for correct credentials when using authentication.
I can gain access to unsecured glassfish without any problems. I have ssl certificates set up (calling from the same jvm - and handshake passes), and when trying to access resource with a browser - it works.
I am using glassfish 3.1.1 and tried jersey client with both bundled 1.8 and with 1.11 (so both versions where supposedly httpBasicAuth bug is fixed)
my code is:
WebResource resource = restClient.resource(uri);
if(userName != null || password != null){
resource.addFilter(new HTTPBasicAuthFilter(userName, password));
}
ClientResponse result = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
and response is:
{"message":"Invalid user name or password","command":"Error","exit_code":"FAILURE"}
And yes - password, username, url have been checked more than 3 times by more than 3 people.
This question is similiar, but still unanswered: Authentication problem using Jersey and Glassfish