opensaml.adoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. = OpenSAML Support
  2. Spring Security provides an API for implementing SAML 2.0 features, and it also provides a default implementation using OpenSAML.
  3. Because Spring Security supports more than one version of OpenSAML at the same time, the components use the following naming convention:
  4. * Any component that is usable across all supported versions is named `OpenSamlXXX`.
  5. * Any component that targets OpenSAML 4.x is named `OpenSaml4XXX`
  6. * Any component that targets OpenSAML 5.x is named `OpenSaml5XXX`
  7. `spring-security-config` selects between these implementations by default by discovering which version your application is currently using.
  8. For example, if you are using OpenSAML 4, Spring Security will use the `OpenSaml4XXX` components.
  9. == Selecting OpenSAML 4
  10. Spring Security depends on OpenSAML 4 by default, so you need do nothing to begin using it other than importing the `spring-security-saml` dependency.
  11. == Selecting OpenSAML 5
  12. To use OpenSAML, you should override the `opensaml` dependencies as follows:
  13. [tabs]
  14. ======
  15. Maven::
  16. +
  17. [source,maven,role="primary"]
  18. ----
  19. <dependencies>
  20. <dependency>
  21. <groupId>org.springframework.security</groupId>
  22. <artifactId>spring-security-saml2-service-provider</artifactId>
  23. <exclusions>
  24. <exclusion>
  25. <groupId>org.opensaml</groupId>
  26. <artifactId>*</artifactId>
  27. </exclusion>
  28. </exclusions>
  29. </dependency>
  30. <dependency>
  31. <groupId>org.opensaml</groupId>
  32. <artifactId>opensaml-saml-api</artifactId>
  33. <version>5.1.2</version>
  34. </dependency>
  35. <dependency>
  36. <groupId>org.opensaml</groupId>
  37. <artifactId>opensaml-saml-impl</artifactId>
  38. <version>5.1.2</version>
  39. </dependency>
  40. </dependencies>
  41. ----
  42. Gradle::
  43. +
  44. [source,gradle,role="secondary"]
  45. ----
  46. dependencies {
  47. constraints {
  48. implementation "org.opensaml:opensaml-core-api:5.1.2"
  49. implementation "org.opensaml:opensaml-core-impl:5.1.2"
  50. implementation "org.opensaml:opensaml-saml-api:5.1.2"
  51. implementation "org.opensaml:opensaml-saml-impl:5.1.2"
  52. }
  53. // ...
  54. implementation ('org.springframework.security:spring-security-saml2-service-provider') {
  55. exclude group: "org.opensaml", module: "opensaml-core"
  56. }
  57. // ...
  58. }
  59. ----
  60. ======
  61. [NOTE]
  62. The exclusion is necessary because OpenSAML 5 splits `opensaml-core` into `opensaml-core-api` and `opensaml-core-impl`