From 0224cdf7be78cf0778f0b832a42c18c480c4b784 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 9 Dec 2019 09:22:54 +0100 Subject: switch to EAAF-Components 1.1.0-SNAPSHOT --- .../verification/AuthnRequestValidator.java | 34 +++++++++++----------- .../MetadataSignatureVerificationFilter.java | 34 +++++++++++----------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'connector/src/main/java/at/asitplus/eidas/specific/connector/verification') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/AuthnRequestValidator.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/AuthnRequestValidator.java index 94b0cc02..c49c0b28 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/AuthnRequestValidator.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/AuthnRequestValidator.java @@ -44,16 +44,16 @@ import org.springframework.beans.factory.annotation.Autowired; import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.asitplus.eidas.specific.connector.config.ServiceProviderConfiguration; import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; -import at.gv.egiz.eaaf.core.api.data.PVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; +import at.gv.egiz.eaaf.core.api.data.PvpAttributeDefinitions; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.exceptions.AuthnRequestValidatorException; -import at.gv.egiz.eaaf.core.exceptions.EAAFException; -import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException; -import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EAAFRequestedAttribute; -import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EAAFRequestedAttributes; +import at.gv.egiz.eaaf.core.exceptions.EaafException; +import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; +import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttribute; +import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttributes; import at.gv.egiz.eaaf.modules.pvp2.api.validation.IAuthnRequestValidator; -import at.gv.egiz.eaaf.modules.pvp2.exception.NameIDFormatNotSupportedException; +import at.gv.egiz.eaaf.modules.pvp2.exception.NameIdFormatNotSupportedException; import eu.eidas.auth.commons.protocol.eidas.LevelOfAssurance; public class AuthnRequestValidator implements IAuthnRequestValidator { @@ -74,7 +74,7 @@ public class AuthnRequestValidator implements IAuthnRequestValidator { if ( !(NameID.TRANSIENT.equals(nameIDFormat) || NameID.PERSISTENT.equals(nameIDFormat)) ) { - throw new NameIDFormatNotSupportedException(nameIDFormat); + throw new NameIdFormatNotSupportedException(nameIDFormat); } @@ -107,9 +107,9 @@ public class AuthnRequestValidator implements IAuthnRequestValidator { LevelOfAssurance minimumLoAFromConfig = LevelOfAssurance.fromString(basicConfig.getBasicConfiguration( MSeIDASNodeConstants.PROP_EIDAS_REQUEST_LOA_MINIMUM_LEVEL, - EAAFConstants.EIDAS_LOA_HIGH)); + EaafConstants.EIDAS_LOA_HIGH)); if (minimumLoAFromConfig == null) { - log.warn("Can not load minimum LoA from configuration. Use LoA: {} as default", EAAFConstants.EIDAS_LOA_HIGH); + log.warn("Can not load minimum LoA from configuration. Use LoA: {} as default", EaafConstants.EIDAS_LOA_HIGH); minimumLoAFromConfig = LevelOfAssurance.HIGH; } @@ -119,7 +119,7 @@ public class AuthnRequestValidator implements IAuthnRequestValidator { for (String loa : reqLoA) { try { LevelOfAssurance intLoa = LevelOfAssurance.fromString(loa); - String selectedLoA = EAAFConstants.EIDAS_LOA_HIGH; + String selectedLoA = EaafConstants.EIDAS_LOA_HIGH; if (intLoa != null && intLoa.numericValue() >= minimumLoAFromConfig.numericValue()) { log.info("Client: {} requested LoA: {} will be upgraded to: {}", @@ -155,12 +155,12 @@ public class AuthnRequestValidator implements IAuthnRequestValidator { boolean sectorDetected = false; List requestedAttributes = authnReq.getExtensions().getUnknownXMLObjects(); for (XMLObject reqAttrObj : requestedAttributes) { - if (reqAttrObj instanceof EAAFRequestedAttributes) { - EAAFRequestedAttributes reqAttr = (EAAFRequestedAttributes)reqAttrObj; + if (reqAttrObj instanceof EaafRequestedAttributes) { + EaafRequestedAttributes reqAttr = (EaafRequestedAttributes)reqAttrObj; if (reqAttr.getAttributes() != null && reqAttr.getAttributes().size() != 0 ) { - for (EAAFRequestedAttribute el : reqAttr.getAttributes()) { + for (EaafRequestedAttribute el : reqAttr.getAttributes()) { log.trace("Processing req. attribute '" + el.getName() + "' ... "); - if (el.getName().equals(PVPAttributeDefinitions.EID_SECTOR_FOR_IDENTIFIER_NAME)) { + if (el.getName().equals(PvpAttributeDefinitions.EID_SECTOR_FOR_IDENTIFIER_NAME)) { if (el.getAttributeValues() != null && el.getAttributeValues().size() == 1) { String sectorId = el.getAttributeValues().get(0).getDOM().getTextContent(); ServiceProviderConfiguration spConfig = pendingReq.getServiceProviderConfiguration(ServiceProviderConfiguration.class); @@ -169,7 +169,7 @@ public class AuthnRequestValidator implements IAuthnRequestValidator { spConfig.setbPKTargetIdentifier(sectorId); sectorDetected = true; - } catch (EAAFException e) { + } catch (EaafException e) { log.info("Requested sector: " + sectorId + " DOES NOT match to allowed sectors for SP: " + spConfig.getUniqueIdentifier()); } @@ -195,7 +195,7 @@ public class AuthnRequestValidator implements IAuthnRequestValidator { } - } catch (EAAFStorageException e) { + } catch (EaafStorageException e) { log.info("Can NOT store Authn. Req. data into pendingRequest." , e); throw new AuthnRequestValidatorException("internal.02", null, e); diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/MetadataSignatureVerificationFilter.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/MetadataSignatureVerificationFilter.java index bf10de82..eeaea135 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/MetadataSignatureVerificationFilter.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/verification/MetadataSignatureVerificationFilter.java @@ -43,10 +43,10 @@ import org.opensaml.xml.validation.ValidationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.gv.egiz.eaaf.core.exceptions.EAAFException; +import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.impl.utils.KeyStoreUtils; -import at.gv.egiz.eaaf.modules.pvp2.exception.PVP2MetadataException; -import at.gv.egiz.eaaf.modules.pvp2.idp.exception.SAMLRequestNotSignedException; +import at.gv.egiz.eaaf.modules.pvp2.exception.Pvp2MetadataException; +import at.gv.egiz.eaaf.modules.pvp2.idp.exception.SamlRequestNotSignedException; import at.gv.egiz.eaaf.modules.pvp2.impl.validation.metadata.AbstractMetadataSignatureFilter; public class MetadataSignatureVerificationFilter extends AbstractMetadataSignatureFilter{ @@ -56,7 +56,7 @@ public class MetadataSignatureVerificationFilter extends AbstractMetadataSignatu private List trustedCredential = new ArrayList(); public MetadataSignatureVerificationFilter(String trustStorePath, String trustStorePassword, String metadataURL) - throws PVP2MetadataException { + throws Pvp2MetadataException { this.metadataURL = metadataURL; log.trace("Initialize metadata signature-verification filter with truststore: " + trustStorePath + " ... "); @@ -84,12 +84,12 @@ public class MetadataSignatureVerificationFilter extends AbstractMetadataSignatu } else - throw new PVP2MetadataException("pvp2.26", + throw new Pvp2MetadataException("pvp2.26", new Object[] {"Can not open trustStore: " + trustStorePath + " for metadata: " + metadataURL}); } catch (KeyStoreException | IOException e) { log.warn("Can not open trustStore: " + trustStorePath + " for metadata: " + metadataURL + " Reason: " + e.getMessage(), e); - throw new PVP2MetadataException("pvp2.26", + throw new Pvp2MetadataException("pvp2.26", new Object[] {"Can not open trustStore: " + trustStorePath + " for metadata"}, e); } @@ -99,36 +99,36 @@ public class MetadataSignatureVerificationFilter extends AbstractMetadataSignatu @Override - protected void verify(EntityDescriptor desc) throws PVP2MetadataException { + protected void verify(EntityDescriptor desc) throws Pvp2MetadataException { try { internalVerify(desc); - } catch (EAAFException e) { + } catch (EaafException e) { log.info("Metadata verification FAILED for: " + metadataURL + " Reason: " +e.getMessage()); - throw new PVP2MetadataException("pvp2.26", + throw new Pvp2MetadataException("pvp2.26", new Object[] {"Metadata verification FAILED for: " + metadataURL + " Reason: " +e.getMessage()}, e); } } @Override - protected void verify(EntitiesDescriptor desc) throws PVP2MetadataException { - throw new PVP2MetadataException("pvp2.26", + protected void verify(EntitiesDescriptor desc) throws Pvp2MetadataException { + throw new Pvp2MetadataException("pvp2.26", new Object[] {"EntitiesDescritors are NOT supported"}); } @Override - protected void verify(EntityDescriptor entity, EntitiesDescriptor desc) throws PVP2MetadataException { - throw new PVP2MetadataException("pvp2.26", + protected void verify(EntityDescriptor entity, EntitiesDescriptor desc) throws Pvp2MetadataException { + throw new Pvp2MetadataException("pvp2.26", new Object[] {"EntitiesDescritors are NOT supported"}); } private void internalVerify(SignableSAMLObject signedElement) - throws EAAFException { + throws EaafException { if (signedElement.getSignature() == null) { - throw new SAMLRequestNotSignedException(); + throw new SamlRequestNotSignedException(); } try { @@ -136,7 +136,7 @@ public class MetadataSignatureVerificationFilter extends AbstractMetadataSignatu sigValidator.validate(signedElement.getSignature()); } catch (ValidationException e) { log.error("Failed to validate Signature", e); - throw new SAMLRequestNotSignedException(e); + throw new SamlRequestNotSignedException(e); } boolean isTrusted = false; @@ -155,7 +155,7 @@ public class MetadataSignatureVerificationFilter extends AbstractMetadataSignatu if (!isTrusted) { log.warn("PVP2 metadata: " + metadataURL + " are NOT trusted!"); - throw new SAMLRequestNotSignedException(); + throw new SamlRequestNotSignedException(); } -- cgit v1.2.3