aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/eID4UExtensions/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/modules/eID4UExtensions/src/main/java/at')
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/Definitions.java71
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/IdType.java49
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/MaritalState.java52
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractDateTimeAttributeValueMarshaller.java44
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractStringAttributeMarshaller.java49
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/DocumentAttributeValue.java15
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/EhicIdTypeAttributeValueMarshaller.java26
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValue.java14
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValueMarshaller.java26
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValue.java14
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java26
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NationalityTypeAttributeValueMarshaller.java26
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NonValidatingStringAttributeValueMarshaller.java17
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/PhotoTypeAttributeValueMarshaller.java67
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/RFC822MailboxTypeAttributeValueMarshaller.java26
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/TaxIdentificationNumberType.java27
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/Document.java151
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/DocumentTypeType.java58
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/MimeTypeEnumeration.java67
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/ObjectFactory.java47
-rw-r--r--id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/package-info.java9
21 files changed, 881 insertions, 0 deletions
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/Definitions.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/Definitions.java
new file mode 100644
index 000000000..b7c79d76e
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/Definitions.java
@@ -0,0 +1,71 @@
+package at.gv.egiz.eid4u.api.attributes;
+
+public class Definitions {
+
+ /*Prefix and Schema definitions for eIDU specific eIDAS extensions */
+ public static final String SCHEMA_ROOT = "/schema/eid4u/";
+
+ public static final String SAML2_eID4U_CORE_EXTENSIONS_PREFIX = "eid4u";
+ public static final String SAML2_eID4U_CORE_EXTENSIONS = "http://eidas.europa.eu/attributes/sectorspecific/eid4u";
+ public static final String SAML2_eID4U_CORE_EXTENSIONS_SCHEMA_LOCATION = SCHEMA_ROOT + "eID4U_attributes_generic.xsd";
+
+ public static final String SAML2_eID4U_PERSON_EXTENSIONS_PREFIX = "eid4uP";
+ public static final String SAML2_eID4U_PERSON_EXTENSIONS = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson";
+ public static final String SAML2_eID4U_PERSON_EXTENSIONS_SCHEMA_LOCATION = SCHEMA_ROOT + "eID4U_attributes_person.xsd";
+
+ public static final String SAML2_eID4U_STUDIES_EXTENSIONS_PREFIX = "eid4uS";
+ public static final String SAML2_eID4U_STUDIES_EXTENSIONS = "http://eidas.europa.eu/attributes/sectorspecific/eID4U/studies";
+ public static final String SAML2_eID4U_STUDIES_EXTENSIONS_SCHEMA_LOCATION = SCHEMA_ROOT + "eID4U_attributes_studies.xsd";
+
+ public static final String SAML2_eID4U_EXT_EUROPASS3_PREFIX = "europass3";
+ public static final String SAML2_eID4U_EXT_EUROPASS3_EXTENSIONS = "http://europass.cedefop.europa.eu/Europass";
+ public static final String SAML2_eID4U_EXT_EUROPASS3_EXTENSIONS_SCHEMA_LOCATION = SCHEMA_ROOT + "external/EuropassSchema.xsd";
+
+
+ //attribute types
+ public static final String IDTYPE_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/id/Type";
+ public static final String IDTYPE_FRIENDLYNAME = "IdType";
+
+ public static final String IDNUMBER_NAME = "http://eidas:europa:eu/attributes/sectorspecific/eid4u/naturalperson/id/Number";
+ public static final String IDNUMBER_FRIENDLYNAME = "IdNumber";
+
+ public static final String IDISSUER_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/id/Issuer";
+ public static final String IDISSUER_FRIENDLYNAME = "IdIssuer";
+
+ public static final String IDEXPIREDATE_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/id/ExpiryDate";
+ public static final String IDEXPIREDATE_FRIENDLYNAME = "IdExpiryDate";
+
+ public static final String EHICID_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/EhicId";
+ public static final String EHICID_FRIENDLYNAME = "EhicId";
+
+ public static final String NATIONALITY_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/Nationality";
+ public static final String NATIONALITY_FRIENDLYNAME = "Nationality";
+
+ public static final String MARITALSTATE_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/MaritalState";
+ public static final String MARITALSTATE_FRIENDLYNAME = "MaritalState";
+
+ public static final String COUNTRYOFBIRTH_NAME = "http://eidas:europa:eu/attributes/sectorspecific/eid4u/naturalperson/CountryOfBirth";
+ public static final String COUNTRYOFBIRTH_FRIENDLYNAME = "CountryOfBirth";
+
+ public static final String EMAIL_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/Email";
+ public static final String EMAIL_FRIENDLYNAME = "Email";
+
+ public static final String PHONE_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/Phone";
+ public static final String PHONE_FRIENDLYNAME = "Phone";
+
+ public static final String TEMPORARYADDRESS_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/TemporaryAddress";
+ public static final String TEMPORARYADDRESS_FRIENDLYNAME = "TemporaryAddress";
+
+ public static final String CURRENTPHOTO_NAME = "http://eidas.europa.eu/attributes/sectorspecific/eid4u/naturalperson/CurrentPhoto";
+ public static final String CURRENTPHOTO_FRIENDLYNAME = "CurrentPhoto";
+
+ public static final String TAXIDENTIFICATIONNUMBER_NAME = "http://eidas.europa.eu/attributes/sectorspecific/naturalperson/TaxIdentificationNumber";
+ public static final String TAXIDENTIFICATIONNUMBER_FRIENDLYNAME = "TaxIdentificationNumber";
+
+ public static final String HOMEINSTITUTIONNAMER_NAME = "http://eidas:europa:eu/attributes/sectorspecific/eid4u/studies/homeinsitution/Name";
+ public static final String HOMEINSTITUTIONNAMER_FRIENDLYNAME = "HomeInstitutionNamer";
+
+// public static final String _NAME = "";
+// public static final String _FRIENDLYNAME = "";
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/IdType.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/IdType.java
new file mode 100644
index 000000000..0937826a3
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/IdType.java
@@ -0,0 +1,49 @@
+package at.gv.egiz.eid4u.api.attributes.natural;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import eu.eidas.auth.commons.lang.Canonicalizers;
+import eu.eidas.auth.commons.lang.EnumMapper;
+import eu.eidas.auth.commons.lang.KeyAccessor;
+
+public enum IdType {
+ PASSPORT("Passport"),
+ NATIONALIDCARD("National Identity Card");
+
+ private static final EnumMapper<String, IdType> MAPPER =
+ new EnumMapper<String, IdType>(new KeyAccessor<String, IdType>() {
+
+ @Nonnull
+ @Override
+ public String getKey(@Nonnull IdType gender) {
+ return gender.getValue();
+ }
+ }, Canonicalizers.trimLowerCase(), values());
+
+ @Nullable
+ public static IdType fromString(@Nonnull String val) {
+ return MAPPER.fromKey(val);
+ }
+
+ public static EnumMapper<String, IdType> mapper() {
+ return MAPPER;
+ }
+
+ @Nonnull
+ private final transient String value;
+
+ IdType(@Nonnull String value) {
+ this.value = value;
+ }
+
+ @Nonnull
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/MaritalState.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/MaritalState.java
new file mode 100644
index 000000000..af27965b2
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/api/attributes/natural/MaritalState.java
@@ -0,0 +1,52 @@
+package at.gv.egiz.eid4u.api.attributes.natural;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import eu.eidas.auth.commons.lang.Canonicalizers;
+import eu.eidas.auth.commons.lang.EnumMapper;
+import eu.eidas.auth.commons.lang.KeyAccessor;
+
+public enum MaritalState {
+ SINGLE("Single"),
+ MARRIED("Married"),
+ DIVORCED("Divorced"),
+ WIDOWED("Widowed"),
+ CIVILUNION("Civil Union");
+
+ private static final EnumMapper<String, MaritalState> MAPPER =
+ new EnumMapper<String, MaritalState>(new KeyAccessor<String, MaritalState>() {
+
+ @Nonnull
+ @Override
+ public String getKey(@Nonnull MaritalState mstate) {
+ return mstate.getValue();
+ }
+ }, Canonicalizers.trimLowerCase(), values());
+
+ @Nullable
+ public static MaritalState fromString(@Nonnull String val) {
+ return MAPPER.fromKey(val);
+ }
+
+ public static EnumMapper<String, MaritalState> mapper() {
+ return MAPPER;
+ }
+
+ @Nonnull
+ private final transient String value;
+
+ MaritalState(@Nonnull String value) {
+ this.value = value;
+ }
+
+ @Nonnull
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractDateTimeAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractDateTimeAttributeValueMarshaller.java
new file mode 100644
index 000000000..7916c200d
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractDateTimeAttributeValueMarshaller.java
@@ -0,0 +1,44 @@
+package at.gv.egiz.eid4u.impl.attributes;
+
+import java.util.Locale;
+
+import javax.annotation.Nonnull;
+
+import org.joda.time.DateTime;
+import org.joda.time.chrono.ISOChronology;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+
+import eu.eidas.auth.commons.attribute.AttributeValue;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshaller;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException;
+import eu.eidas.auth.commons.attribute.impl.DateTimeAttributeValue;
+
+public abstract class AbstractDateTimeAttributeValueMarshaller implements AttributeValueMarshaller<DateTime>{
+
+ private static final DateTimeFormatter FORMAT = DateTimeFormat.forPattern("yyyy-MM-dd")
+ .withChronology(ISOChronology.getInstance())
+ .withLocale(Locale.ENGLISH)
+ .withZoneUTC();
+
+ public static String printDateTime(@Nonnull DateTime dateTime) {
+ return FORMAT.print(dateTime);
+ }
+
+ @Nonnull
+ @Override
+ public String marshal(@Nonnull AttributeValue<DateTime> value) {
+ return printDateTime(value.getValue());
+ }
+
+ @Nonnull
+ @Override
+ public AttributeValue<DateTime> unmarshal(@Nonnull String value, boolean isNonLatinScriptAlternateVersion)
+ throws AttributeValueMarshallingException {
+ try {
+ return new DateTimeAttributeValue(FORMAT.parseDateTime(value));
+ } catch (IllegalArgumentException iae) {
+ throw new AttributeValueMarshallingException(iae);
+ }
+ }
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractStringAttributeMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractStringAttributeMarshaller.java
new file mode 100644
index 000000000..c5a019aa2
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/AbstractStringAttributeMarshaller.java
@@ -0,0 +1,49 @@
+package at.gv.egiz.eid4u.impl.attributes;
+
+import eu.eidas.auth.commons.attribute.AttributeValue;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshaller;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException;
+import eu.eidas.auth.commons.attribute.impl.StringAttributeValue;
+
+public abstract class AbstractStringAttributeMarshaller implements AttributeValueMarshaller<String> {
+
+ @Override
+ public String marshal(AttributeValue<String> value) throws AttributeValueMarshallingException {
+ String result = value.getValue();
+
+ //to validation
+ if (!hasValidForm(result))
+ throw new AttributeValueMarshallingException(
+ "Illegal " + getName() + " value \"" + result + "\"");
+
+ return result;
+ }
+
+ @Override
+ public AttributeValue<String> unmarshal(String value, boolean isNonLatinScriptAlternateVersion)
+ throws AttributeValueMarshallingException {
+
+ //to validation
+ if (!hasValidForm(value))
+ throw new AttributeValueMarshallingException(
+ "Illegal " + getName() + " value \"" + value + "\"");
+
+ return new StringAttributeValue(value);
+ }
+
+ /**
+ * Validate a String attribute if required
+ *
+ * @param value String based attribute value
+ * @return true if valid, otherwise false
+ */
+ abstract protected boolean hasValidForm(String value);
+
+ /**
+ * Get the name of the attribute mashaller
+ *
+ * @return
+ */
+ abstract protected String getName();
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/DocumentAttributeValue.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/DocumentAttributeValue.java
new file mode 100644
index 000000000..d430c55e2
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/DocumentAttributeValue.java
@@ -0,0 +1,15 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import at.gv.egiz.eid4u.impl.attributes.xjc.Document;
+import eu.eidas.auth.commons.attribute.impl.AbstractAttributeValue;
+
+public class DocumentAttributeValue extends AbstractAttributeValue<Document>{
+
+ private static final long serialVersionUID = 1L;
+
+ protected DocumentAttributeValue(Document val, boolean nonLatinScriptAlternateVer) {
+ super(val, false);
+
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/EhicIdTypeAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/EhicIdTypeAttributeValueMarshaller.java
new file mode 100644
index 000000000..7da25adbc
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/EhicIdTypeAttributeValueMarshaller.java
@@ -0,0 +1,26 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.AbstractStringAttributeMarshaller;
+
+public class EhicIdTypeAttributeValueMarshaller extends AbstractStringAttributeMarshaller {
+
+ private static final String PATTERN = "^80[0-9]{18}$";
+ private static final Pattern p = Pattern.compile(PATTERN);
+
+ @Override
+ protected boolean hasValidForm(String value) {
+ Matcher matcher = p.matcher(value);
+ return matcher.matches();
+
+ }
+
+ @Override
+ protected String getName() {
+ return Definitions.EHICID_FRIENDLYNAME;
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValue.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValue.java
new file mode 100644
index 000000000..9b08c5f00
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValue.java
@@ -0,0 +1,14 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import at.gv.egiz.eid4u.api.attributes.natural.IdType;
+import eu.eidas.auth.commons.attribute.impl.AbstractAttributeValue;
+
+public final class IdTypeAttributeValue extends AbstractAttributeValue<IdType>{
+
+ private static final long serialVersionUID = -4215108790225070526L;
+
+ protected IdTypeAttributeValue(IdType val) {
+ super(val, true);
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValueMarshaller.java
new file mode 100644
index 000000000..d5f325632
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/IdTypeAttributeValueMarshaller.java
@@ -0,0 +1,26 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import at.gv.egiz.eid4u.api.attributes.natural.IdType;
+import eu.eidas.auth.commons.attribute.AttributeValue;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshaller;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException;
+
+public final class IdTypeAttributeValueMarshaller implements AttributeValueMarshaller<IdType> {
+
+ @Override
+ public String marshal(AttributeValue<IdType> value) throws AttributeValueMarshallingException {
+ return value.getValue().getValue();
+
+ }
+
+ @Override
+ public AttributeValue<IdType> unmarshal(String value, boolean isNonLatinScriptAlternateVersion)
+ throws AttributeValueMarshallingException {
+ IdType idType = IdType.fromString(value);
+ if (null == idType) {
+ throw new AttributeValueMarshallingException("Illegal IdType value \"" + value + "\"");
+ }
+ return new IdTypeAttributeValue(idType);
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValue.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValue.java
new file mode 100644
index 000000000..6ef73dca3
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValue.java
@@ -0,0 +1,14 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import at.gv.egiz.eid4u.api.attributes.natural.MaritalState;
+import eu.eidas.auth.commons.attribute.impl.AbstractAttributeValue;
+
+public final class MaritalStateAttributeValue extends AbstractAttributeValue<MaritalState>{
+
+ private static final long serialVersionUID = -4215108790225070526L;
+
+ protected MaritalStateAttributeValue(MaritalState val) {
+ super(val, true);
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java
new file mode 100644
index 000000000..afa8d4d06
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java
@@ -0,0 +1,26 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import at.gv.egiz.eid4u.api.attributes.natural.MaritalState;
+import eu.eidas.auth.commons.attribute.AttributeValue;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshaller;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException;
+
+public final class MaritalStateAttributeValueMarshaller implements AttributeValueMarshaller<MaritalState> {
+
+ @Override
+ public String marshal(AttributeValue<MaritalState> value) throws AttributeValueMarshallingException {
+ return value.getValue().getValue();
+
+ }
+
+ @Override
+ public AttributeValue<MaritalState> unmarshal(String value, boolean isNonLatinScriptAlternateVersion)
+ throws AttributeValueMarshallingException {
+ MaritalState idType = MaritalState.fromString(value);
+ if (null == idType) {
+ throw new AttributeValueMarshallingException("Illegal MaritalState value \"" + value + "\"");
+ }
+ return new MaritalStateAttributeValue(idType);
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NationalityTypeAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NationalityTypeAttributeValueMarshaller.java
new file mode 100644
index 000000000..d9b55cf2f
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NationalityTypeAttributeValueMarshaller.java
@@ -0,0 +1,26 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.AbstractStringAttributeMarshaller;
+
+public class NationalityTypeAttributeValueMarshaller extends AbstractStringAttributeMarshaller {
+
+ private static final String PATTERN = "^[A-Z]{2}$";
+ private static final Pattern p = Pattern.compile(PATTERN);
+
+ @Override
+ protected boolean hasValidForm(String value) {
+ Matcher matcher = p.matcher(value);
+ return matcher.matches();
+
+ }
+
+ @Override
+ protected String getName() {
+ return Definitions.NATIONALITY_FRIENDLYNAME;
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NonValidatingStringAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NonValidatingStringAttributeValueMarshaller.java
new file mode 100644
index 000000000..b19a6b661
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/NonValidatingStringAttributeValueMarshaller.java
@@ -0,0 +1,17 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import at.gv.egiz.eid4u.impl.attributes.AbstractStringAttributeMarshaller;
+
+public class NonValidatingStringAttributeValueMarshaller extends AbstractStringAttributeMarshaller {
+
+ @Override
+ protected boolean hasValidForm(String value) {
+ return true;
+ }
+
+ @Override
+ protected String getName() {
+ return "GenericStringAttribute";
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/PhotoTypeAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/PhotoTypeAttributeValueMarshaller.java
new file mode 100644
index 000000000..59f1817a4
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/PhotoTypeAttributeValueMarshaller.java
@@ -0,0 +1,67 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import at.gv.egiz.eid4u.impl.attributes.xjc.Document;
+import eu.eidas.auth.commons.EidasStringUtil;
+import eu.eidas.auth.commons.attribute.AttributeValue;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshaller;
+import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException;
+
+public class PhotoTypeAttributeValueMarshaller implements AttributeValueMarshaller<Document>{
+
+ @Override
+ public String marshal(AttributeValue<Document> value) throws AttributeValueMarshallingException {
+ try {
+ JAXBContext context = JAXBContext.newInstance(Document.class);
+ Marshaller m = context.createMarshaller();
+ StringWriter sw = new StringWriter();
+ m.marshal(value, sw);
+ return EidasStringUtil.encodeToBase64(sw.toString());
+
+ } catch (JAXBException e) {
+ throw new AttributeValueMarshallingException("Can NOT create JAXB marshaller for type 'Document'", e);
+
+ }
+
+ }
+
+ @Override
+ public AttributeValue<Document> unmarshal(String value, boolean isNonLatinScriptAlternateVersion)
+ throws AttributeValueMarshallingException {
+ try {
+ Reader reader = new StringReader(EidasStringUtil.decodeStringFromBase64(value));
+
+ //initialize XML reader to prevent XXE
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
+ xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
+ XMLStreamReader xmlReader = xif.createXMLStreamReader(reader);
+
+ //unmarshal
+ JAXBContext context = JAXBContext.newInstance(Document.class);
+ Unmarshaller um = context.createUnmarshaller();
+ Object obj = um.unmarshal(xmlReader);
+
+ if (!(obj instanceof Document))
+ throw new AttributeValueMarshallingException("Unmarshalled result is NOT of type 'Document'");
+
+ return new DocumentAttributeValue((Document)obj, isNonLatinScriptAlternateVersion);
+
+ } catch (JAXBException | XMLStreamException e) {
+ throw new AttributeValueMarshallingException("Can NOT create JAXB unmarshaller for type 'Document'", e);
+
+ }
+
+ }
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/RFC822MailboxTypeAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/RFC822MailboxTypeAttributeValueMarshaller.java
new file mode 100644
index 000000000..05448d35d
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/RFC822MailboxTypeAttributeValueMarshaller.java
@@ -0,0 +1,26 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.AbstractStringAttributeMarshaller;
+
+public class RFC822MailboxTypeAttributeValueMarshaller extends AbstractStringAttributeMarshaller {
+
+ private static final String PATTERN = "[^@]+@[^\\.]+\\..+";
+ private static final Pattern p = Pattern.compile(PATTERN);
+
+ @Override
+ protected boolean hasValidForm(String value) {
+ Matcher matcher = p.matcher(value);
+ return matcher.matches();
+
+ }
+
+ @Override
+ protected String getName() {
+ return Definitions.EMAIL_NAME;
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/TaxIdentificationNumberType.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/TaxIdentificationNumberType.java
new file mode 100644
index 000000000..2b4bb6378
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/TaxIdentificationNumberType.java
@@ -0,0 +1,27 @@
+package at.gv.egiz.eid4u.impl.attributes.natural;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.AbstractStringAttributeMarshaller;
+
+public final class TaxIdentificationNumberType extends AbstractStringAttributeMarshaller {
+
+ private static final String PATTERN = "^[A-Z]{2}/[a-zA-Z0-9].*";
+ private static final Pattern p = Pattern.compile(PATTERN);
+
+ @Override
+ protected boolean hasValidForm(String value) {
+ Matcher matcher = p.matcher(value);
+ return matcher.matches();
+
+ }
+
+ @Override
+ protected String getName() {
+ return Definitions.TAXIDENTIFICATIONNUMBER_FRIENDLYNAME;
+
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/Document.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/Document.java
new file mode 100644
index 000000000..50dfbdd00
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/Document.java
@@ -0,0 +1,151 @@
+//
+// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170531.0717 generiert
+// Siehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a>
+// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
+// Generiert: 2018.09.28 um 08:08:57 AM CEST
+//
+
+
+package at.gv.egiz.eid4u.impl.attributes.xjc;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+
+/**
+ * <p>Java-Klasse f�r anonymous complex type.
+ *
+ * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
+ *
+ * <pre>
+ * &lt;complexType&gt;
+ * &lt;simpleContent&gt;
+ * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema&gt;base64Binary"&gt;
+ * &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
+ * &lt;attribute name="type" use="required" type="{http://eidas.europa.eu/attributes/sectorspecific/eid4u}DocumentTypeType" /&gt;
+ * &lt;attribute name="contentType" use="required" type="{http://europass.cedefop.europa.eu/Europass}MimeTypeEnumeration" /&gt;
+ * &lt;/extension&gt;
+ * &lt;/simpleContent&gt;
+ * &lt;/complexType&gt;
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "value"
+})
+@XmlRootElement(name = "document", namespace = "http://eidas.europa.eu/attributes/sectorspecific/eid4u")
+public class Document implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @XmlValue
+ protected byte[] value;
+ @XmlAttribute(name = "name", required = true)
+ protected String name;
+ @XmlAttribute(name = "type", required = true)
+ protected DocumentTypeType type;
+ @XmlAttribute(name = "contentType", required = true)
+ protected MimeTypeEnumeration contentType;
+
+ /**
+ * Ruft den Wert der value-Eigenschaft ab.
+ *
+ * @return
+ * possible object is
+ * byte[]
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
+ /**
+ * Legt den Wert der value-Eigenschaft fest.
+ *
+ * @param value
+ * allowed object is
+ * byte[]
+ */
+ public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+ /**
+ * Ruft den Wert der name-Eigenschaft ab.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Legt den Wert der name-Eigenschaft fest.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Ruft den Wert der type-Eigenschaft ab.
+ *
+ * @return
+ * possible object is
+ * {@link DocumentTypeType }
+ *
+ */
+ public DocumentTypeType getType() {
+ return type;
+ }
+
+ /**
+ * Legt den Wert der type-Eigenschaft fest.
+ *
+ * @param value
+ * allowed object is
+ * {@link DocumentTypeType }
+ *
+ */
+ public void setType(DocumentTypeType value) {
+ this.type = value;
+ }
+
+ /**
+ * Ruft den Wert der contentType-Eigenschaft ab.
+ *
+ * @return
+ * possible object is
+ * {@link MimeTypeEnumeration }
+ *
+ */
+ public MimeTypeEnumeration getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Legt den Wert der contentType-Eigenschaft fest.
+ *
+ * @param value
+ * allowed object is
+ * {@link MimeTypeEnumeration }
+ *
+ */
+ public void setContentType(MimeTypeEnumeration value) {
+ this.contentType = value;
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/DocumentTypeType.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/DocumentTypeType.java
new file mode 100644
index 000000000..499fcf7ff
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/DocumentTypeType.java
@@ -0,0 +1,58 @@
+//
+// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170531.0717 generiert
+// Siehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a>
+// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
+// Generiert: 2018.09.28 um 08:08:57 AM CEST
+//
+
+
+package at.gv.egiz.eid4u.impl.attributes.xjc;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java-Klasse für DocumentTypeType.
+ *
+ * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="DocumentTypeType"&gt;
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
+ * &lt;enumeration value="photo"/&gt;
+ * &lt;enumeration value="certificate"/&gt;
+ * &lt;/restriction&gt;
+ * &lt;/simpleType&gt;
+ * </pre>
+ *
+ */
+@XmlType(name = "DocumentTypeType", namespace = "http://eidas.europa.eu/attributes/sectorspecific/eid4u")
+@XmlEnum
+public enum DocumentTypeType {
+
+ @XmlEnumValue("photo")
+ PHOTO("photo"),
+ @XmlEnumValue("certificate")
+ CERTIFICATE("certificate");
+ private final String value;
+
+ DocumentTypeType(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ public static DocumentTypeType fromValue(String v) {
+ for (DocumentTypeType c: DocumentTypeType.values()) {
+ if (c.value.equals(v)) {
+ return c;
+ }
+ }
+ throw new IllegalArgumentException(v);
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/MimeTypeEnumeration.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/MimeTypeEnumeration.java
new file mode 100644
index 000000000..d760ca268
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/MimeTypeEnumeration.java
@@ -0,0 +1,67 @@
+//
+// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170531.0717 generiert
+// Siehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a>
+// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
+// Generiert: 2018.09.28 um 08:08:57 AM CEST
+//
+
+
+package at.gv.egiz.eid4u.impl.attributes.xjc;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java-Klasse für MimeTypeEnumeration.
+ *
+ * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="MimeTypeEnumeration"&gt;
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt;
+ * &lt;enumeration value="image/jpeg"/&gt;
+ * &lt;enumeration value="image/pjpeg"/&gt;
+ * &lt;enumeration value="image/png"/&gt;
+ * &lt;enumeration value="image/x-png"/&gt;
+ * &lt;enumeration value="application/pdf"/&gt;
+ * &lt;/restriction&gt;
+ * &lt;/simpleType&gt;
+ * </pre>
+ *
+ */
+@XmlType(name = "MimeTypeEnumeration")
+@XmlEnum
+public enum MimeTypeEnumeration {
+
+ @XmlEnumValue("image/jpeg")
+ IMAGE_JPEG("image/jpeg"),
+ @XmlEnumValue("image/pjpeg")
+ IMAGE_PJPEG("image/pjpeg"),
+ @XmlEnumValue("image/png")
+ IMAGE_PNG("image/png"),
+ @XmlEnumValue("image/x-png")
+ IMAGE_X_PNG("image/x-png"),
+ @XmlEnumValue("application/pdf")
+ APPLICATION_PDF("application/pdf");
+ private final String value;
+
+ MimeTypeEnumeration(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ public static MimeTypeEnumeration fromValue(String v) {
+ for (MimeTypeEnumeration c: MimeTypeEnumeration.values()) {
+ if (c.value.equals(v)) {
+ return c;
+ }
+ }
+ throw new IllegalArgumentException(v);
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/ObjectFactory.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/ObjectFactory.java
new file mode 100644
index 000000000..9b54376f7
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/ObjectFactory.java
@@ -0,0 +1,47 @@
+//
+// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170531.0717 generiert
+// Siehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a>
+// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
+// Generiert: 2018.09.28 um 08:08:57 AM CEST
+//
+
+
+package at.gv.egiz.eid4u.impl.attributes.xjc;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the at.gv.egiz.eid4u.impl.attributes.xjc package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: at.gv.egiz.eid4u.impl.attributes.xjc
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link Document }
+ *
+ */
+ public Document createDocument() {
+ return new Document();
+ }
+
+}
diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/package-info.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/package-info.java
new file mode 100644
index 000000000..18f2ef3f0
--- /dev/null
+++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/xjc/package-info.java
@@ -0,0 +1,9 @@
+//
+// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-b170531.0717 generiert
+// Siehe <a href="https://jaxb.java.net/">https://jaxb.java.net/</a>
+// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
+// Generiert: 2018.09.28 um 08:08:57 AM CEST
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://europass.cedefop.europa.eu/Europass", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package at.gv.egiz.eid4u.impl.attributes.xjc;