Sriks
Sriks

Reputation: 1699

How to read SiteMinder header in Angular 4

I am using SiteMinder for SingleSignOn (SSO) authentication. On Successful authentication how do I read SM_USER header from SiteMinder in my Angular 4 code.

Can someone please help in reading this header value?

Upvotes: 0

Views: 2445

Answers (2)

Richard Sand
Richard Sand

Reputation: 674

The SiteMinder headers are request headers. They are injected into the request on the server side. Javascript or HttpClient will not be able to see these headers as they are not transmitted to the client.

If you need to determine the username on the client side then you will have to create a server-side web service that can echo out the header

Upvotes: 1

Pac0
Pac0

Reputation: 23149

You can read a header from a http response as this :

assuming http is an instance of HttpClient :

http.get(authenticationUrl).subscribe(
    (response: Response) => { console.log(response.headers); }
)

you can instead get the header you want, like with response.headers['SM_USER'] if this is the exact name of the header.

If for some reasons you don't see the header you seek, you can http.get(url, {observe: 'response'}) instead of the one-parameter get method.

You can have a look at the documentation here

Upvotes: 0

Related Questions