We're trying to configure several identity providers in the application to support different types of SSO. The problem is that for a non-authenticated request the application doesn't know which IDP to redirect to. We can figure out which IDP to use based on the domain name. That's not a problem. The problem is to change filters the way to redirect to that specific IDP instead of the first found one.
I wonder if there's an easy way to support it in Spring Security or its SAML2 library.
I can either somehow modify metadata to redirect it to my own URL (and then have some custom code there) or make the authentication filter pick the right IDP based on some criteria.
UPDATE
Current yaml configuration:
spring:
security:
saml2:
relyingparty:
registration:
idpone:
identityprovider:
entity-id: https://idpone.com
sso-url: https://idpone.com
verification:
credentials:
- certificate-location: "classpath:saml/idpone.crt"
idptwo:
identityprovider:
entity-id: https://idptwo.com
sso-url: https://idptwo.com
verification:
credentials:
- certificate-location: "classpath:saml/idptwo.crt"