Search code examples
spring-securityspring-saml

Spring SAML authentication with mix of IDP and form based


My Spring SAML applications (APP1 and APP2) have 2 methods for authentication: IDP and form based login. User will choose which authentication method to use on our SP landing page.

If user authenticated via IDP in APP1, then when access protected page on APP2 user will automatically signed in. This worked as expected.

But if user authenticated via form based login in APP1 and when he/she access protected page on APP2, user will be prompted to signed in via IDP. This confuses the user because he started with a form based login.

The behavior I wanted is for user to go to form based signed in APP2 if he start with form based in APP1.

How do I achieve this? Thanks in advance!


Solution

  • One idea - store information about whether user uses IDP or form based authentication on a shared domain in a cookie. And read the information in a customized AuthenticationEntryPoint within SpringSecurity which will decide which authentication process to start.