Hello,

Me and a colleague have developed a forgotten password Java application.
We are attempting to read the users password policy through REST. The
code is the following:


Code:
--------------------

public JSONArray getPasswordPolicy(UserEntity user) {
JSONArray ja = null;
HttpURLConnection connection = null;

try {

URL pwd = new URL(String.format("%s://%s:%s/IDM/roa/v1/pwdmgt/user/%s/password",Config.restProtocol, Config.restHost,Config.restPort, user.getDN()));
connection = (HttpURLConnection) pwd.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Keep-Alive", "300");
connection.setRequestProperty("Connection", "keep-alive");
connection.setRequestProperty("Cache-Control", "no-cache");
connection.setRequestProperty("Accept-Language", "en");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("RESTAuthorization", user.getB64String());

connection.setDoInput(true);
connection.setDoOutput(false);
connection.setUseCaches(false);
connection.connect();

BufferedReader input = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));

String str;
while (null != ((str = input.readLine()))) {
try {

ja = new JSONArray(str);
} catch (JSONException e) {
e.printStackTrace();
}
}

} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (connection != null) {
connection.disconnect();
}
}
System.out.println(ja);
return ja;
}

--------------------


The URL for the password for the user is:
http://IP:8180/IDM/roa/v1/pwdmgt/use...=test/password

But through code, and also through the browser we get this error:

[{"error_message":"Service not authorized."}]

I don't see anywhere in the documentation that anything has to be
changed in the RIS.war or anywhere else, for this to be possible. I get
the same error if I visit /hint or anything else that you can get
through REST.

Any ideas?

Thanks in advance,

Jacob.


--
jacmarpet
------------------------------------------------------------------------
jacmarpet's Profile: https://forums.netiq.com/member.php?userid=415
View this thread: https://forums.netiq.com/showthread.php?t=53911