I am using the Spring Saml solution to protect my rest api running on tomcat.
I am using spring-security-saml2-core 1.0.2.RELEASE with Spring security 4.1.1.RELEASE.
I have created a Onelogin test connector/app. If I attempt to access http://localhost:8080/app-name/api/getstate I correctly get redirected to Onelogin and can authenticate. I am then redirected to http://localhost:8080/app-name/saml/SSO/alias/defaultAlias.
Problem :: I get "Could not verify the provided CSRF token because your session was not found." after the redirect
This is that as per Spring SAML Extension and Spring Security CSRF Protection Conflict.
The solution offered by Vladimír Schäfer suggests that CSRF should be disabled in the securityContext for the SAML endpoints.
This works but as I am new to spring security and spring security in general, I have to related queries :
Is it secure/best pracitice to turn off CSRF on the rest api in this scenario for Spring SAML URLs?
Is there a way for Onelogin to work with Spring Saml if CSRF enabled in spring security?