Hi,
You can use the InfoMap capability in ISAM to send back the username to the HTML as a MACRO. You can create an InfoMap authentication policy which will return your HTML page after processing some JavaScript (mapping rule). Inside this mapping rule, you can get the username from the session and populate it in the HTML MACRO before returning the page. The value will then be available in the HTML MACRO once the page is loaded. You can then use javascript to get its value and insert it in the API call.
//Getting username from session inside infomap:
var username = context.get(Scope.SESSION, "urn:ibm:security:asf:response:token:attributes", "username");
//Populating macro
macros.put("@USERNAME@", username);
//Returning the HTML page
page.setValue("/authsvc/authenticator/<custom_infomap>/myPage.html");
Also, remember to set success value to false in the mapping rule as shown below because this page is never used for actual authentication..
//Setting success value in infomap mapping rule
success.setValue(false);
Hope it helps,
Regards,
------------------------------
Jahanzaib Sarwar
------------------------------
Original Message:
Sent: Wed October 30, 2019 02:07 PM
From: David Vicenteño
Subject: How HTML page can get the user id from ISAM session
Hi, I developed an Authentication policy in the ISAM AAC to get called by an API call, The data it receives as input ia a username and it returns the user groups and some html links. I'm coding an html page hosted by the Reverse Proxy , it can use javascript to call the API but the problem is how HTML page can get the user id from ISAM session and use that data as API call input. Any idea? Thanks in advance.
------------------------------
David Vicenteño
------------------------------