aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java71
1 files changed, 38 insertions, 33 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
index bb0545f7..1ca4cdb6 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
@@ -103,53 +103,58 @@ public class EidasResponseUtils {
*/
// TODO: check possible problem with nonLatinCharacters
public static List<String> translateStringListAttribute(AttributeDefinition<?> attributeDefinition,
- ImmutableSet<? extends AttributeValue<?>> attributeValues) {
+ @Nullable ImmutableSet<? extends AttributeValue<?>> attributeValues) {
final List<String> stringListAttribute = new ArrayList<>();
-
- final AttributeValueMarshaller<?> attributeValueMarshaller = attributeDefinition
- .getAttributeValueMarshaller();
- for (final AttributeValue<?> attributeValue : attributeValues) {
- String valueString = null;
- try {
- valueString = attributeValueMarshaller.marshal((AttributeValue) attributeValue);
-
- log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}",
- attributeDefinition.getFriendlyName(), attributeValue.toString(),
- attributeValue.isNonLatinScriptAlternateVersion(),
- AttributeValueTransliterator.needsTransliteration(valueString));
-
- // if (attributeValue.isNonLatinScriptAlternateVersion()) {
- if (!AttributeValueTransliterator.needsTransliteration(valueString)) {
- stringListAttribute.add(0, valueString);
-
- } else {
- log.trace("Find 'needsTransliteration' flag. Setting this value at last list element ... ");
- stringListAttribute.add(valueString);
-
+ if (attributeValues == null) {
+ log.info("Can not extract infos from 'null' attribute value");
+
+ } else {
+ final AttributeValueMarshaller<?> attributeValueMarshaller =
+ attributeDefinition.getAttributeValueMarshaller();
+ for (final AttributeValue<?> attributeValue : attributeValues) {
+ String valueString = null;
+ try {
+ valueString = attributeValueMarshaller.marshal((AttributeValue) attributeValue);
+
log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}",
attributeDefinition.getFriendlyName(), attributeValue.toString(),
attributeValue.isNonLatinScriptAlternateVersion(),
AttributeValueTransliterator.needsTransliteration(valueString));
-
+
// if (attributeValue.isNonLatinScriptAlternateVersion()) {
if (!AttributeValueTransliterator.needsTransliteration(valueString)) {
stringListAttribute.add(0, valueString);
-
+
} else {
log.trace("Find 'needsTransliteration' flag. Setting this value at last list element ... ");
stringListAttribute.add(valueString);
-
+
+ log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}",
+ attributeDefinition.getFriendlyName(), attributeValue.toString(),
+ attributeValue.isNonLatinScriptAlternateVersion(),
+ AttributeValueTransliterator.needsTransliteration(valueString));
+
+ // if (attributeValue.isNonLatinScriptAlternateVersion()) {
+ if (!AttributeValueTransliterator.needsTransliteration(valueString)) {
+ stringListAttribute.add(0, valueString);
+
+ } else {
+ log.trace("Find 'needsTransliteration' flag. Setting this value at last list element ... ");
+ stringListAttribute.add(valueString);
+
+ }
}
+ } catch (final AttributeValueMarshallingException e) {
+ throw new IllegalStateException(e);
+
}
- } catch (final AttributeValueMarshallingException e) {
- throw new IllegalStateException(e);
-
- }
+
+ }
+ log.trace("Extract values: {} for attr: {}",
+ StringUtils.join(stringListAttribute, ","), attributeDefinition.getFriendlyName());
+
}
-
- log.trace("Extract values: {} for attr: {}",
- StringUtils.join(stringListAttribute, ","), attributeDefinition.getFriendlyName());
-
+
return stringListAttribute;
}