From fae5371d3431e2c7eda79771022a4212111ef9c1 Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Wed, 11 Jun 2014 17:04:31 +0200 Subject: update saml engine conf --- .../conf/moa-id/stork/StorkSamlEngine_VIDP.xml | 57 +++++++++++++++------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml b/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml index 5aff0d1fa..997f29c4a 100644 --- a/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml +++ b/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml @@ -23,10 +23,7 @@ - HTTP-POST - - - + HTTP-POST - false true - - http://S-PEPS.gov.xx + + https://testvidp.buergerkarte.at/moa-id-auth/stork2/SendPEPSAuthnRequest - - http://C-PEPS.gov.xx + + https://testvidp.buergerkarte.at/moa-id-auth/stork2/SendPEPSAuthnRequest - 300 + 600 false - + + + true http://www.stork.gov.eu/1.0/eIdentifier @@ -73,7 +71,6 @@ http://www.stork.gov.eu/1.0/pseudonym http://www.stork.gov.eu/1.0/age http://www.stork.gov.eu/1.0/isAgeOver - http://www.stork.gov.eu/1.0/fiscalNumber http://www.stork.gov.eu/1.0/textResidenceAddress http://www.stork.gov.eu/1.0/canonicalResidenceAddress @@ -86,10 +83,34 @@ http://www.stork.gov.eu/1.0/newAttribute1 http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - http://www.stork.gov.eu/1.0/representative - http://www.stork.gov.eu/1.0/represented - http://www.stork.gov.eu/1.0/mandateType - + http://www.stork.gov.eu/1.0/hasDegree + + + http://www.stork.gov.eu/1.0/diplomaSupplement + http://www.stork.gov.eu/1.0/currentStudiesSupplement + http://www.stork.gov.eu/1.0/isStudent + http://www.stork.gov.eu/1.0/isAcademicStaff + http://www.stork.gov.eu/1.0/isTeacherOf + http://www.stork.gov.eu/1.0/isCourseCoordinator + http://www.stork.gov.eu/1.0/isAdminStaff + http://www.stork.gov.eu/1.0/habilitation + http://www.stork.gov.eu/1.0/Title + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/hasAccountInBank + http://www.stork.gov.eu/1.0/isHealthCareProfessional + + http://www.stork.gov.eu/1.0/eLPIdentifier + http://www.stork.gov.eu/1.0/legalName + http://www.stork.gov.eu/1.0/alternativeName + http://www.stork.gov.eu/1.0/type + http://www.stork.gov.eu/1.0/translatableType + http://www.stork.gov.eu/1.0/status + http://www.stork.gov.eu/1.0/activity + http://www.stork.gov.eu/1.0/registeredAddress + http://www.stork.gov.eu/1.0/registeredCanonicalAddress + http://www.stork.gov.eu/1.0/contactInformation + http://www.stork.gov.eu/1.0/LPFiscalNumber + http://www.stork.gov.eu/1.0/mandate + + -- cgit v1.2.3 From 67946391a3b22689ad667d55720f8f105381c735 Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Wed, 11 Jun 2014 19:05:21 +0200 Subject: samlengine config adjustment; mandateprovider adjustment --- .../conf/moa-id/stork/StorkSamlEngine_VIDP.xml | 2 +- .../protocols/stork2/MandateRetrievalRequest.java | 115 ++++++++++++--------- .../MandateAttributeRequestProvider.java | 3 +- 3 files changed, 71 insertions(+), 49 deletions(-) diff --git a/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml b/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml index 997f29c4a..688ff0f19 100644 --- a/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml +++ b/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml @@ -111,6 +111,6 @@ http://www.stork.gov.eu/1.0/contactInformation http://www.stork.gov.eu/1.0/LPFiscalNumber http://www.stork.gov.eu/1.0/mandate - + http://www.stork.gov.eu/1.0/docRequest diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java index 811d828e1..95b59314d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java @@ -1,12 +1,11 @@ package at.gv.egovernment.moa.id.protocols.stork2; -import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; -import at.gv.egovernment.moa.id.data.IAuthData; -import at.gv.egovernment.moa.id.data.SLOInformationInterface; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; +import at.gv.egovernment.moa.id.data.IAuthData; +import at.gv.egovernment.moa.id.data.SLOInformationInterface; import at.gv.egovernment.moa.id.moduls.IAction; import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.logging.Logger; @@ -14,9 +13,10 @@ import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.PersonalAttributeList; import eu.stork.peps.auth.commons.STORKAttrQueryResponse; -import eu.stork.peps.complex.attributes.*; -import org.apache.xerces.impl.dv.DatatypeException; -import org.w3c.dom.Node; +import eu.stork.peps.complex.attributes.CanonicalAddressType; +import eu.stork.peps.complex.attributes.MandateContentType; +import eu.stork.peps.complex.attributes.MandateType; +import eu.stork.peps.complex.attributes.RepresentationPersonType; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,6 +30,7 @@ import javax.xml.namespace.QName; import java.io.StringWriter; import java.math.BigInteger; import java.util.ArrayList; +import java.util.Arrays; /** * @@ -69,7 +70,7 @@ public class MandateRetrievalRequest implements IAction { mandateContainer = new PhyPersonMandateContainer(new String(authData.getMISMandate().getMandate(), "UTF-8")); } catch (Exception ex2) { Logger.error("Could not extract data and create mandate container."); - throw new MOAIDException("stork.16", new Object[] {}); // TODO + throw new MOAIDException("stork.16", new Object[]{}); // TODO } } @@ -80,10 +81,6 @@ public class MandateRetrievalRequest implements IAction { } - - - - // moaStorkResponse.setPersonalAttributeList(populateAttributes()); //moaStorkResponse.setCountry(moaStorkRequest.getSpCountry()); @@ -98,37 +95,42 @@ public class MandateRetrievalRequest implements IAction { MandateContentType mandateContent = getMandateContent(mandateContainer, currentAttribute); attributeList.add(marshallComplexAttribute(currentAttribute, mandateContent)); - // final Marshaller marshaller = JAXBContext.newInstance(MandateContentType.class).createMarshaller(); - // marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + // final Marshaller marshaller = JAXBContext.newInstance(MandateContentType.class).createMarshaller(); + // marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - // StringWriter stringWriter = new StringWriter(); + // StringWriter stringWriter = new StringWriter(); - // marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", "mandateContent"), MandateContentType.class, null, mandateContent), stringWriter); + // marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", "mandateContent"), MandateContentType.class, null, mandateContent), stringWriter); - // ArrayList value = new ArrayList(); - // value.add(stringWriter.toString()); + // ArrayList value = new ArrayList(); + // value.add(stringWriter.toString()); - // PersonalAttribute mandateContentAttribute = new PersonalAttribute("mandateContent", false, value, "Available"); + // PersonalAttribute mandateContentAttribute = new PersonalAttribute("mandateContent", false, value, "Available"); - // attributeList.add(mandateContentAttribute); - } else - if (currentAttribute.getName().equals("representative")) { // TODO CHECK + // attributeList.add(mandateContentAttribute); + } else if (currentAttribute.getName().equals("representative")) { // TODO CHECK RepresentationPersonType representative = getRepresentative(mandateContainer, currentAttribute); attributeList.add(marshallComplexAttribute(currentAttribute, representative)); //attributeList.add(getRepresentative(mandateContainer, currentAttribute)); - } else - if (currentAttribute.getName().equals("represented")) { + } else if (currentAttribute.getName().equals("represented")) { //attributeList.add(getRepresented(mandateContainer, currentAttribute)); RepresentationPersonType represented = getRepresented(mandateContainer, currentAttribute); attributeList.add(marshallComplexAttribute(currentAttribute, represented)); - } else - if (currentAttribute.getName().equals("mandateType")) { + } else if (currentAttribute.getName().equals("mandate")) { //attributeList.add(getMandateType(mandateContainer, currentAttribute)); MandateType mandateType = getMandateType(mandateContainer, currentAttribute); attributeList.add(marshallComplexAttribute(currentAttribute, mandateType)); + } else if (currentAttribute.getName().equals("legalName")) { + String legalName = getLegalName(mandateContainer, currentAttribute); + PersonalAttribute personalAttribute = new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(legalName), "Available"); + attributeList.add(personalAttribute); + } else if (currentAttribute.getName().equals("eLPIdentifier")) { + String eLPIdentifier = geteLPIdentifier(mandateContainer, currentAttribute); + PersonalAttribute personalAttribute = new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(eLPIdentifier), "Available"); + attributeList.add(personalAttribute); } } @@ -165,24 +167,35 @@ public class MandateRetrievalRequest implements IAction { return null; // } + private String geteLPIdentifier(MandateContainer mandateContainer, PersonalAttribute currentAttribute) throws MOAIDException { + RepresentationPersonType represented = getRepresented(mandateContainer, currentAttribute); + if (mandateContainer instanceof CorporateBodyMandateContainer) { + return represented.getELPIdentifier(); + } else { + Logger.error("Cannot provide eLPIdentifier for natural person."); + throw new MOAIDException("stork.16", new Object[]{}); // TODO + } + + } + private PersonalAttribute marshallComplexAttribute(PersonalAttribute currentAttribute, Object obj) { // TODO refactor StringWriter stringWriter = new StringWriter(); try { - if (obj instanceof MandateContentType) { - final Marshaller marshaller = JAXBContext.newInstance(MandateContentType.class).createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", currentAttribute.getName()), MandateContentType.class, null, (MandateContentType)obj), stringWriter); - } else if (obj instanceof MandateType) { - final Marshaller marshaller = JAXBContext.newInstance(MandateType.class).createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", currentAttribute.getName()), MandateType.class, null, (MandateType)obj), stringWriter); - } else if (obj instanceof RepresentationPersonType) { - final Marshaller marshaller = JAXBContext.newInstance(RepresentationPersonType.class).createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", currentAttribute.getName()), RepresentationPersonType.class, null, (RepresentationPersonType)obj), stringWriter); - } + if (obj instanceof MandateContentType) { + final Marshaller marshaller = JAXBContext.newInstance(MandateContentType.class).createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", currentAttribute.getName()), MandateContentType.class, null, (MandateContentType) obj), stringWriter); + } else if (obj instanceof MandateType) { + final Marshaller marshaller = JAXBContext.newInstance(MandateType.class).createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", currentAttribute.getName()), MandateType.class, null, (MandateType) obj), stringWriter); + } else if (obj instanceof RepresentationPersonType) { + final Marshaller marshaller = JAXBContext.newInstance(RepresentationPersonType.class).createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + marshaller.marshal(new JAXBElement(new QName("urn:eu:stork:names:tc:STORK:1.0:assertion", currentAttribute.getName()), RepresentationPersonType.class, null, (RepresentationPersonType) obj), stringWriter); + } } catch (Exception ex) { Logger.error("Could not marshall atrribute: " + currentAttribute.getName() + ", " + ex.getMessage()); @@ -191,15 +204,14 @@ public class MandateRetrievalRequest implements IAction { ArrayList value = new ArrayList(); value.add(stringWriter.toString()); - PersonalAttribute personalAttribute = new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), value, "Available"); + PersonalAttribute personalAttribute = new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), value, "Available"); return personalAttribute; } - private String mapPowersType(MandateContainer mandateContainer) { // TODO - return ""; + return ""; } private String mapCompanyType(MandateContainer mandateContainer) { // TODO @@ -208,7 +220,7 @@ public class MandateRetrievalRequest implements IAction { private MandateType getMandateType(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) throws MOAIDException { MandateType mandateType = new MandateType(); - RepresentationPersonType representative = getRepresentative(mandateContainer, sourceAttribute); + RepresentationPersonType representative = getRepresentative(mandateContainer, sourceAttribute); RepresentationPersonType represented = getRepresented(mandateContainer, sourceAttribute); MandateContentType mandateContent = getMandateContent(mandateContainer, sourceAttribute); mandateType.setRepresenting(representative); @@ -218,6 +230,16 @@ public class MandateRetrievalRequest implements IAction { return mandateType; } + private String getLegalName(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) throws MOAIDException { + RepresentationPersonType represented = getRepresented(mandateContainer, sourceAttribute); + if (mandateContainer instanceof CorporateBodyMandateContainer) { + return represented.getName(); + } else { + Logger.error("Cannot provide legalName for natural person."); + throw new MOAIDException("stork.16", new Object[]{}); // TODO + } + } + private RepresentationPersonType getRepresentative(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) { RepresentationPersonType representative = new RepresentationPersonType(); @@ -235,14 +257,14 @@ public class MandateRetrievalRequest implements IAction { RepresentationPersonType represented = new RepresentationPersonType(); if (mandateContainer instanceof CorporateBodyMandateContainer) { - CorporateBodyMandateContainer corporateBodyMandateContainer = (CorporateBodyMandateContainer)mandateContainer; + CorporateBodyMandateContainer corporateBodyMandateContainer = (CorporateBodyMandateContainer) mandateContainer; represented.setELPIdentifier(corporateBodyMandateContainer.getCorpMandatorIdentificationValue()); represented.setName(corporateBodyMandateContainer.getCorpMandatorFullName()); represented.setAddress(""); represented.setCanonicalAddress(new CanonicalAddressType()); represented.setType(mapCompanyType(mandateContainer)); // TODO } else if (mandateContainer instanceof PhyPersonMandateContainer) { - PhyPersonMandateContainer phyPersonMandateContainer = (PhyPersonMandateContainer)mandateContainer; + PhyPersonMandateContainer phyPersonMandateContainer = (PhyPersonMandateContainer) mandateContainer; represented.setEIdentifier(""); // TODO CALCULATE represented.setGivenName(phyPersonMandateContainer.getPhyPersMandatorGivenName()); represented.setSurname(phyPersonMandateContainer.getPhyPersMandatorFamilyName()); @@ -260,13 +282,12 @@ public class MandateRetrievalRequest implements IAction { try { XMLGregorianCalendar validFrom = DatatypeFactory.newInstance().newXMLGregorianCalendar(mandateContainer.getMandateValidFrom()); - XMLGregorianCalendar validTo = DatatypeFactory.newInstance().newXMLGregorianCalendar(mandateContainer.getMandateValidTo()); + XMLGregorianCalendar validTo = DatatypeFactory.newInstance().newXMLGregorianCalendar(mandateContainer.getMandateValidTo()); mandateContent.setValidFrom(validFrom); mandateContent.setValidTo(validTo); } catch (DatatypeConfigurationException dte) { Logger.error("Error converting data from mandate"); - throw new MOAIDException("stork.16", new Object[] {}); // TODO - + throw new MOAIDException("stork.16", new Object[]{}); // TODO } mandateContent.setTransactionLimit(BigInteger.valueOf(0)); // TODO diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java index 49250df6b..d08720f83 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java @@ -113,7 +113,7 @@ public class MandateAttributeRequestProvider extends AttributeProvider { attributeRequest.setPersonalAttributeList(requestedAttributes); attributeRequest.setCitizenCountryCode("AT"); - + attributeRequest.setQaa(4); @@ -122,6 +122,7 @@ public class MandateAttributeRequestProvider extends AttributeProvider { STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("VIDP"); try { + attributeRequest = samlEngine.generateSTORKAttrQueryRequest(attributeRequest); } catch (STORKSAMLEngineException e) { Logger.error("Could not sign STORK SAML AttrRequest.", e); -- cgit v1.2.3 From f3f63f3cc1ab3c427a884df739b495cb9e6bc0b1 Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Thu, 12 Jun 2014 14:15:59 +0200 Subject: updated docs --- .../stork/VIDP Installation Manual_STORK2_v0.1.docx | Bin 359785 -> 0 bytes .../stork/VIDP Installation Manual_STORK2_v0.1.pdf | Bin 1182681 -> 0 bytes .../stork/VIDP Installation Manual_STORK2_v0.2.docx | Bin 0 -> 2479329 bytes .../stork/VIDP Installation Manual_STORK2_v0.2.pdf | Bin 0 -> 1411275 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.docx delete mode 100644 id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.pdf create mode 100644 id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.docx create mode 100644 id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.pdf diff --git a/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.docx b/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.docx deleted file mode 100644 index 8cc7e2c0b..000000000 Binary files a/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.docx and /dev/null differ diff --git a/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.pdf b/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.pdf deleted file mode 100644 index f213698a7..000000000 Binary files a/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.1.pdf and /dev/null differ diff --git a/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.docx b/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.docx new file mode 100644 index 000000000..249d13cae Binary files /dev/null and b/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.docx differ diff --git a/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.pdf b/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.pdf new file mode 100644 index 000000000..e199f1810 Binary files /dev/null and b/id/server/doc/stork/VIDP Installation Manual_STORK2_v0.2.pdf differ -- cgit v1.2.3