AnsweredAssumed Answered

Activiti REST API

Question asked by ncoonghe on Sep 24, 2015
Latest reply on Sep 25, 2015 by ncoonghe
Hi I have deployed the REST war file and using the default users created by the deployment

I am unable to login. I tried putting the url on the Browser I got the user/password prompt for basic authentication I entered the correct credential as in the DB, but it wouldnt authenticate me

Also I tried using JAX-RS REST API to authenticate but it gives be a 401

java.lang.RuntimeException: Failed : HTTP error code : 401
   at TestClient.main(TestClient.java:20)




Below is the code
public static void main(String args[]) {
   
    try {
     
      Client client = ClientBuilder.newBuilder().property("authentication.mode", "Basic").property("username", "kermit").property("password", "kermit").build();
     // .property("authentication.mode", "Basic").property("username", "kermit").property("password", "a2VybWl0");

      WebTarget webResource = client
         .target("http://localhost:8080/activiti-rest/repository/deployments");

     Response response =  webResource.request().accept("application/json").get();
  
      if (response.getStatus() != 200) {
         throw new RuntimeException("Failed : HTTP error code : "
          + response.getStatus());
      }

      String output = (String)response.getEntity();

      System.out.println("Output from Server …. \n");
      System.out.println(output);

    } catch (Exception e) {

      e.printStackTrace();

    }
  }

Outcomes