opensaml.adoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. <dependencyManagement>
  20. <dependencies>
  21. <dependency>
  22. <groupId>org.opensaml</groupId>
  23. <artifactId>opensaml-core-api</artifactId>
  24. <version>5.1.2</version>
  25. </dependency>
  26. <dependency>
  27. <groupId>org.opensaml</groupId>
  28. <artifactId>opensaml-core-impl</artifactId>
  29. <version>5.1.2</version>
  30. </dependency>
  31. <dependency>
  32. <groupId>org.opensaml</groupId>
  33. <artifactId>opensaml-saml-api</artifactId>
  34. <version>5.1.2</version>
  35. </dependency>
  36. <dependency>
  37. <groupId>org.opensaml</groupId>
  38. <artifactId>opensaml-saml-imple</artifactId>
  39. <version>5.1.2</version>
  40. </dependency>
  41. </dependencies>
  42. </dependencyManagement>
  43. // ...
  44. <dependencies>
  45. <dependency>
  46. <groupId>org.springframework.security</groupId>
  47. <artifactId>spring-security-saml2-service-provider</artifactId>
  48. <exclusions>
  49. <exclusion>
  50. <groupId>org.opensaml</groupId>
  51. <artifactId>opensaml-core</artifactId>
  52. </exclusion>
  53. </exclusions>
  54. </dependency>
  55. </dependencies>
  56. ----
  57. Gradle::
  58. +
  59. [source,gradle,role="secondary"]
  60. ----
  61. dependencies {
  62. constraints {
  63. implementation "org.opensaml:opensaml-core-api:5.1.2"
  64. implementation "org.opensaml:opensaml-core-impl:5.1.2"
  65. implementation "org.opensaml:opensaml-saml-api:5.1.2"
  66. implementation "org.opensaml:opensaml-saml-impl:5.1.2"
  67. }
  68. // ...
  69. implementation ('org.springframework.security:spring-security-saml2-service-provider') {
  70. exclude group: "org.opensaml", module: "opensaml-core"
  71. }
  72. // ...
  73. }
  74. ----
  75. ======
  76. [NOTE]
  77. The exclusion is necessary because OpenSAML 5 splits `opensaml-core` into `opensaml-core-api` and `opensaml-core-impl`