README.adoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. = SAML 2.0 Refreshable Metadata
  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. saml2:
  14. ap.metadata: {your-idp-metadata-endpoint}
  15. ----
  16. === Start up the Sample Boot Application
  17. ```
  18. ./gradlew :servlet:spring-boot:java:saml2:refreshable-metadata:bootRun
  19. ```
  20. === Open a Browser
  21. http://localhost:8080/
  22. You will be redirected to the SimpleSAMLPHP instance.
  23. === Type in your credentials
  24. ```
  25. User: user1
  26. Password: user1pass
  27. ```
  28. == Goals
  29. === SAML 2.0 Login
  30. `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.
  31. The following features are implemented in the MVP:
  32. 1. Receive and validate a SAML 2.0 Response containing an assertion, and create a corresponding authentication in Spring Security
  33. 2. Send a SAML 2.0 AuthNRequest to an Identity Provider
  34. 3. Provide a framework for components used in SAML 2.0 authentication that can be swapped by configuration
  35. 4. Work against the Okta SAML 2.0 IDP reference implementation
  36. === SAML 2.0 Single Logout
  37. `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.
  38. On this sample, the SAML 2.0 Logout is using the HTTP-POST binding.
  39. 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.
  40. === Refreshable Asserting Party Metadata
  41. The application uses a custom implementation of `RelyingPartyRegistrationRepository` to achieve Asserting Party Metadata refresh feature.
  42. This particular implementation relies on an OpenSAML component that refreshes the metadata.