aboutsummaryrefslogtreecommitdiff
path: root/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/dto/attributes/Type.java
diff options
context:
space:
mode:
Diffstat (limited to 'modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/dto/attributes/Type.java')
-rw-r--r--modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/dto/attributes/Type.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/dto/attributes/Type.java b/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/dto/attributes/Type.java
new file mode 100644
index 00000000..6a06a5b5
--- /dev/null
+++ b/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/dto/attributes/Type.java
@@ -0,0 +1,91 @@
+
+package at.asitplus.eidas.specific.modules.msproxyservice.dto.attributes;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+import lombok.Data;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "mds",
+ "autoIncludeWithMandates",
+ "mandator"
+})
+@Data
+public class Type {
+
+ /**
+ * <code>true</code> if this attribute is part of MDS, otherwise <code>false</code>.
+ */
+ @JsonProperty("mds")
+ private Boolean mds;
+
+ /**
+ * <code>true</code> if that attribute has to be included into eIDAS response in case of mandates.
+ */
+ @JsonProperty("autoIncludeWithMandates")
+ private Boolean autoIncludeWithMandates;
+
+ /**
+ * Classifie that attribute to specific mandate modes.
+ */
+ @JsonProperty("mandator")
+ private Type.Mandator mandator;
+
+ /**
+ * Mandate type in case of a mandate attriute.
+ */
+ public enum Mandator {
+ BOTH("both"),
+ LEGAL("legal"),
+ NATURAL("natural"),
+ NONE("none");
+
+ private final String value;
+ private static final Map<String, Type.Mandator> CONSTANTS = new HashMap<>();
+
+ static {
+ for (final Type.Mandator c : values()) {
+ CONSTANTS.put(c.value, c);
+ }
+ }
+
+ Mandator(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+
+ /**
+ * Build {@link Mandator} from textual representation.
+ *
+ * @param value textual representation
+ * @return Type of the mandator
+ */
+ @JsonCreator
+ public static Type.Mandator fromValue(String value) {
+ final Type.Mandator constant = CONSTANTS.get(value);
+ if (constant == null) {
+ throw new IllegalArgumentException(value);
+ } else {
+ return constant;
+ }
+ }
+
+ }
+}