summaryrefslogtreecommitdiff
path: root/eaaf_core_api/src
diff options
context:
space:
mode:
authorThomas <>2023-06-06 17:02:04 +0200
committerThomas <>2023-06-06 17:02:04 +0200
commitced5a1b911af0ae62229645ca08a9ecc5225783b (patch)
tree44b6ec6356e51b571c3a8f8ff2436b469eeeebab /eaaf_core_api/src
parent0b9a16e74f1aef687dc1dd397b0b8495ef64a1af (diff)
downloadEAAF-Components-ced5a1b911af0ae62229645ca08a9ecc5225783b.tar.gz
EAAF-Components-ced5a1b911af0ae62229645ca08a9ecc5225783b.tar.bz2
EAAF-Components-ced5a1b911af0ae62229645ca08a9ecc5225783b.zip
fix(core): add @JsonValue annotation to SpMandateModes enum to serialize the String value
Diffstat (limited to 'eaaf_core_api/src')
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java
index 771829c9..1ec33533 100644
--- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java
@@ -23,12 +23,13 @@ import java.util.NoSuchElementException;
import java.util.stream.Stream;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions {
String EIDAS_CONNECTOR_UNIQUEID_NAME = "urn:eidgvat:attributes.eidas.uniqueId";
String EIDAS_CONNECTOR_UNIQUEID_FRIENDLY_NAME = "EidasNode-UniqueId";
-
+
String SP_UNIQUEID_NAME = "urn:eidgvat:attributes.ServiceProviderUniqueId";
String SP_UNIQUEID_FRIENDLY_NAME = "ServiceProvider-UniqueId";
@@ -43,39 +44,40 @@ public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions
String SP_USED_MANDATE_TYPE_NAME = "urn:eidgvat:attributes.ServiceProviderMandateType";
String SP_USED_MANDATE_TYPE_FRIENDLY_NAME = "ServiceProvider-MandateType";
-
+
String SP_REQUIRED_ATTRIBUTES_NAME = "urn:eidgvat:attributes.RequiredAttributes";
String SP_REQUIRED_ATTRIBUTES_FRIENDLY_NAME = "ServiceProvider-RequiredAttributes";
-
-
+
enum SpMandateModes {
- NONE("none"),
+ NONE("none"),
NATURAL("natural"),
NATURAL_FORCE("forceNatural"),
- LEGAL("legal"),
+ LEGAL("legal"),
LEGAL_FORCE("forceLegal"),
BOTH("all"),
BOTH_FORCE("forceAll");
-
+
private final String mandateMode;
SpMandateModes(final String mandateMode) {
this.mandateMode = mandateMode;
}
-
+
/**
* Get Service-Provider mandate-mode from String representation.
*
* @param s mandate-mode String parameter
- * @return mandate mode, or {@link NoSuchElementException} if mode is unknown
+ * @return mandate mode, or {@link NoSuchElementException} if mode is unknown
*/
@JsonCreator
public static SpMandateModes fromString(final String mode) {
- return Stream.of(SpMandateModes.values())
- .filter(el -> el.getMode().equals(mode))
- .findFirst()
- .get();
-
+ return mode == null
+ ? SpMandateModes.NONE
+ : Stream.of(SpMandateModes.values())
+ .filter(el -> el.getMode().equals(mode))
+ .findFirst()
+ .get();
+
}
/**
@@ -86,19 +88,19 @@ public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions
public String getMode() {
return this.mandateMode;
}
-
+
@Override
+ @JsonValue
public String toString() {
return getMode();
}
-
+
}
-
+
String EID_BINDING_PUBLIC_KEY_NAME = "urn:eidgvat:attributes.binding.pubkey";
String EID_BINDING_PUBLIC_KEY_FRIENDLY_NAME = "Binding-PublicKey";
-
/* Attributes for E-ID */
String EID_ENCRYPTED_SOURCEID_NAME = "urn:eidgvat:attributes.vsz.value";
String EID_ENCRYPTED_SOURCEID_FRIENDLY_NAME = "vSZ";
@@ -114,10 +116,10 @@ public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions
String EID_TRANSACTION_ID_NAME = "urn:eidgvat:attributes.transactionId";
String EID_TRANSACTION_ID_FRIENDLY_NAME = "transactionId";
-
+
String EID_PII_TRANSACTION_ID_NAME = "urn:eidgvat:attributes.piiTransactionId";
String EID_PII_TRANSACTION_ID_FRIENDLY_NAME = "piiTransactionId";
-
+
String EID_MIS_MANDATE_NAME = "urn:eidgvat:attributes.mis.mandate";
String EID_MIS_MANDATE_FRIENDLY_NAME = "mandate";