I am implementing three types of authentication mechanisms they are SAML and two custom authentication. So, how can I implement a filter based on a header it'll detect the authentication type and it'll route to the appropriate authentication mechanism.
SAML: In case of SAML if the cookie is having a key assamlthen SAML authentication has to happen. In SAML authentication also whenever the user login happens I am inserting a cookie with the name saml in the browser and for further requests I need to invoke a REST API by passingsamlcookie value and check whether the authentication is valid or not.Custom authentication: If the cookie key is havingtoken1ortoken2then do the custom authentication which involves calling a Rest API by passing the token and check the user is valid or not.
I know about SAML with spring security but as I explained in SAML how we can do the rest API call and implement a filter that invoke an appropriate authentication mechanism how we can achieve this. Is there any reference which could help fr the above scenario .