Hello!
We are implementing a SAML based SSO using ADFS. We have a single page application(SPA) on the client side implemented using angular 4. And our RESTful API is secured by Pac4j. We are facing a few difficulties with handling the AJAX requests. Here is what we are doing -
We make an AJAX call to a protected URL. A 401 is returned (because it is the default behaviour of the DefaultAjaxRequestResolver?). When we get a 401 on the client side, we call a protected URL(a controller whose only job is to redirect back to the front end application after authentication) at the window level, which triggers authentication via ADFS.
But the issue is, even after the user is authenticated, for every AJAX call that is made, a 401 is returned.
1) Is this the expected behaviour?
2) If so, what is the alternate solution? I understand that we can specify another behaviour using a custom AjaxRequestResolver. But, I'm not sure how I should go about it.
3) Is there any other way I can solve this problem?
Any help would be greatly appreciated :)