From d4ed0ad0cf974a1b8df42f4e4c4bd474f84b38da Mon Sep 17 00:00:00 2001 From: Brummolix Date: Thu, 30 Mar 2023 09:53:38 +0200 Subject: [PATCH] Replace deprecated OpenSaml methods --- .../provider/service/metadata/OpenSamlMetadataResolver.java | 2 +- .../authentication/logout/OpenSamlLogoutRequestResolver.java | 2 +- .../provider/service/authentication/TestOpenSamlObjects.java | 2 +- .../logout/OpenSamlLogoutRequestResolverTests.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java index 45fb14567a..60f8da435a 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/metadata/OpenSamlMetadataResolver.java @@ -186,7 +186,7 @@ public final class OpenSamlMetadataResolver implements Saml2MetadataResolver { private NameIDFormat buildNameIDFormat(RelyingPartyRegistration registration) { NameIDFormat nameIdFormat = build(NameIDFormat.DEFAULT_ELEMENT_NAME); - nameIdFormat.setFormat(registration.getNameIdFormat()); + nameIdFormat.setURI(registration.getNameIdFormat()); return nameIdFormat; } diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolver.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolver.java index 6288a0434d..bb5ec4b0e7 100644 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolver.java +++ b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolver.java @@ -143,7 +143,7 @@ final class OpenSamlLogoutRequestResolver { Saml2AuthenticatedPrincipal principal = (Saml2AuthenticatedPrincipal) authentication.getPrincipal(); for (String index : principal.getSessionIndexes()) { SessionIndex sessionIndex = this.sessionIndexBuilder.buildObject(); - sessionIndex.setSessionIndex(index); + sessionIndex.setValue(index); logoutRequest.getSessionIndexes().add(sessionIndex); } } diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java index 5699fd832a..a056fd4600 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/authentication/TestOpenSamlObjects.java @@ -364,7 +364,7 @@ public final class TestOpenSamlObjects { Attribute websiteAttr = attributeBuilder.buildObject(); websiteAttr.setName("website"); XSURI uri = new XSURIBuilder().buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSURI.TYPE_NAME); - uri.setValue("https://johndoe.com/"); + uri.setURI("https://johndoe.com/"); websiteAttr.getAttributeValues().add(uri); attrStmt2.getAttributes().add(websiteAttr); Attribute registeredAttr = attributeBuilder.buildObject(); diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolverTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolverTests.java index 063ce5e59d..cc43ac4afe 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolverTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/authentication/logout/OpenSamlLogoutRequestResolverTests.java @@ -87,7 +87,7 @@ public class OpenSamlLogoutRequestResolverTests { LogoutRequest logoutRequest = getLogoutRequest(saml2LogoutRequest.getSamlRequest(), binding); assertThat(logoutRequest.getNameID().getValue()).isEqualTo(authentication.getName()); assertThat(logoutRequest.getSessionIndexes()).hasSize(1); - assertThat(logoutRequest.getSessionIndexes().get(0).getSessionIndex()).isEqualTo("session-index"); + assertThat(logoutRequest.getSessionIndexes().get(0).getValue()).isEqualTo("session-index"); } private Saml2Authentication authentication(RelyingPartyRegistration registration) {