README.adoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. = SAML 2.0 Login & Logout Sample
  2. This guide provides instructions on setting up this SAML 2.0 Login & Logout sample application.
  3. It uses https://simplesamlphp.org/[SimpleSAMLphp] as its asserting party.
  4. The sample application uses Spring Boot and the `spring-security-saml2-service-provider`
  5. module which is new in Spring Security 5.2.
  6. The https://docs.spring.io/spring-security/reference/servlet/saml2/logout.html[SAML 2.0 Logout feature] is new in Spring Security 5.6.
  7. == Run the Sample
  8. === Install Docker
  9. This sample requires Docker to run a local IdP.
  10. As an alternative, you can point the sample at your own IdP by changing the `application.yml` here:
  11. [source,java]
  12. ----
  13. spring:
  14. security:
  15. saml2:
  16. relyingparty:
  17. registration:
  18. one:
  19. assertingparty.metadata-uri: {your-idp-metadata-endpoint}
  20. // ...
  21. two:
  22. assertingparty.metadata-uri: {your-idp-metadata-endpoint}
  23. ----
  24. === Start up the Sample Boot Application
  25. ```
  26. ./gradlew :servlet:spring-boot:java:saml2:login:bootRun
  27. ```
  28. === Open a Browser
  29. http://localhost:8080/
  30. You will be redirected to the SimpleSAMLPHP instance.
  31. === Type in your credentials
  32. ```
  33. User: user1
  34. Password: user1pass
  35. ```
  36. == Goals
  37. === SAML 2.0 Login
  38. `saml2Login()` provides a very simple implementation of a Service Provider that can receive a SAML 2.0 Response via the HTTP-POST and HTTP-REDIRECT bindings against the https://developer.okta.com/docs/guides/build-sso-integration/saml2/main/[Okta SAML 2.0 IDP] reference implementation.
  39. The following features are implemented in the MVP:
  40. 1. Receive and validate a SAML 2.0 Response containing an assertion, and create a corresponding authentication in Spring Security
  41. 2. Send a SAML 2.0 AuthNRequest to an Identity Provider
  42. 3. Provide a framework for components used in SAML 2.0 authentication that can be swapped by configuration
  43. 4. Work against the SimpleSAMLPHP reference implementation
  44. === SAML 2.0 Single Logout
  45. `saml2Logout()` supports RP- and AP-initiated SAML 2.0 Single Logout via the HTTP-POST and HTTP-REDIRECT bindings against the https://developer.okta.com/docs/guides/build-sso-integration/saml2/main/[Okta SAML 2.0 IDP] reference implementation.
  46. On this sample, the SAML 2.0 Logout is using the HTTP-POST binding.
  47. You can refer to the https://docs.spring.io/spring-security/reference/servlet/saml2/logout.html[reference documentation] for more details about the RP- and AP-initiated SAML 2.0 Logout.