Hello,

I have a question.

I don't want to check the users defined in the Syncope. What I need to check is 
the administrator.

I need to check if user uses correct administrator username and password to 
access the rest API like http://localhost:9080/syncope/cxf/users .



Now I uses the following code:

Try{

                String url="http://localhost:9080/syncope/cxf";;

          String name="admin";

         String password="password";

           WebClient client = WebClient.create(url, 
Collections.singletonList(new JacksonJsonProvider()));

            String authorizationHeader = "Basic " + 
Base64Utility.encode((name+":"+password).getBytes());

            client.header("Authorization", authorizationHeader);



            client = client.path("/users/count");


    // throw exception here if url or name or pwd is wrong.
        client.accept("application/json").get(Integer.class);

} catch (ServerWebApplicationException e) {
            if (401 == e.getStatus()) {
                rc.setMessage("Username or password is not correct");
                rc.setOk(false);
           } else {
                rc.setMessage(e.getMessage());
                rc.setOk(false);
            }
} catch (ClientWebApplicationException e) {
            rc.setMessage(e.getMessage());
            rc.setOk(false);

}



is there a special url to access, for example 
http://localhost:9080/syncope/cxf/authentication, and  response with full 
information?

Now to access /users/count is workaround.





Could you help me?



Really thanks!


Thanks and Regards!

--
Jill Yan
ESB team web developer
Skype: yanzhiying.talendbj
Email: [email protected]<mailto:[email protected]>

Reply via email to