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 ++++++++- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'id/ConfigWebTool/src/main/java') 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")); -- cgit v1.2.3