Tagged: #OpenAM, Attribute mapping, http header, webagent
This topic has 1 reply, 2 voices, and was last updated 5 years, 4 months ago by Peter Major.
-
AuthorPosts
-
March 8, 2017 at 10:19 am #16176
aktokas
ParticipantCan anyone help me figure out how to retrieve user profile attributes such as uid/mail or givenName from the HTTP header. I have mapped [uid]=MYuid, [mail]=MYmail and [givenName]=MYgivenName in profile attribute map and i am using profile attribute fetch mode as HTTP HEADER.
When i try to fetch the header in the protected URL using following script :
var req = new XMLHttpRequest();
req.open(‘GET’, document.location, false);
req.send(null);
var headers = req.getAllResponseHeaders().toLowerCase();i get following in header :
accept-ranges: bytes content-type: text/html etag: “25a-54a33bb6af576” last-modified: wed, 08 mar 2017 08:15:31 gmt content-length: 602 date: wed, 08 mar 2017 08:15:34 gmt server: apache/2.4.25 (win64) openam web agent/4.0.0Can anyone guide me how to fetch the desired attributes(mail/uid/name) from the header to be displayed on the protected Webpage???
Thanks in Advance
AkshayMarch 8, 2017 at 1:28 pm #16184Peter Major
ModeratorThe headers are only injected on the server side and even then they are injected into the request headers. If you want to access user information using Javascript, you will either need to use HTTP_COOKIE mapping, or implement a REST endpoint (or something to that end) that returns the user details as part of the response body – the endpoint could simply just grab the data from request headers and then put them on the response body.
-
AuthorPosts
You must be logged in to reply to this topic.