README.adoc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. == Goals
  8. === SAML 2.0 Login
  9. `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 SimpleSAMLphp SAML 2.0 reference implementation.
  10. The following features are implemented in the MVP:
  11. 1. Receive and validate a SAML 2.0 Response containing an assertion, and create a corresponding authentication in Spring Security
  12. 2. Send a SAML 2.0 AuthNRequest to an Identity Provider
  13. 3. Provide a framework for components used in SAML 2.0 authentication that can be swapped by configuration
  14. 4. Work against the SimpleSAMLphp reference implementation
  15. === SAML 2.0 Single Logout
  16. `saml2Logout()` supports RP- and AP-initiated SAML 2.0 Single Logout via the HTTP-POST and HTTP-REDIRECT bindings against the SimpleSAMLphp SAML 2.0 reference implementation.
  17. On this sample, the SAML 2.0 Logout is using the HTTP-POST binding.
  18. 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.
  19. === Refreshable Asserting Party Metadata
  20. The application uses a custom implementation of `RelyingPartyRegistrationRepository` to achieve Asserting Party Metadata refresh feature.
  21. This particular implementation uses a `@Scheduled` annotation to update its metadata every 30 minutes.
  22. == Run the Sample
  23. === Start up the Sample Boot Application
  24. ```
  25. ./gradlew :servlet:spring-boot:java:saml2:refreshable-metadata:bootRun
  26. ```
  27. === Open a Browser
  28. http://localhost:8080/
  29. You will be redirect to the SimpleSAMLphp IDP
  30. === Type in your credentials
  31. ```
  32. User: user
  33. Password: password
  34. ```