From 7f332668a4b4abb72da13c5734c15039d3d190d5 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 24 Mar 2014 10:00:10 +0100 Subject: bugfix: VIDP attribute provider configuration and validation --- .../moa/id/configuration/data/oa/OASTORKConfig.java | 21 ++++++++++++--------- .../configuration/struts/action/EditOAAction.java | 3 +++ .../validation/oa/OASTORKConfigValidation.java | 9 ++++++++- .../main/resources/applicationResources.properties | 1 + 4 files changed, 24 insertions(+), 10 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index d9f2a4d85..f1cc4277c 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -40,10 +40,20 @@ public class OASTORKConfig { private boolean isStorkLogonEnabled = false; private int qaa; - private List attributes; + private List attributes = null; + /* + * VIDP settings below + */ + private boolean vidpEnabled = false; + private List attributeProviderPlugins = new ArrayList(); + private boolean requireConsent = false; + public OASTORKConfig() { - + if (attributeProviderPlugins.isEmpty()) { + attributeProviderPlugins.add(new AttributeProviderPlugin()); + } + } /** @@ -146,13 +156,6 @@ public class OASTORKConfig { this.attributes = attributes; } - /* - * VIDP settings below - */ - private boolean vidpEnabled = false; - private List attributeProviderPlugins = new ArrayList(); - private boolean requireConsent; - public List getAvailableAttributeProviderPlugins() { return AttributeProviderFactory.getAvailablePlugins(); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index e5d84d461..80f74ff54 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -219,6 +219,9 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware, ConfigurationDBUtils.closeSession(); + //VIDP attribute provider configuration + storkOA = new OASTORKConfig(); + newOA = true; formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java index 067e85aa6..9e877605e 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java @@ -56,8 +56,15 @@ public class OASTORKConfigValidation { } if (MiscUtil.isEmpty(current.getName())) { log.info("AttributeProviderPlugin Name is empty."); - errors.add(LanguageHelper.getErrorString("validation.stork.ap.name.valid")); + errors.add(LanguageHelper.getErrorString("validation.stork.ap.name.empty")); + + } else { + if (!oageneral.getAvailableAttributeProviderPlugins().contains(current.getName())) { + log.info("AttributeProviderPlugin Name is not supported."); + errors.add(LanguageHelper.getErrorString("validation.stork.ap.name.valid")); + } } + if (MiscUtil.isEmpty(current.getAttributes()) || !current.getAttributes().matches("[a-zA-Z]+(, ?[a-zA-Z]+)*")) { log.info("AttributeProviderPlugin attributes are empty or do not match csv format."); errors.add(LanguageHelper.getErrorString("validation.stork.ap.attributes.valid")); diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 08cf922c5..38b379693 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -423,6 +423,7 @@ validation.stork.requestedattributes=STORK Attribute sind fehlerhaft. Bsp.: attr validation.stork.qaa.outofrange=G\u00FCltige QAA Werte sind 1, 2, 3, und 4 validation.stork.attributes.empty=Es muss mindestens ein Attribut definiert sein validation.stork.ap.url.valid=Ung\u00FCltige AttributProvider Url +validation.stork.ap.name.empty=Ung\u00FCltiger AttributProvider Name validation.stork.ap.name.valid=Ung\u00FCltiger AttributProvider Name validation.stork.ap.attributes.valid=Ung\u00FCltige Attributconfiguration f\u00FCr ein Attribut Provider Plugin. Feld darf nicht leer sein und ist als csv anzugeben. -- cgit v1.2.3