Hi Mukesh,
When the authentication service returns a page to a user, it will look for .json version of the page if you are connecting to the /apiauthsvc endpoint. If not found then it will use a default JSON response layout. So, it is possible to customize the pages returned by the password mechanism by creating a custom template page.
For example, to modify the JSON response for the password mechanism you could create this template page:
…/authsvc/authenticator/password/login.json
In this page you can use template scripting to modify the content (and set response code) based on logic you add. Here's an example login.json:
<%
templateContext.response.setStatus(401);
var errorMsg = templateContext.macros["@ERROR_MESSAGE@"];
if (errorMsg == "") {
output = "\"message\" : \"Provide username and password\"";
} else {
output = "\"error_message\" : \"" + errorMsg + "\"";
}
%>
{
<%=output%>,
"location" : "@ACTION@",
"mechanism" : "@MECHANISM_ID@"
}
Jon.
------------------------------
Jon Harry
Consulting IT Security Specialist
IBM
------------------------------