diff options
author | tzefferer <tzefferer@gmail.com> | 2018-07-27 13:14:35 +0200 |
---|---|---|
committer | tzefferer <tzefferer@gmail.com> | 2018-07-27 13:14:35 +0200 |
commit | 84f5ffce2e66e52a07ef6bdcb802e268566168e0 (patch) | |
tree | 2c996d4d61511886804c83a9133b9d75ed635e48 /eidas_modules | |
parent | a3e019e87d78e17f24c170f7ef6a08d40ebfb232 (diff) | |
parent | 6d09f43225ba2e0f6d7b0583f843c858a1015807 (diff) | |
download | National_eIDAS_Gateway-84f5ffce2e66e52a07ef6bdcb802e268566168e0.tar.gz National_eIDAS_Gateway-84f5ffce2e66e52a07ef6bdcb802e268566168e0.tar.bz2 National_eIDAS_Gateway-84f5ffce2e66e52a07ef6bdcb802e268566168e0.zip |
Merge branch 'master' of gitlab.iaik.tugraz.at:egiz/eidas_at_proxy
# Conflicts:
# eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java
Diffstat (limited to 'eidas_modules')
24 files changed, 424 insertions, 246 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/pom.xml b/eidas_modules/authmodule-eIDAS-v2/pom.xml index eef89112..51b3004c 100644 --- a/eidas_modules/authmodule-eIDAS-v2/pom.xml +++ b/eidas_modules/authmodule-eIDAS-v2/pom.xml @@ -2,11 +2,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>at.gv.egiz.eidas.ms_specific</groupId> + <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>modules</artifactId> <version>1.x</version> </parent> - <groupId>at.gv.egiz.eidas.ms_specific.modules</groupId> + <groupId>at.asitplus.eidas.ms_specific.modules</groupId> <artifactId>authmodule-eIDAS-v2</artifactId> <name>eIDAS v2 authentication module</name> <version>${egiz.eidas.version}</version> @@ -47,7 +47,7 @@ <artifactId>egiz-spring-api</artifactId> </dependency> <dependency> - <groupId>at.gv.egiz.eidas.ms_specific</groupId> + <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>connector_lib</artifactId> </dependency> <dependency> diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/Constants.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/Constants.java index beb3cce7..64cf6af2 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/Constants.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/Constants.java @@ -1,6 +1,6 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2; import java.net.URI; import java.util.ArrayList; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationModulImpl.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationModulImpl.java index c41559b8..39be3fbd 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationModulImpl.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationModulImpl.java @@ -1,12 +1,12 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2; import org.apache.commons.lang3.StringUtils; +import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.gv.egiz.eaaf.core.api.idp.auth.modules.AuthModule; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eidas.specific.connector.MSeIDASNodeConstants; /** * @author tlenz @@ -17,9 +17,9 @@ public class eIDASAuthenticationModulImpl implements AuthModule { private int priority = 1; @Override - public int getPriority() { + public int getPriority() { return priority; - } + } /** * Sets the priority of this module. Default value is {@code 0}. diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationSpringResourceProvider.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationSpringResourceProvider.java index e067acfb..d44ef348 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationSpringResourceProvider.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/eIDASAuthenticationSpringResourceProvider.java @@ -1,6 +1,6 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/eIDASSignalServlet.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/eIDASSignalServlet.java index 77f799e7..41e2aa03 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/eIDASSignalServlet.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/eIDASSignalServlet.java @@ -1,6 +1,6 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2; import java.io.IOException; @@ -18,9 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod; import com.google.common.collect.ImmutableSortedSet; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractProcessEngineSignalController; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; import eu.eidas.auth.commons.EidasParameterKeys; import eu.eidas.auth.commons.light.ILightResponse; import eu.eidas.specificcommunication.SpecificCommunicationDefinitionBeanNames; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/SZRCommunicationException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/SZRCommunicationException.java index a0c3cf88..defc03db 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/SZRCommunicationException.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/SZRCommunicationException.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception; public class SZRCommunicationException extends eIDASAuthenticationException { diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAttributeException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAttributeException.java index f1d4280f..2ce9fcd7 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAttributeException.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAttributeException.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception; public class eIDASAttributeException extends eIDASAuthenticationException { diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAuthenticationException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAuthenticationException.java index 939e7471..93298a92 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAuthenticationException.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASAuthenticationException.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception; import at.gv.egiz.eaaf.core.exceptions.EAAFAuthenticationException; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASValidationException.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASValidationException.java index 7b81eacd..2bac7d04 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASValidationException.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/exception/eIDASValidationException.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception; public class eIDASValidationException extends eIDASAuthenticationException { diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java index 2bb3e0b0..de9f6455 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.service; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service; import java.io.File; import java.util.HashMap; @@ -13,10 +13,10 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException; import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; import eu.eidas.auth.commons.attribute.AttributeRegistries; import eu.eidas.auth.commons.attribute.AttributeRegistry; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/szr/SZRClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/szr/SZRClient.java index 86f0d0bb..cec36d4b 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/szr/SZRClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/szr/SZRClient.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -51,14 +51,14 @@ import org.w3._2000._09.xmldsig.KeyValueType; import org.w3c.dom.Document; import org.w3c.dom.Element; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.LoggingHandler; import at.gv.egiz.eaaf.core.api.data.XMLNamespaceConstants; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.impl.utils.DOMUtils; import at.gv.egiz.eaaf.core.impl.utils.FileUtils; import at.gv.egiz.eaaf.core.impl.utils.KeyStoreUtils; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.LoggingHandler; import szrservices.GetBPK; import szrservices.GetBPKResponse; import szrservices.GetIdentityLink; @@ -80,11 +80,11 @@ public class SZRClient { //client for anything, without identitylink private SZR szr = null; - + //RAW client is needed for identitylink - private Dispatch<Source> dispatch = null; - + private Dispatch<Source> dispatch = null; + private SZRService szrService = null; private String szrURL = null; private QName qname = null; @@ -95,7 +95,7 @@ public class SZRClient { personInfo, keyValue, insertERnP); - + } catch (SZRException_Exception e) { log.warn("SZR communication FAILED. Reason: " + e.getMessage(), e); throw new SZRCommunicationException("ernb.02", new Object[] {e.getMessage()}, e); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/szr/SZRService.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/szr/SZRService.java index 8e4911b9..ce2a1324 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/szr/SZRService.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/szr/SZRService.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr; import java.net.URL; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java index 8766783f..8ad529e8 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java @@ -1,6 +1,6 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.tasks; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks; import java.io.InputStream; import java.math.BigInteger; @@ -34,6 +34,12 @@ import org.w3c.dom.Node; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import at.asitplus.eidas.specific.connector.MSConnectorEventCodes; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAttributeException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; import at.gv.egiz.eaaf.core.api.data.EAAFConstants; @@ -51,12 +57,6 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; import at.gv.egiz.eaaf.core.impl.utils.DOMUtils; import at.gv.egiz.eaaf.core.impl.utils.XPathUtils; -import at.gv.egiz.eidas.specific.connector.MSConnectorEventCodes; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAttributeException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; import eu.eidas.auth.commons.attribute.AttributeDefinition; import eu.eidas.auth.commons.attribute.AttributeValue; import eu.eidas.auth.commons.light.ILightResponse; @@ -77,8 +77,8 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { @Autowired private IConfiguration basicConfig; @Autowired private SZRClient szrClient; - - /* (non-Javadoc) + + /* (non-Javadoc) * @see at.gv.egovernment.moa.id.process.springweb.MoaIdTask#execute(at.gv.egovernment.moa.id.process.api.ExecutionContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override @@ -172,8 +172,11 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { //parse some eID attributes String dateOfBirth = new SimpleDateFormat("yyyy-MM-dd").format(((DateTime)dateOfBirthObj).toDate()); - Trible<String, String, String> eIdentifier = + + // eID attribute has format <SOURCE-COUNTRY>/<DESTINATION-COUNTRY>/IDENTIFIER + Trible<String, String, String> eIdentifier = eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIdentifierObj); + // TODO: Shall we really use entire eID value (including countries information) or only identifier value? String uniqueId = (String)eIdentifierObj; String citizenCountry = eIdentifier.getFirst(); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTask.java index 111aa00f..eefa2b97 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTask.java @@ -1,6 +1,6 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.tasks; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks; import java.util.Map; import java.util.UUID; @@ -21,6 +21,12 @@ import org.springframework.web.util.UriComponentsBuilder; import com.google.common.collect.ImmutableSortedSet; +import at.asitplus.eidas.specific.connector.MSConnectorEventCodes; +import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; +import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; import at.gv.egiz.eaaf.core.api.data.EAAFConstants; import at.gv.egiz.eaaf.core.api.gui.IGUIFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; @@ -30,12 +36,6 @@ import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage; import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; -import at.gv.egiz.eidas.specific.connector.MSConnectorEventCodes; -import at.gv.egiz.eidas.specific.connector.MSeIDASNodeConstants; -import at.gv.egiz.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; import eu.eidas.auth.commons.EidasParameterKeys; import eu.eidas.auth.commons.attribute.AttributeDefinition; import eu.eidas.auth.commons.attribute.ImmutableAttributeMap; @@ -59,9 +59,9 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask { @Autowired IConfiguration basicConfig; @Autowired eIDASAttributeRegistry attrRegistry; @Autowired ApplicationContext context; - @Autowired ITransactionStorage transactionStore; + @Autowired ITransactionStorage transactionStore; @Autowired IGUIFormBuilder guiBuilder; - + @Override public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) @@ -168,7 +168,7 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask { //build request LightRequest lightAuthnReq = authnRequestBuilder.build(); - //put request into cache + //put request into Hazelcast cache BinaryLightToken token = putRequestInCommunicationCache(lightAuthnReq); final String tokenBase64 = BinaryLightTokenHelper.encodeBinaryLightTokenBase64(token); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/tasks/ReceiveAuthnResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/ReceiveAuthnResponseTask.java index 16030c52..2970c073 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/tasks/ReceiveAuthnResponseTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/ReceiveAuthnResponseTask.java @@ -1,6 +1,6 @@ /******************************************************************************* *******************************************************************************/ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.tasks; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -11,17 +11,17 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; +import at.asitplus.eidas.specific.connector.MSConnectorEventCodes; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.validator.eIDASResponseValidator; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.exceptions.EAAFException; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; -import at.gv.egiz.eidas.specific.connector.MSConnectorEventCodes; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.validator.eIDASResponseValidator; import eu.eidas.auth.commons.light.ILightResponse; @Component("ReceiveResponseFromeIDASNodeTask") @@ -40,7 +40,7 @@ public class ReceiveAuthnResponseTask extends AbstractAuthServletTask { log.warn("NO eIDAS response-message found."); throw new eIDASAuthenticationException("eidas.01", null); - } + } log.debug("Receive eIDAS response with RespId:" + eIDASResponse.getId() + " for ReqId:" + eIDASResponse.getInResponseToId()); revisionsLogger.logEvent(pendingReq, MSConnectorEventCodes.RESPONSE_FROM_EIDAS_NODE, eIDASResponse.getId()); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/utils/LoggingHandler.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/utils/LoggingHandler.java index c58d369b..2f6e7c3a 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/utils/LoggingHandler.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/utils/LoggingHandler.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils; import java.io.ByteArrayOutputStream; import java.util.Set; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/utils/eIDASResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/utils/eIDASResponseUtils.java index 165c35cb..6269d242 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/utils/eIDASResponseUtils.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/utils/eIDASResponseUtils.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils; import java.util.ArrayList; import java.util.List; @@ -11,8 +11,8 @@ import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableList; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; import at.gv.egiz.eaaf.core.impl.data.Trible; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; import eu.eidas.auth.commons.attribute.AttributeDefinition; import eu.eidas.auth.commons.attribute.AttributeValue; import eu.eidas.auth.commons.attribute.AttributeValueMarshaller; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/validator/eIDASResponseValidator.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/validator/eIDASResponseValidator.java index 3791d0d7..4af4e7cf 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/gv/egiz/eidas/specific/modules/authmodule_eIDASv2/validator/eIDASResponseValidator.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/validator/eIDASResponseValidator.java @@ -1,4 +1,4 @@ -package at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.validator; +package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.validator; import java.util.List; @@ -8,12 +8,12 @@ import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableList; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASValidationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.impl.data.Trible; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASValidationException; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry; -import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; import eu.eidas.auth.commons.attribute.AttributeDefinition; import eu.eidas.auth.commons.attribute.AttributeValue; import eu.eidas.auth.commons.light.ILightResponse; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/META-INF/services/at.gv.egiz.components.spring.api.SpringResourceProvider b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/META-INF/services/at.gv.egiz.components.spring.api.SpringResourceProvider index f5af2dc4..19134513 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/META-INF/services/at.gv.egiz.components.spring.api.SpringResourceProvider +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/META-INF/services/at.gv.egiz.components.spring.api.SpringResourceProvider @@ -1 +1 @@ -at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.eIDASAuthenticationSpringResourceProvider
\ No newline at end of file +at.asitplus.eidas.specific.modules.authmodule_eIDASv2.eIDASAuthenticationSpringResourceProvider
\ No newline at end of file diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml index 4664bc27..433a0499 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml @@ -12,7 +12,7 @@ <import resource="classpath:specificCommunicationDefinitionApplicationContext.xml"/> <bean id="SZRClientForeIDAS" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient" /> + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient" /> <bean id="specificConnectorAttributesFile" class="java.lang.String"> <constructor-arg value="eidas-attributes.xml"/> @@ -31,30 +31,30 @@ </bean> <bean id="eIDASAuthModule" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.eIDASAuthenticationModulImpl"> + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.eIDASAuthenticationModulImpl"> <property name="priority" value="2" /> </bean> <bean id="eIDASSignalServlet" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.eIDASSignalServlet" /> + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.eIDASSignalServlet" /> <bean id="attributeRegistry" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry"> + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASAttributeRegistry"> <property name="eidasAttributesFile" ref="specificConnectorAttributesFileWithPath"/> <property name="additionalAttributesFile" ref="specificConnectorAdditionalAttributesFileWithPath"/> </bean> <!-- Authentication Process Tasks --> <bean id="ConnecteIDASNodeTask" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.tasks.GenerateAuthnRequestTask" + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.GenerateAuthnRequestTask" scope="prototype" /> <bean id="ReceiveResponseFromeIDASNodeTask" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.tasks.ReceiveAuthnResponseTask" + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.ReceiveAuthnResponseTask" scope="prototype" /> <bean id="CreateIdentityLinkTask" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.tasks.CreateIdentityLinkTask" + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.CreateIdentityLinkTask" scope="prototype" /> </beans>
\ No newline at end of file diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java new file mode 100644 index 00000000..e68dcb9b --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java @@ -0,0 +1,347 @@ +<<<<<<< HEAD:eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java +//package at.gv.egiz.test.eidas.specific.modules.authmodule_eIDASv2; +// +//import java.io.IOException; +//import java.math.BigInteger; +//import java.security.InvalidKeyException; +//import java.security.NoSuchProviderException; +//import java.security.PublicKey; +//import java.security.interfaces.RSAPublicKey; +//import java.util.ArrayList; +//import java.util.List; +// +//import org.apache.commons.lang3.StringUtils; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +//import org.springframework.util.Base64Utils; +//import org.w3._2000._09.xmldsig.KeyValueType; +//import org.w3._2000._09.xmldsig.RSAKeyValueType; +//import org.w3c.dom.Element; +// +//import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; +//import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; +//import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +//import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +//import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; +//import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; +//import at.gv.egiz.eaaf.core.impl.data.Trible; +//import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; +//import szrservices.IdentityLinkType; +//import szrservices.PersonInfoType; +//import szrservices.SZRException_Exception; +//import szrservices.TravelDocumentType; +// +//@RunWith(SpringJUnit4ClassRunner.class) +//@ContextConfiguration("/SpringTest-context_basic_test.xml") +//public class SZRClientTest { +// private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class); +// +// @Autowired SZRClient szrClient; +// @Autowired IConfiguration basicConfig; +// +// private static final String givenName = "Franz"; +// private static final String familyName = "Mustermann"; +// private static final String dateOfBirth = "1987-05-05"; +// private static final String eIDASeID = "IS/AT/123456789ABCDE"; +// +// private static final String DUMMY_TARGET = EAAFConstants.URN_PREFIX_CDID + "ZP"; +// +// @Test +// public void dummyTest() { +// +// } +// +// +// //@Test +// public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, SZRCommunicationException { +// log.debug("Starting connecting SZR Gateway"); +// IdentityLinkType result = szrClient.getIdentityLink( +// getPersonInfo(), +// dummyCodeForKeys(), +// basicConfig.getBasicMOAIDConfigurationBoolean( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB, +// true) +// ); +// +// Element idlFromSZR = (Element)result.getAssertion(); +// IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); +// if (identityLink == null) +// throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"}); +// +// } +// +// //@Test +// public void getbPKTest() throws SZRException_Exception, SZRCommunicationException { +// String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET, +// basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, +// "no VKZ defined")); +// +// if (StringUtils.isEmpty(bPK)) +// throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"}); +// +// +// } +// +// private PersonInfoType getPersonInfo() { +// PersonInfoType personInfo = new PersonInfoType(); +// PersonNameType personName = new PersonNameType(); +// PhysicalPersonType naturalPerson = new PhysicalPersonType(); +// TravelDocumentType eDocument = new TravelDocumentType(); +// +// naturalPerson.setName(personName ); +// personInfo.setPerson(naturalPerson ); +// personInfo.setTravelDocument(eDocument ); +// +// //parse some eID attributes +// Trible<String, String, String> eIdentifier = +// eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID); +// String uniqueId = (String)eIDASeID; +// String citizenCountry = eIdentifier.getFirst(); +// +// //person information +// personName.setFamilyName((String)familyName); +// personName.setGivenName((String)givenName); +// naturalPerson.setDateOfBirth(dateOfBirth); +// eDocument.setIssuingCountry(citizenCountry); +// eDocument.setDocumentNumber(uniqueId); +// +// //eID document information +// eDocument.setDocumentType(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, +// Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); +// +// //TODO: that should be removed +// eDocument.setIssueDate(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE, +// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_DATE)); +// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY, +// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_AUTHORITY)); +// +// return personInfo; +// } +// +// +// private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException { +// if (basicConfig.getBasicMOAIDConfigurationBoolean( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY, +// false)) { +// List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>(); +// try { +// //Security.addProvider(new BouncyCastleProvider()); +// //PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); +// //KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); +// +// //PublicKey pb = kf.generatePublic(spec); +// PublicKey pb = new iaik.security.rsa.RSAPublicKey(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); +// +// RSAPublicKey rsapb = (RSAPublicKey)pb; +// BigInteger modulus = rsapb.getModulus(); +// BigInteger exponent = rsapb.getPublicExponent(); +// +// // set key values +// RSAKeyValueType rsa = new RSAKeyValueType(); +// rsa.setExponent(new String(Base64Utils.encode(exponent.toByteArray()))); +// rsa.setModulus(new String(Base64Utils.encode(modulus.toByteArray()))); +// +// KeyValueType key = new KeyValueType(); +// key.setRSAKeyValue(rsa); +// +// keyvalueList.add(key); +// +// return keyvalueList; +// } catch (Exception e) { +// log.error("TestCode has an internal ERROR", e); +// throw e; +// } +// +// } +// +// return null; +// +// } +//} +======= +package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2; + +import java.io.IOException; +import java.math.BigInteger; +import java.security.InvalidKeyException; +import java.security.NoSuchProviderException; +import java.security.PublicKey; +import java.security.interfaces.RSAPublicKey; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.util.Base64Utils; +import org.w3._2000._09.xmldsig.KeyValueType; +import org.w3._2000._09.xmldsig.RSAKeyValueType; +import org.w3c.dom.Element; + +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; +import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; +import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; +import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; +import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; +import at.gv.egiz.eaaf.core.impl.data.Trible; +import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; +import szrservices.IdentityLinkType; +import szrservices.PersonInfoType; +import szrservices.SZRException_Exception; +import szrservices.TravelDocumentType; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("/SpringTest-context_basic_test.xml") +public class SZRClientTest { + private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class); + + @Autowired SZRClient szrClient; + @Autowired IConfiguration basicConfig; + + private static final String givenName = "Franz"; + private static final String familyName = "Mustermann"; + private static final String dateOfBirth = "1987-05-05"; + private static final String eIDASeID = "IS/AT/123456789ABCDE"; + + private static final String DUMMY_TARGET = EAAFConstants.URN_PREFIX_CDID + "ZP"; + + @Test + public void dummyTest() { + + } + + + //@Test + public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, SZRCommunicationException { + log.debug("Starting connecting SZR Gateway"); + IdentityLinkType result = szrClient.getIdentityLink( + getPersonInfo(), + dummyCodeForKeys(), + basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB, + true) + ); + + Element idlFromSZR = (Element)result.getAssertion(); + IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); + if (identityLink == null) + throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"}); + + } + + //@Test + public void getbPKTest() throws SZRException_Exception, SZRCommunicationException { + String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET, + basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, + "no VKZ defined")); + + if (StringUtils.isEmpty(bPK)) + throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"}); + + + } + + private PersonInfoType getPersonInfo() { + PersonInfoType personInfo = new PersonInfoType(); + PersonNameType personName = new PersonNameType(); + PhysicalPersonType naturalPerson = new PhysicalPersonType(); + TravelDocumentType eDocument = new TravelDocumentType(); + + naturalPerson.setName(personName ); + personInfo.setPerson(naturalPerson ); + personInfo.setTravelDocument(eDocument ); + + //parse some eID attributes + Trible<String, String, String> eIdentifier = + eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID); + String uniqueId = (String)eIDASeID; + String citizenCountry = eIdentifier.getFirst(); + + //person information + personName.setFamilyName((String)familyName); + personName.setGivenName((String)givenName); + naturalPerson.setDateOfBirth(dateOfBirth); + eDocument.setIssuingCountry(citizenCountry); + eDocument.setDocumentNumber(uniqueId); + + //eID document information + eDocument.setDocumentType(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, + Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); + + //TODO: that should be removed + eDocument.setIssueDate(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE, + Constants.SZR_CONSTANTS_DEFAULT_ISSUING_DATE)); + eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY, + Constants.SZR_CONSTANTS_DEFAULT_ISSUING_AUTHORITY)); + + return personInfo; + } + + + private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException { + if (basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY, + false)) { + List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>(); + try { + //Security.addProvider(new BouncyCastleProvider()); + //PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); + //KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); + + //PublicKey pb = kf.generatePublic(spec); + PublicKey pb = new iaik.security.rsa.RSAPublicKey(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); + + RSAPublicKey rsapb = (RSAPublicKey)pb; + BigInteger modulus = rsapb.getModulus(); + BigInteger exponent = rsapb.getPublicExponent(); + + // set key values + RSAKeyValueType rsa = new RSAKeyValueType(); + rsa.setExponent(new String(Base64Utils.encode(exponent.toByteArray()))); + rsa.setModulus(new String(Base64Utils.encode(modulus.toByteArray()))); + + KeyValueType key = new KeyValueType(); + key.setRSAKeyValue(rsa); + + keyvalueList.add(key); + + return keyvalueList; + } catch (Exception e) { + log.error("TestCode has an internal ERROR", e); + throw e; + } + + } + + return null; + + } +} +>>>>>>> 6d09f43225ba2e0f6d7b0583f843c858a1015807:eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java deleted file mode 100644 index 09fe59e5..00000000 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java +++ /dev/null @@ -1,172 +0,0 @@ -//package at.gv.egiz.test.eidas.specific.modules.authmodule_eIDASv2; -// -//import java.io.IOException; -//import java.math.BigInteger; -//import java.security.InvalidKeyException; -//import java.security.NoSuchProviderException; -//import java.security.PublicKey; -//import java.security.interfaces.RSAPublicKey; -//import java.util.ArrayList; -//import java.util.List; -// -//import org.apache.commons.lang3.StringUtils; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.test.context.ContextConfiguration; -//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -//import org.springframework.util.Base64Utils; -//import org.w3._2000._09.xmldsig.KeyValueType; -//import org.w3._2000._09.xmldsig.RSAKeyValueType; -//import org.w3c.dom.Element; -// -//import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; -//import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; -//import at.gv.egiz.eaaf.core.api.data.EAAFConstants; -//import at.gv.egiz.eaaf.core.api.idp.IConfiguration; -//import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; -//import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; -//import at.gv.egiz.eaaf.core.impl.data.Trible; -//import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; -//import szrservices.IdentityLinkType; -//import szrservices.PersonInfoType; -//import szrservices.SZRException_Exception; -//import szrservices.TravelDocumentType; -// -//@RunWith(SpringJUnit4ClassRunner.class) -//@ContextConfiguration("/SpringTest-context_basic_test.xml") -//public class SZRClientTest { -// private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class); -// -// @Autowired SZRClient szrClient; -// @Autowired IConfiguration basicConfig; -// -// private static final String givenName = "Franz"; -// private static final String familyName = "Mustermann"; -// private static final String dateOfBirth = "1987-05-05"; -// private static final String eIDASeID = "IS/AT/123456789ABCDE"; -// -// private static final String DUMMY_TARGET = EAAFConstants.URN_PREFIX_CDID + "ZP"; -// -// @Test -// public void dummyTest() { -// -// } -// -// -// //@Test -// public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, SZRCommunicationException { -// log.debug("Starting connecting SZR Gateway"); -// IdentityLinkType result = szrClient.getIdentityLink( -// getPersonInfo(), -// dummyCodeForKeys(), -// basicConfig.getBasicMOAIDConfigurationBoolean( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB, -// true) -// ); -// -// Element idlFromSZR = (Element)result.getAssertion(); -// IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); -// if (identityLink == null) -// throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"}); -// -// } -// -// //@Test -// public void getbPKTest() throws SZRException_Exception, SZRCommunicationException { -// String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET, -// basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, -// "no VKZ defined")); -// -// if (StringUtils.isEmpty(bPK)) -// throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"}); -// -// -// } -// -// private PersonInfoType getPersonInfo() { -// PersonInfoType personInfo = new PersonInfoType(); -// PersonNameType personName = new PersonNameType(); -// PhysicalPersonType naturalPerson = new PhysicalPersonType(); -// TravelDocumentType eDocument = new TravelDocumentType(); -// -// naturalPerson.setName(personName ); -// personInfo.setPerson(naturalPerson ); -// personInfo.setTravelDocument(eDocument ); -// -// //parse some eID attributes -// Trible<String, String, String> eIdentifier = -// eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID); -// String uniqueId = (String)eIDASeID; -// String citizenCountry = eIdentifier.getFirst(); -// -// //person information -// personName.setFamilyName((String)familyName); -// personName.setGivenName((String)givenName); -// naturalPerson.setDateOfBirth(dateOfBirth); -// eDocument.setIssuingCountry(citizenCountry); -// eDocument.setDocumentNumber(uniqueId); -// -// //eID document information -// eDocument.setDocumentType(basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, -// Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); -// -// //TODO: that should be removed -// eDocument.setIssueDate(basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE, -// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_DATE)); -// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY, -// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_AUTHORITY)); -// -// return personInfo; -// } -// -// -// private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException { -// if (basicConfig.getBasicMOAIDConfigurationBoolean( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY, -// false)) { -// List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>(); -// try { -// //Security.addProvider(new BouncyCastleProvider()); -// //PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); -// //KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); -// -// //PublicKey pb = kf.generatePublic(spec); -// PublicKey pb = new iaik.security.rsa.RSAPublicKey(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); -// -// RSAPublicKey rsapb = (RSAPublicKey)pb; -// BigInteger modulus = rsapb.getModulus(); -// BigInteger exponent = rsapb.getPublicExponent(); -// -// // set key values -// RSAKeyValueType rsa = new RSAKeyValueType(); -// rsa.setExponent(new String(Base64Utils.encode(exponent.toByteArray()))); -// rsa.setModulus(new String(Base64Utils.encode(modulus.toByteArray()))); -// -// KeyValueType key = new KeyValueType(); -// key.setRSAKeyValue(rsa); -// -// keyvalueList.add(key); -// -// return keyvalueList; -// } catch (Exception e) { -// log.error("TestCode has an internal ERROR", e); -// throw e; -// } -// -// } -// -// return null; -// -// } -//} diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml index b381a0e9..ae320b27 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml @@ -10,10 +10,10 @@ <context:annotation-config /> <bean id="SZRClientForeIDAS" - class="at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient" /> + class="at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient" /> <bean id="BasicMSSpecificNodeConfig" - class="at.gv.egiz.eidas.specific.connector.config.BasicConfigurationProvider"> + class="at.asitplus.eidas.specific.connector.config.BasicConfigurationProvider"> <constructor-arg value="#{systemProperties['eidas.ms.configuration'] != null ? systemProperties['eidas.ms.configuration'] : 'file:/F:/Projekte/configs/ms_connector/default_config.properties' }"/> </bean> diff --git a/eidas_modules/pom.xml b/eidas_modules/pom.xml index 1502ae6b..219096ff 100644 --- a/eidas_modules/pom.xml +++ b/eidas_modules/pom.xml @@ -2,11 +2,11 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>at.gv.egiz.eidas</groupId> + <groupId>at.asitplus.eidas</groupId> <artifactId>ms_specific</artifactId> <version>1.x</version> </parent> - <groupId>at.gv.egiz.eidas.ms_specific</groupId> + <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>modules</artifactId> <packaging>pom</packaging> |