From 0e60708e5915eb858d5931c45f807329bd365c11 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Sun, 9 Jan 2022 21:30:56 +0100 Subject: chore(SAML2): update implementation to remove usage of deprecated openSAML4.x API --- .../modules/pvp2/idp/impl/AbstractPvp2XProtocol.java | 10 +++++----- .../pvp2/idp/impl/builder/Pvp2AssertionBuilder.java | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at') diff --git a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java index 63c8c99a..a2611165 100644 --- a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java +++ b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java @@ -134,11 +134,11 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement if (e instanceof NoPassivAuthenticationException) { statusCode.setValue(StatusCode.NO_PASSIVE); - statusMessage.setMessage(StringEscapeUtils.escapeXml11(e.getLocalizedMessage())); + statusMessage.setValue(StringEscapeUtils.escapeXml11(e.getLocalizedMessage())); } else if (e instanceof NameIdFormatNotSupportedException) { statusCode.setValue(StatusCode.INVALID_NAMEID_POLICY); - statusMessage.setMessage(StringEscapeUtils.escapeXml11(e.getLocalizedMessage())); + statusMessage.setValue(StringEscapeUtils.escapeXml11(e.getLocalizedMessage())); } else if (e instanceof SloException) { // SLOExecpetions only occurs if session information is lost @@ -149,7 +149,7 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement statusCode.setValue(ex.getStatusCodeValue()); final String statusMessageValue = ex.getStatusMessageValue(); if (statusMessageValue != null) { - statusMessage.setMessage(StringEscapeUtils.escapeXml11(statusMessageValue)); + statusMessage.setValue(StringEscapeUtils.escapeXml11(statusMessageValue)); } @@ -157,7 +157,7 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement } else { statusCode.setValue(StatusCode.RESPONDER); - statusMessage.setMessage(StringEscapeUtils.escapeXml11(e.getLocalizedMessage())); + statusMessage.setValue(StringEscapeUtils.escapeXml11(e.getLocalizedMessage())); internalErrorCode = statusMessager.getResponseErrorCode(e); } @@ -172,7 +172,7 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement } //set status-message if availabe - if (statusMessage.getMessage() != null) { + if (statusMessage.getValue() != null) { status.setStatusMessage(statusMessage); } diff --git a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/builder/Pvp2AssertionBuilder.java b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/builder/Pvp2AssertionBuilder.java index 21912592..88ff2206 100644 --- a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/builder/Pvp2AssertionBuilder.java +++ b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/builder/Pvp2AssertionBuilder.java @@ -107,7 +107,7 @@ public class Pvp2AssertionBuilder implements PvpConstants { final AuthnContextClassRef authnContextClassRef = Saml2Utils.createSamlObject(AuthnContextClassRef.class); - authnContextClassRef.setAuthnContextClassRef(qaaLevel); + authnContextClassRef.setURI(qaaLevel); final NameID subjectNameID = Saml2Utils.createSamlObject(NameID.class); subjectNameID.setFormat(attrQuery.getSubject().getNameID().getFormat()); @@ -151,7 +151,7 @@ public class Pvp2AssertionBuilder implements PvpConstants { // check if authn. request contains LoA final RequestedAuthnContext reqAuthnContext = authnRequest.getRequestedAuthnContext(); if (reqAuthnContext == null) { - authnContextClassRef.setAuthnContextClassRef(authData.getEidasQaaLevel()); + authnContextClassRef.setURI(authData.getEidasQaaLevel()); } else { // authn. request requests LoA levels. To LoA validation @@ -169,12 +169,12 @@ public class Pvp2AssertionBuilder implements PvpConstants { if (reqAuthnContextClassRefIt.size() == 0) { QaaLevelVerifier.verifyQaaLevel(authData.getEidasQaaLevel(), oaParam.getRequiredLoA(), loaMatchingMode); - authnContextClassRef.setAuthnContextClassRef(authData.getEidasQaaLevel()); + authnContextClassRef.setURI(authData.getEidasQaaLevel()); } else { final List eidasLoaFromRequest = new ArrayList<>(); for (final AuthnContextClassRef authnClassRef : reqAuthnContextClassRefIt) { - final String qaa_uri = authnClassRef.getAuthnContextClassRef(); + final String qaa_uri = authnClassRef.getURI(); if (!qaa_uri.trim().startsWith(EaafConstants.EIDAS_LOA_PREFIX)) { if (loaLevelMapper != null) { @@ -202,7 +202,7 @@ public class Pvp2AssertionBuilder implements PvpConstants { // verifiy LoAs from request to authentication LoA QaaLevelVerifier.verifyQaaLevel(authData.getEidasQaaLevel(), eidasLoaFromRequest, loaMatchingMode); - authnContextClassRef.setAuthnContextClassRef(authData.getEidasQaaLevel()); + authnContextClassRef.setURI(authData.getEidasQaaLevel()); } } @@ -309,12 +309,12 @@ public class Pvp2AssertionBuilder implements PvpConstants { if (metadataNameIdFormats != null) { for (final NameIDFormat el : metadataNameIdFormats) { - if (NameIDType.PERSISTENT.equals(el.getFormat())) { + if (NameIDType.PERSISTENT.equals(el.getURI())) { nameIdFormat = NameIDType.PERSISTENT; break; - } else if (NameIDType.TRANSIENT.equals(el.getFormat()) - || NameIDType.UNSPECIFIED.equals(el.getFormat())) { + } else if (NameIDType.TRANSIENT.equals(el.getURI()) + || NameIDType.UNSPECIFIED.equals(el.getURI())) { break; } @@ -442,7 +442,7 @@ public class Pvp2AssertionBuilder implements PvpConstants { Saml2Utils.createSamlObject(AudienceRestriction.class); final Audience audience = Saml2Utils.createSamlObject(Audience.class); - audience.setAudienceURI(entityID); + audience.setURI(entityID); audienceRestriction.getAudiences().add(audience); conditions.setNotBefore(date); conditions.setNotOnOrAfter(isValidTo); -- cgit v1.2.3