aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java')
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
index 2853d8ab..91a6ce42 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
@@ -38,8 +38,8 @@ import org.joda.time.DateTime;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException;
+import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants;
import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
import at.gv.egiz.eaaf.core.impl.data.Triple;
import eu.eidas.auth.commons.attribute.AttributeDefinition;
@@ -84,8 +84,9 @@ public class EidasResponseUtils {
*/
public static Triple<String, String, String> parseEidasPersonalIdentifier(String uniqueID) {
if (!validateEidasPersonalIdentifier(uniqueID)) {
- log.error("eIDAS attribute value for {} looks wrong formated. Value: {}",
- Constants.eIDAS_ATTR_PERSONALIDENTIFIER, uniqueID);
+ log.error("eIDAS attribute value for {} looks wrong formated. Value: {}",
+ EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER, uniqueID);
+
return null;
}
@@ -210,11 +211,11 @@ public class EidasResponseUtils {
// TODO: add more mappings
return result;
} else {
- log.warn("eIDAS attr: " + Constants.eIDAS_ATTR_CURRENTADDRESS + " is of WRONG type");
- throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTADDRESS);
+ log.warn("eIDAS attr: " + EidasConstants.eIDAS_ATTR_CURRENTADDRESS + " is of WRONG type");
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_CURRENTADDRESS);
}
} else {
- log.debug("NO '" + Constants.eIDAS_ATTR_CURRENTADDRESS + "' attribute. Post-Processing skipped ... ");
+ log.debug("NO '" + EidasConstants.eIDAS_ATTR_CURRENTADDRESS + "' attribute. Post-Processing skipped ... ");
}
return null;
}
@@ -231,11 +232,11 @@ public class EidasResponseUtils {
if (birthNameObj instanceof String) {
return (String) birthNameObj;
} else {
- log.warn("eIDAS attr: " + Constants.eIDAS_ATTR_BIRTHNAME + " is of WRONG type");
- throw new EidasAttributeException(Constants.eIDAS_ATTR_BIRTHNAME);
+ log.warn("eIDAS attr: " + EidasConstants.eIDAS_ATTR_BIRTHNAME + " is of WRONG type");
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_BIRTHNAME);
}
} else {
- log.debug("NO '" + Constants.eIDAS_ATTR_BIRTHNAME + "' attribute. Post-Processing skipped ... ");
+ log.debug("NO '" + EidasConstants.eIDAS_ATTR_BIRTHNAME + "' attribute. Post-Processing skipped ... ");
}
return null;
}
@@ -253,13 +254,13 @@ public class EidasResponseUtils {
return (String) placeOfBirthObj;
} else {
- log.warn("eIDAS attr: " + Constants.eIDAS_ATTR_PLACEOFBIRTH + " is of WRONG type");
- throw new EidasAttributeException(Constants.eIDAS_ATTR_PLACEOFBIRTH);
+ log.warn("eIDAS attr: " + EidasConstants.eIDAS_ATTR_PLACEOFBIRTH + " is of WRONG type");
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_PLACEOFBIRTH);
}
} else {
- log.debug("NO '" + Constants.eIDAS_ATTR_PLACEOFBIRTH + "' attribute. Post-Processing skipped ... ");
+ log.debug("NO '" + EidasConstants.eIDAS_ATTR_PLACEOFBIRTH + "' attribute. Post-Processing skipped ... ");
}
return null;
}
@@ -273,7 +274,7 @@ public class EidasResponseUtils {
*/
public static DateTime processDateOfBirth(Object dateOfBirthObj) throws EidasAttributeException {
if (!(dateOfBirthObj instanceof DateTime)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_DATEOFBIRTH);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_DATEOFBIRTH);
}
return (DateTime) dateOfBirthObj;
}
@@ -291,11 +292,11 @@ public class EidasResponseUtils {
new SimpleDateFormat("yyyy-MM-dd").parse((String) dateOfBirthObj);
return (String) dateOfBirthObj;
} catch (ParseException e) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_DATEOFBIRTH);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_DATEOFBIRTH);
}
}
if (!(dateOfBirthObj instanceof DateTime)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_DATEOFBIRTH);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_DATEOFBIRTH);
}
return new SimpleDateFormat("yyyy-MM-dd").format(((DateTime) dateOfBirthObj).toDate());
}
@@ -309,7 +310,7 @@ public class EidasResponseUtils {
*/
public static String processGivenName(Object givenNameObj) throws EidasAttributeException {
if (!(givenNameObj instanceof String)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTGIVENNAME);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME);
}
return (String) givenNameObj;
}
@@ -323,7 +324,7 @@ public class EidasResponseUtils {
*/
public static String processFamilyName(Object familyNameObj) throws EidasAttributeException {
if (!(familyNameObj instanceof String)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTFAMILYNAME);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME);
}
return (String) familyNameObj;
}
@@ -337,7 +338,7 @@ public class EidasResponseUtils {
*/
public static String processPersonalIdentifier(Object personalIdentifierObj) throws EidasAttributeException {
if (!(personalIdentifierObj instanceof String)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER);
}
return (String) personalIdentifierObj;
}
@@ -352,7 +353,7 @@ public class EidasResponseUtils {
*/
public static String processPseudonym(Object personalIdObj) throws EidasAttributeException {
if (!(personalIdObj instanceof String)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER);
}
final Triple<String, String, String> eIdentifier =
EidasResponseUtils.parseEidasPersonalIdentifier((String) personalIdObj);
@@ -371,7 +372,7 @@ public class EidasResponseUtils {
*/
public static String processCountryCode(Object personalIdObj) throws EidasAttributeException {
if (!(personalIdObj instanceof String)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER);
}
final Triple<String, String, String> eIdentifier =
EidasResponseUtils.parseEidasPersonalIdentifier((String) personalIdObj);
@@ -390,7 +391,7 @@ public class EidasResponseUtils {
*/
public static String processTaxReference(Object taxReferenceObj) throws EidasAttributeException {
if (!(taxReferenceObj instanceof String)) {
- throw new EidasAttributeException(Constants.eIDAS_ATTR_TAXREFERENCE);
+ throw new EidasAttributeException(EidasConstants.eIDAS_ATTR_TAXREFERENCE);
}
return (String) taxReferenceObj;
}