Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Behaviour of SAML when HTTP Server used for high availability

I have implemented the supporting of SAML SSO to have my application act as the Service Provider using Spring Security SAML Extension. I was able to integrate my SP with different IDPs. So for example I have HostA,HostB, and HostC, all these have different instances of my application. I had an SP metadata file specified for each host and set the AssertionConsumerServiceURL with the URL of that host( EX:https:HostA.com/myapp/saml/sso ). I added each metadata file to the IDP and tested all of them and it is working fine.

However, my project also supports High Availability by having an IBM HTTP Server configured for load balancing. So in this case the HTTP Server will configure the hosts(A,B,C) to be the hosts used for load balancing, the user will access the my application using the URL of the HTTP server: https:httpserver.com/myapp/

If I defined one SP metadata file and had the URL of the HTTP Server specified in the AssertionConsumerServiceURL( https://httpserver.com/saml/sso ) and changed my implementation to accept assertions targeted to my HTTP Server, what will be the outcome of this scenario:

  1. User accesses the HTTPServer which dispatched the user to HostA(behind the scenes)
  2. My SP application in HostA sends a request to the IDP for authentication.
  3. The IDP sends back the response to my httpserver as: https://httpserver.com/saml/sso .

Will the HTTP Server redirect to HostA, to have it like this: https://HostA.com/saml/sso

Thanks.

like image 341
Omar Azzam Avatar asked Mar 17 '23 17:03

Omar Azzam


1 Answers

When deploying same instance of application in a clustered mode behind a load balancer you need to instruct the back-end applications about the public URL on the HTTP server (https://httpserver.com/myapp/) which they are deployed behind. You can do this using the SAMLContextProviderLB (see more in the manual). But you seem to have already successfully performed this step.

Once your HTTP Server receives a request, it will forward it to one of your hosts to URL e.g. https://HostA.com/saml/sso and usually will also provide the original URL as an HTTP header. The SAMLContextProviderLB will make the SP application think that the real URL was https://httpserver.com/saml/sso which will make it pass all the SAML security checks related to destination URL.

As the back-end applications store state in their HttpSessions make sure to do one of the following:

  • enable sticky session on the HTTP server (so that related requests are always directed to the same server
  • make sure to replicate HTTP session across your cluster
  • disable checking of response ID by including bean EmptyStorageFactory in your Spring configuration (this option also makes Single Logout unavailable)
like image 195
Vladimír Schäfer Avatar answered Apr 28 '23 16:04

Vladimír Schäfer