From 798ea7ddc50fcf65cb184b0161e6869b5e47e416 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 27 Mar 2014 11:31:15 +0100 Subject: update STORK country selection --- .../moa/id/auth/MOAIDAuthConstants.java | 23 ++++++++++++++++ .../moa/id/auth/builder/LoginFormBuilder.java | 31 ++++++++++++++++++---- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthConstants.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthConstants.java index 060dc2248..0173c67a1 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthConstants.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/MOAIDAuthConstants.java @@ -4,7 +4,10 @@ package at.gv.egovernment.moa.id.auth; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import iaik.asn1.ObjectID; @@ -133,4 +136,24 @@ public interface MOAIDAuthConstants { public static final String PARAM_APPLET_HEIGTH = "heigth"; public static final String PARAM_APPLET_WIDTH = "width"; + public static final Map COUNTRYCODE_XX_TO_NAME = + Collections.unmodifiableMap(new HashMap() { + private static final long serialVersionUID = 1L; + { + put("BE", "België/Belgique"); + put("EE", "Eesti"); + put("ES", "España"); + put("FI", "Suomi"); + put("IS", "Ísland"); + put("IT", "Italia"); + put("LI", "Liechtenstein"); + put("LT", "Lithuania"); + put("LU", "Luxemburg"); + put("PT", "Portugal"); + put("SE", "Sverige"); + put("SI", "Slovenija"); + } + }); + + } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java index c244b64e9..4d80be1e8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java @@ -31,9 +31,11 @@ import java.io.InputStream; import java.io.StringWriter; import java.net.URI; import java.net.URISyntaxException; +import java.util.List; import org.apache.commons.io.IOUtils; +import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; import at.gv.egovernment.moa.id.config.ConfigurationException; @@ -152,11 +154,30 @@ public class LoginFormBuilder { if (oaParam.isShowStorkLogin()) { String pepslist = ""; - for (CPEPS current : oaParam.getPepsList()) - // check if master config has changed... - if(ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS().contains(current)) - pepslist += "\n"; - value = value.replace(PEPSLIST, pepslist); + List cpepsList = null; + try { + cpepsList = ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS(); + + for (CPEPS current : oaParam.getPepsList()) + // check if master config has changed... + if(cpepsList != null && cpepsList.contains(current)) { + String countryName = null; + if (MiscUtil.isNotEmpty(MOAIDAuthConstants.COUNTRYCODE_XX_TO_NAME.get(current.getCountryCode().toUpperCase()))) + countryName = MOAIDAuthConstants.COUNTRYCODE_XX_TO_NAME.get(current.getCountryCode().toUpperCase()); + else + countryName = current.getCountryCode().toUpperCase(); + + pepslist += "\n"; + + } + + value = value.replace(PEPSLIST, pepslist); + + } catch (NullPointerException e) { + + } } value = FormBuildUtils.customiceLayoutBKUSelection(value, -- cgit v1.2.3