I have the following scenario:
Server: Jetty (with configured JAAS)
Client: Jersey invoked via JUnit (via Maven)
I have JAAS set up in the web server
Autorization for JAAS:
String URL_DATA = "http://localhost:9080/foo/auth.html";
Client client = Client.create();
String username = "me";
String password = "me";
client.addFilter(new HTTPBasicAuthFilter(username, password));
// Get the protected web page:
WebResource webResource = client.resource(URL_DATA);
String response = webResource.get(String.class);
System.out.println(response);