From 8e4059c2b1f69b2361738548dab07194dc1f5dcf Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Sun, 23 May 2021 10:45:37 +0200 Subject: update attribute builder for MandateProfiles and add attribute builder for mandate mode to support eIDAS Proxy-Service with mandates --- .../api/data/ExtendedPvpAttributeDefinitions.java | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'eaaf_core_api/src') 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 04cf07bb..5d7fcc07 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 @@ -19,6 +19,9 @@ package at.gv.egiz.eaaf.core.api.data; +import java.util.NoSuchElementException; +import java.util.stream.Stream; + public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions { String EIDAS_CONNECTOR_UNIQUEID_NAME = "urn:eidgvat:attributes.eidas.uniqueId"; @@ -36,6 +39,55 @@ public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions String SP_USED_MANDATE_PROFILES_NAME = "urn:eidgvat:attributes.ServiceProviderMandateProfiles"; String SP_USED_MANDATE_PROFILES_FRIENDLY_NAME = "ServiceProvider-MandateProfiles"; + String SP_USED_MANDATE_TYPE_NAME = "urn:eidgvat:attributes.ServiceProviderMandateType"; + String SP_USED_MANDATE_TYPE_FRIENDLY_NAME = "ServiceProvider-MandateType"; + + enum SpMandateModes { + NONE("none"), + NATURAL("natural"), + NATURAL_FORCE("forceNatural"), + 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 + */ + public static SpMandateModes fromString(final String mode) { + return Stream.of(SpMandateModes.values()) + .filter(el -> el.getMode().equals(mode)) + .findFirst() + .get(); + + } + + /** + * Get the URI based status identifier of an E-ID. + * + * @return Current mandate mode + */ + public String getMode() { + return this.mandateMode; + } + + @Override + 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"; -- cgit v1.2.3