Hi, I successfully managed to connect to the Java Broker's REST API by Basic Authentication using curl and Jersey framework.
cURL command: curl -v -u admin:admin http://localhost:8080/api/latest/queue/default/default/test.queue Java code: HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("admin", "admin"); Client client = ClientBuilder.newClient(); client.register(feature); client.register(JsonProcessingFeature.class); WebTarget target = client.target(UriBuilder.fromUri("http://localhost/api/latest/queue/default/default/test.queue").port(8080).build()); Response response = target.request(APPLICATION_JSON).post(Entity.json("{}")); But when I try to connect using SASL I always get 401 (Unauthorized) status. cURL command and Java code used for SASL connection below. cURL command: curl -v --digest -u admin:admin http://localhost:8080/api/latest/queue/default/default/test.queue Java code: HttpAuthenticationFeature feature = HttpAuthenticationFeature.digest("admin", "admin"); Client client = ClientBuilder.newClient(); client.register(feature); client.register(JsonProcessingFeature.class); WebTarget target = client.target(UriBuilder.fromUri("http://localhost/api/latest/queue/default/default/test.queue").port(8080).build()); Response response = target.request(APPLICATION_JSON).post(Entity.json("{}")); I also tried to use HttpAuthenticationFeature feature = HttpAuthenticationFeature.universal("admin", "admin"); with no success (401 status). Am I doing something wrong? Vavricka -- View this message in context: http://qpid.2158936.n2.nabble.com/Java-Broker-SASL-connection-to-REST-API-tp7659042.html Sent from the Apache Qpid users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
