Remove References to Deprecated OpenSaml Components

Issue gh-11658
This commit is contained in:
Josh Cummings 2025-07-09 14:10:00 -06:00
parent 7a7d2cacd2
commit 9209a33678
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
4 changed files with 11 additions and 11 deletions

View File

@ -542,7 +542,7 @@ For example, you can throw a custom exception with any additional information av
---- ----
OpenSaml4AuthenticationProvider provider = new OpenSaml4AuthenticationProvider(); OpenSaml4AuthenticationProvider provider = new OpenSaml4AuthenticationProvider();
provider.setResponseValidator((responseToken) -> { provider.setResponseValidator((responseToken) -> {
Saml2ResponseValidatorResult result = OpenSamlAuthenticationProvider Saml2ResponseValidatorResult result = OpenSaml4AuthenticationProvider
.createDefaultResponseValidator() .createDefaultResponseValidator()
.convert(responseToken) .convert(responseToken)
.concat(myCustomValidator.convert(responseToken)); .concat(myCustomValidator.convert(responseToken));

View File

@ -49,7 +49,7 @@ This filter calls its configured `AuthenticationConverter` to create a `Saml2Aut
This converter additionally resolves the <<servlet-saml2login-relyingpartyregistration, `RelyingPartyRegistration`>> and supplies it to `Saml2AuthenticationToken`. This converter additionally resolves the <<servlet-saml2login-relyingpartyregistration, `RelyingPartyRegistration`>> and supplies it to `Saml2AuthenticationToken`.
image:{icondir}/number_2.png[] Next, the filter passes the token to its configured xref:servlet/authentication/architecture.adoc#servlet-authentication-providermanager[`AuthenticationManager`]. image:{icondir}/number_2.png[] Next, the filter passes the token to its configured xref:servlet/authentication/architecture.adoc#servlet-authentication-providermanager[`AuthenticationManager`].
By default, it uses the <<servlet-saml2login-architecture,`OpenSamlAuthenticationProvider`>>. By default, it uses the <<servlet-saml2login-architecture,`OpenSaml4AuthenticationProvider`>>.
image:{icondir}/number_3.png[] If authentication fails, then _Failure_. image:{icondir}/number_3.png[] If authentication fails, then _Failure_.
@ -184,9 +184,9 @@ To achieve this, any interfaces or classes where Spring Security uses OpenSAML i
This makes it possible for you to switch out OpenSAML for some other library or an unsupported version of OpenSAML. This makes it possible for you to switch out OpenSAML for some other library or an unsupported version of OpenSAML.
As a natural outcome of these two goals, Spring Security's SAML API is quite small relative to other modules. As a natural outcome of these two goals, Spring Security's SAML API is quite small relative to other modules.
Instead, such classes as `OpenSamlAuthenticationRequestFactory` and `OpenSamlAuthenticationProvider` expose `Converter` implementations that customize various steps in the authentication process. Instead, such classes as `OpenSamlXAuthenticationRequestFactory` and `OpenSamlXAuthenticationProvider` expose `Converter` implementations that customize various steps in the authentication process.
For example, once your application receives a `SAMLResponse` and delegates to `Saml2WebSsoAuthenticationFilter`, the filter delegates to `OpenSamlAuthenticationProvider`: For example, once your application receives a `SAMLResponse` and delegates to `Saml2WebSsoAuthenticationFilter`, the filter delegates to `OpenSamlXAuthenticationProvider`:
.Authenticating an OpenSAML `Response` .Authenticating an OpenSAML `Response`
image:{figures}/opensamlauthenticationprovider.png[] image:{figures}/opensamlauthenticationprovider.png[]

View File

@ -510,7 +510,7 @@ Java::
---- ----
@Component @Component
public class MyOpenSamlLogoutRequestValidator implements Saml2LogoutRequestValidator { public class MyOpenSamlLogoutRequestValidator implements Saml2LogoutRequestValidator {
private final Saml2LogoutRequestValidator delegate = new OpenSamlLogoutRequestValidator(); private final Saml2LogoutRequestValidator delegate = new OpenSaml5LogoutRequestValidator();
@Override @Override
public Saml2LogoutRequestValidator logout(Saml2LogoutRequestValidatorParameters parameters) { public Saml2LogoutRequestValidator logout(Saml2LogoutRequestValidatorParameters parameters) {
@ -529,7 +529,7 @@ Kotlin::
---- ----
@Component @Component
open class MyOpenSamlLogoutRequestValidator: Saml2LogoutRequestValidator { open class MyOpenSamlLogoutRequestValidator: Saml2LogoutRequestValidator {
private val delegate = OpenSamlLogoutRequestValidator() private val delegate = OpenSaml5LogoutRequestValidator()
@Override @Override
fun logout(parameters: Saml2LogoutRequestValidatorParameters): Saml2LogoutRequestValidator { fun logout(parameters: Saml2LogoutRequestValidatorParameters): Saml2LogoutRequestValidator {
@ -586,7 +586,7 @@ Java::
---- ----
@Component @Component
public class MyOpenSamlLogoutResponseValidator implements Saml2LogoutResponseValidator { public class MyOpenSamlLogoutResponseValidator implements Saml2LogoutResponseValidator {
private final Saml2LogoutResponseValidator delegate = new OpenSamlLogoutResponseValidator(); private final Saml2LogoutResponseValidator delegate = new OpenSaml5LogoutResponseValidator();
@Override @Override
public Saml2LogoutValidatorResult logout(Saml2LogoutResponseValidatorParameters parameters) { public Saml2LogoutValidatorResult logout(Saml2LogoutResponseValidatorParameters parameters) {

View File

@ -58,7 +58,7 @@ public class RefreshableRelyingPartyRegistrationRepository
implements IterableRelyingPartyRegistrationRepository { implements IterableRelyingPartyRegistrationRepository {
private final AssertingPartyMetadataRepository metadata = private final AssertingPartyMetadataRepository metadata =
OpenSamlAssertingPartyMetadataRepository OpenSaml5AssertingPartyMetadataRepository
.fromTrustedMetadataLocation("https://idp.example.org/metadata").build(); .fromTrustedMetadataLocation("https://idp.example.org/metadata").build();
@Override @Override
@ -93,7 +93,7 @@ Kotlin::
class RefreshableRelyingPartyRegistrationRepository : IterableRelyingPartyRegistrationRepository { class RefreshableRelyingPartyRegistrationRepository : IterableRelyingPartyRegistrationRepository {
private val metadata: AssertingPartyMetadataRepository = private val metadata: AssertingPartyMetadataRepository =
OpenSamlAssertingPartyMetadataRepository.fromTrustedMetadataLocation( OpenSaml5AssertingPartyMetadataRepository.fromTrustedMetadataLocation(
"https://idp.example.org/metadata").build() "https://idp.example.org/metadata").build()
fun findByRegistrationId(registrationId:String?): RelyingPartyRegistration { fun findByRegistrationId(registrationId:String?): RelyingPartyRegistration {
@ -132,7 +132,7 @@ Java::
+ +
[source,java,role="primary"] [source,java,role="primary"]
---- ----
OpenSamlAssertingPartyMetadataRepository.withMetadataLocation("https://idp.example.org/metadata") OpenSaml5AssertingPartyMetadataRepository.withMetadataLocation("https://idp.example.org/metadata")
.verificationCredentials((c) -> c.add(myVerificationCredential)) .verificationCredentials((c) -> c.add(myVerificationCredential))
.build(); .build();
---- ----
@ -141,7 +141,7 @@ Kotlin::
+ +
[source,kotlin,role="secondary"] [source,kotlin,role="secondary"]
---- ----
OpenSamlAssertingPartyMetadataRepository.withMetadataLocation("https://idp.example.org/metadata") OpenSaml5AssertingPartyMetadataRepository.withMetadataLocation("https://idp.example.org/metadata")
.verificationCredentials({ c : Collection<Saml2X509Credential> -> .verificationCredentials({ c : Collection<Saml2X509Credential> ->
c.add(myVerificationCredential) }) c.add(myVerificationCredential) })
.build() .build()