aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java34
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java76
2 files changed, 34 insertions, 76 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java
index 6040e0b3..22f38c2a 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java
@@ -138,15 +138,16 @@ public class SzrClient {
/**
* Get IdentityLink of a person.
*
- * @param personInfo Person identification information
+ *
+ * @param eidData minimum dataset of person
* @return IdentityLink
* @throws SzrCommunicationException In case of a SZR error
*/
- public IdentityLinkType getIdentityLinkInRawMode(PersonInfoType personInfo)
+ public IdentityLinkType getIdentityLinkInRawMode(ErnpEidData eidData)
throws SzrCommunicationException {
try {
final GetIdentityLinkEidas getIdl = new GetIdentityLinkEidas();
- getIdl.setPersonInfo(personInfo);
+ getIdl.setPersonInfo(generateSzrRequest(convertTemp(eidData)));
final JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
final Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
@@ -200,17 +201,18 @@ public class SzrClient {
/**
* Get bPK of person.
*
- * @param personInfo Person identification information
+ *
+ * @param eidData Minimum dataset of person
* @param target requested bPK target
* @param vkz Verfahrenskennzeichen
* @return bPK for this person
* @throws SzrCommunicationException In case of a SZR error
*/
- public List<String> getBpk(PersonInfoType personInfo, String target, String vkz)
+ public List<String> getBpk(ErnpEidData eidData, String target, String vkz)
throws SzrCommunicationException {
try {
final GetBPK parameters = new GetBPK();
- parameters.setPersonInfo(personInfo);
+ parameters.setPersonInfo(generateSzrRequest(convertTemp(eidData)));
parameters.getBereichsKennung().add(target);
parameters.setVKZ(vkz);
final GetBPKResponse result = this.szr.getBPK(parameters);
@@ -253,15 +255,15 @@ public class SzrClient {
* <b>Note</b>: Previously, this method did create a new ERnP entry, if it did not exist. This is
* <b>not</b> the case any more. See {@link #createNewErnpEntry(SimpleEidasData)} for that functionality.
*
- * @param personInfo Minimum dataset of person
+ * @param eidData Minimum dataset of person
* @return encrypted baseId
* @throws SzrCommunicationException In case of a SZR error
*/
- public String getEncryptedStammzahl(final PersonInfoType personInfo)
+ public String getEncryptedStammzahl(final ErnpEidData eidData)
throws SzrCommunicationException {
final String resp;
try {
- resp = this.szr.getStammzahlEncrypted(personInfo, false);
+ resp = this.szr.getStammzahlEncrypted(generateSzrRequest(convertTemp(eidData)), false);
} catch (SZRException_Exception e) {
throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e);
}
@@ -274,6 +276,20 @@ public class SzrClient {
}
+ private SimpleEidasData convertTemp(ErnpEidData eidData) {
+ return SimpleEidasData.builder()
+ .citizenCountryCode(eidData.getCitizenCountryCode())
+ .pseudonym(eidData.getPseudonym())
+ .givenName(eidData.getGivenName())
+ .familyName(eidData.getFamilyName())
+ .dateOfBirth(eidData.getFormatedDateOfBirth())
+ .placeOfBirth(eidData.getPlaceOfBirth())
+ .birthName(eidData.getBirthName())
+ .address(eidData.getAddress())
+ //TODO not available.taxNumber()
+ .build();
+ }
+
/**
* Sign an eidasBind data-structure that combines vsz with user's pubKey and E-ID status.
*
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java
index c22dc4ba..0287fe35 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java
@@ -33,9 +33,6 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.AuthBlockSigning
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils;
-import at.gv.e_government.reference.namespace.persondata._20020228.AlternativeNameType;
-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.data.PvpAttributeDefinitions;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
@@ -72,8 +69,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import szrservices.IdentityLinkType;
-import szrservices.PersonInfoType;
-import szrservices.TravelDocumentType;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -147,14 +142,12 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
if (basicConfig.getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_USEDUMMY, false)) {
buildDummyIdentityLink(eidData);
} else {
- //build SZR request from eIDAS data
- final PersonInfoType personInfo = generateSzrRequest(eidData);
//request SZR based on IDL or E-ID mode
if (pendingReq.getServiceProviderConfiguration()
.isConfigurationValue(MsEidasNodeConstants.PROP_CONFIG_SP_NEW_EID_MODE, false)) {
- executeEidMode(eidasAttributes, eidData, personInfo);
+ executeEidMode(eidasAttributes, eidData);
} else {
- executeIdlMode(eidasAttributes, eidData, personInfo);
+ executeIdlMode(eidasAttributes, eidData);
}
}
storeGenericInfoToSession(eidasAttributes);
@@ -178,9 +171,9 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
Objects.requireNonNull(eidasPersonalIdentifier).getFirst());
}
- private void executeIdlMode(Map<String, Object> simpleAttrMap, ErnpEidData eidData, PersonInfoType personInfo) throws EaafException {
+ private void executeIdlMode(Map<String, Object> simpleAttrMap, ErnpEidData eidData) throws EaafException {
//request SZR
- SzrResultHolder idlResult = requestSzrForIdentityLink(personInfo);
+ SzrResultHolder idlResult = requestSzrForIdentityLink(eidData);
//write revision-Log entry for personal-identifier mapping
writeExtendedRevisionLogEntry(simpleAttrMap, eidData);
@@ -201,9 +194,9 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
.getAreaSpecificTargetIdentifier());
}
- private void executeEidMode(Map<String, Object> simpleAttrMap, ErnpEidData eidData, PersonInfoType personInfo) throws JsonProcessingException, EaafException, JoseException {
+ private void executeEidMode(Map<String, Object> simpleAttrMap, ErnpEidData eidData) throws JsonProcessingException, EaafException, JoseException {
// get encrypted baseId
- String vsz = szrClient.getEncryptedStammzahl(personInfo);
+ String vsz = szrClient.getEncryptedStammzahl(eidData);
//write revision-Log entry and extended infos personal-identifier mapping
revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_VSZ_RECEIVED);
@@ -250,60 +243,9 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
}
}
- private PersonInfoType generateSzrRequest(ErnpEidData eidData) {
- log.debug("Starting connecting SZR Gateway");
- final PersonInfoType personInfo = new PersonInfoType();
- final PersonNameType personName = new PersonNameType();
- final PhysicalPersonType naturalPerson = new PhysicalPersonType();
- final TravelDocumentType eDocument = new TravelDocumentType();
-
- naturalPerson.setName(personName);
- personInfo.setPerson(naturalPerson);
- personInfo.setTravelDocument(eDocument);
-
- // person information
- personName.setFamilyName(eidData.getFamilyName());
- personName.setGivenName(eidData.getGivenName());
- naturalPerson.setDateOfBirth(eidData.getFormatedDateOfBirth());
- eDocument.setIssuingCountry(eidData.getCitizenCountryCode());
- eDocument.setDocumentNumber(eidData.getPseudonym());
-
- // eID document information
- String documentType = basicConfig
- .getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE,
- Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE);
- eDocument.setDocumentType(documentType);
-
- // set PlaceOfBirth if available
- if (eidData.getPlaceOfBirth() != null) {
- log.trace("Find 'PlaceOfBirth' attribute: " + eidData.getPlaceOfBirth());
- boolean setPlaceOfBirth = basicConfig
- .getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_SETPLACEOFBIRTHIFAVAILABLE, true);
- if (setPlaceOfBirth) {
- naturalPerson.setPlaceOfBirth(eidData.getPlaceOfBirth());
- log.trace("Adding 'PlaceOfBirth' to ERnB request ... ");
- }
- }
-
- // set BirthName if available
- if (eidData.getBirthName() != null) {
- log.trace("Find 'BirthName' attribute: " + eidData.getBirthName());
- boolean setBirthName = basicConfig
- .getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_SETBIRTHNAMEIFAVAILABLE, true);
- if (setBirthName) {
- final AlternativeNameType alternativeName = new AlternativeNameType();
- naturalPerson.setAlternativeName(alternativeName);
- alternativeName.setFamilyName(eidData.getBirthName());
- log.trace("Adding 'BirthName' to ERnB request ... ");
- }
- }
-
- return personInfo;
- }
-
- private SzrResultHolder requestSzrForIdentityLink(PersonInfoType personInfo) throws EaafException {
+ private SzrResultHolder requestSzrForIdentityLink(ErnpEidData eidData) throws EaafException {
//request IdentityLink from SZR
- final IdentityLinkType result = szrClient.getIdentityLinkInRawMode(personInfo);
+ final IdentityLinkType result = szrClient.getIdentityLinkInRawMode(eidData);
final Element idlFromSzr = (Element) result.getAssertion();
final IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSzr).parseIdentityLink();
@@ -316,7 +258,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
if (debugUseSzrForBpk) {
String no_vkz_defined = basicConfig
.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, "no VKZ defined");
- List<String> bpkList = szrClient.getBpk(personInfo, targetId, no_vkz_defined);
+ List<String> bpkList = szrClient.getBpk(eidData, targetId, no_vkz_defined);
if (!bpkList.isEmpty()) {
bpk = bpkList.get(0);
}