On 03/04/2013 10:16, ZhiYing Yan wrote: > > 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? >
Let me check if I've understood your question: do you want to check if the authenticated user corresponds to the admin user configured under core/src/main/resources/security.properties? -- Francesco Chicchiriccò ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member http://people.apache.org/~ilgrosso/
