From 79aeebd55d548326a3892465c441c77589e0e37d Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 4 Jul 2014 14:48:19 +0200 Subject: refactored logging statements --- .../moa/id/configuration/struts/action/EditGeneralConfigAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 0a308a354..ad465e0d8 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -555,10 +555,10 @@ public class EditGeneralConfigAction extends BasicAction { } try{ - log.error("CPEPS LIST: " + storkconfig.getCpepslist().size() ); - log.error("CPEPS 1:" + storkconfig.getCpepslist().get(0).getCountryCode() +storkconfig.getCpepslist().get(0).getURL()); + log.info("CPEPS LIST: " + storkconfig.getCpepslist().size() ); + log.trace("CPEPS 1:" + storkconfig.getCpepslist().get(0).getCountryCode() +storkconfig.getCpepslist().get(0).getURL()); } catch (Exception ex) { - ex.printStackTrace(); + log.info("CPEPS LIST is null"); } } } -- cgit v1.2.3 From 35993eab38db2aa67137d674baa31031266c2b2e Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 4 Jul 2014 14:41:55 +0200 Subject: fix: overwrite single config instead of deleting old one --- .../struts/action/EditGeneralConfigAction.java | 73 ++++------------------ .../moa/id/commons/db/ConfigurationDBRead.java | 4 +- 2 files changed, 14 insertions(+), 63 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index ad465e0d8..ec261335d 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -237,20 +237,8 @@ public class EditGeneralConfigAction extends BasicAction { } catch (Exception ex) { ex.printStackTrace(); } - - MOAIDConfiguration oldconfig = ConfigurationDBRead.getMOAIDConfiguration(); - AuthComponentGeneral oldauth = null; - if (oldconfig != null) { - oldauth = oldconfig.getAuthComponentGeneral(); - } - -// MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); -// if (dbconfig == null) { -// dbconfig = new MOAIDConfiguration(); -// isnewconfig = true; -// } - MOAIDConfiguration dbconfig = new MOAIDConfiguration(); + MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); AuthComponentGeneral dbauth = dbconfig.getAuthComponentGeneral(); if (dbauth == null) { @@ -486,23 +474,6 @@ public class EditGeneralConfigAction extends BasicAction { dbchainingmodes.setSystemDefaultMode( ChainingModeType.fromValue(moaconfig.getDefaultchainigmode())); - if (oldconfig != null) { - ChainingModes oldchainigmodes = oldconfig.getChainingModes(); - if (oldchainigmodes != null) { - List oldtrustanchor = oldchainigmodes.getTrustAnchor(); - if (oldtrustanchor != null) { - List trustanchor = new ArrayList(); - for (TrustAnchor oldel : oldtrustanchor) { - TrustAnchor TAel = new TrustAnchor(); - TAel.setX509IssuerName(oldel.getX509IssuerName()); - TAel.setX509SerialNumber(oldel.getX509SerialNumber()); - TAel.setMode(oldel.getMode()); - trustanchor.add(TAel); - } - dbchainingmodes.setTrustAnchor(trustanchor); - } - } - } IdentityLinkSigners idlsigners = dbauth.getIdentityLinkSigners(); if (idlsigners == null) { @@ -525,31 +496,28 @@ public class EditGeneralConfigAction extends BasicAction { forcon.setURL(moaconfig.getSzrgwURL()); } - //TODO: Set STORK Config!!! - if (oldauth != null) { - ForeignIdentities oldforeign = oldauth.getForeignIdentities(); - if (oldforeign != null) { - STORK oldstork = oldforeign.getSTORK(); - if (oldstork == null) - oldstork = new STORK(); + ForeignIdentities foreign = dbauth.getForeignIdentities(); + if (foreign != null) { + STORK stork = foreign.getSTORK(); + if (stork == null) + stork = new STORK(); try { log.error("QAAAA " + storkconfig.getDefaultQaa()); - oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa()); + stork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa()); if (storkconfig.getAttributes() != null) - oldstork.setAttributes(storkconfig.getAttributes()); + stork.setAttributes(storkconfig.getAttributes()); else - oldstork.setAttributes((List) (new ArrayList())); + stork.setAttributes((List) (new ArrayList())); if (storkconfig.getCpepslist() != null) - oldstork.setCPEPS(storkconfig.getCpepslist()); + stork.setCPEPS(storkconfig.getCpepslist()); else - oldstork.setCPEPS((List) (new ArrayList())); + stork.setCPEPS((List) (new ArrayList())); - dbforeign.setSTORK(oldstork); } catch (Exception e) { e.printStackTrace(); } @@ -561,7 +529,6 @@ public class EditGeneralConfigAction extends BasicAction { log.info("CPEPS LIST is null"); } } - } if (MiscUtil.isNotEmpty(moaconfig.getMandateURL())) { OnlineMandates dbmandate = dbauth.getOnlineMandates(); @@ -604,7 +571,7 @@ public class EditGeneralConfigAction extends BasicAction { } moaauth.setTrustProfileID(moaconfig.getMoaspssAuthTrustProfile()); - moaauth.setVerifyTransformsInfoProfileID(moaconfig.getAuthTransformList()); + moaauth.getVerifyTransformsInfoProfileID().set(0, moaconfig.getAuthTransformList().get(0)); SecurityLayer seclayertrans = dbauth.getSecurityLayer(); if (seclayertrans == null) { @@ -621,19 +588,6 @@ public class EditGeneralConfigAction extends BasicAction { elem.setTransformation(moatrans.get(key)); trans.add(elem); } - } else { - if (oldauth != null) { - SecurityLayer oldsectrans = oldauth.getSecurityLayer(); - if (oldsectrans != null) { - List oldtranslist = oldsectrans.getTransformsInfo(); - for (TransformsInfoType oldel : oldtranslist) { - TransformsInfoType elem = new TransformsInfoType(); - elem.setFilename(oldel.getFilename()); - elem.setTransformation(oldel.getTransformation()); - trans.add(elem); - } - } - } } if (trans.size() > 0) seclayertrans.setTransformsInfo(trans); @@ -660,9 +614,6 @@ public class EditGeneralConfigAction extends BasicAction { ConfigurationDBUtils.save(dbconfig); - if (oldconfig != null) - ConfigurationDBUtils.delete(oldconfig); - } catch (MOADatabaseException e) { log.warn("MOAID Configuration can not be stored in Database", e); return LanguageHelper.getErrorString("error.db.oa.store", request); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java index 88220cded..e890e2145 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java @@ -147,8 +147,8 @@ public class ConfigurationDBRead { Logger.trace("Found entries: " + result.size()); if (result.size() == 0) { - Logger.trace("No entries found."); - return null; + Logger.trace("No entries found. Create fresh instance."); + return new MOAIDConfiguration(); } return (MOAIDConfiguration) result.get(0); -- cgit v1.2.3 From 27c5460e2138fbb7de64214a7538b98effb5a7a6 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 4 Jul 2014 14:44:26 +0200 Subject: fix: CPEPS list is now edited in place instead of clean and refill --- .../id/configuration/validation/moaconfig/StorkConfigValidator.java | 4 ++++ id/ConfigWebTool/src/main/webapp/js/common.js | 1 + id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp | 3 ++- .../at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index 8bc916e5a..4a5676fd6 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -28,6 +28,10 @@ public class StorkConfigValidator { if (form.getCpepslist() != null) { for(CPEPS current : form.getCpepslist()) { + // if an existing record got deleted + if(null == current) + continue; + // check country code String check = current.getCountryCode(); if (MiscUtil.isNotEmpty(check)) { diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index 32e79bb66..a86b9fede 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -230,6 +230,7 @@ function newPeps() { var lastindex = 1; } var nextindex = lastindex + 1; + clone.innerHTML = clone.innerHTML.replace(//, ''); clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex); clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); target.parentNode.appendChild(clone); diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 6f266f865..9b94bcef5 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -251,7 +251,8 @@ - + diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java index 6bd987f96..cdb19340d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java @@ -154,7 +154,7 @@ public final class ConfigurationDBUtils { synchronized (session) { tx.begin(); - session.persist(dbo); + session.merge(dbo); tx.commit(); //session.clear(); -- cgit v1.2.3 From b2c1ca665aaaa3246671ef2ec933e29b8ff87b25 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Fri, 4 Jul 2014 16:09:36 +0200 Subject: made country code readonly --- .../struts/action/EditGeneralConfigAction.java | 15 ++++++++-- .../validation/moaconfig/StorkConfigValidator.java | 34 ++++++++++++---------- id/ConfigWebTool/src/main/webapp/js/common.js | 4 ++- .../src/main/webapp/jsp/editMOAConfig.jsp | 2 +- 4 files changed, 35 insertions(+), 20 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index ec261335d..ef0672e99 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -512,9 +512,20 @@ public class EditGeneralConfigAction extends BasicAction { else stork.setAttributes((List) (new ArrayList())); - if (storkconfig.getCpepslist() != null) + if (storkconfig.getCpepslist() != null) { + + // make CountryCode "readonly" + for(CPEPS newone : storkconfig.getCpepslist()) { + for(CPEPS current : stork.getCPEPS()) { + if(current.getHjid().equals(newone.getHjid())) { + newone.setCountryCode(current.getCountryCode()); + break; + } + } + } + stork.setCPEPS(storkconfig.getCpepslist()); - + } else stork.setCPEPS((List) (new ArrayList())); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index 4a5676fd6..5ec3af519 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -32,27 +32,29 @@ public class StorkConfigValidator { if(null == current) continue; - // check country code - String check = current.getCountryCode(); - if (MiscUtil.isNotEmpty(check)) { - if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { - log.warn("CPEPS config countrycode contains potentail XSS characters: " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", - new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); - } - if(!check.toLowerCase().matches("^[a-z][a-z]$")) { - log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check); + if(null == current.getHjid()) { + // check country code + String check = current.getCountryCode(); + if (MiscUtil.isNotEmpty(check)) { + if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { + log.warn("CPEPS config countrycode contains potentail XSS characters: " + check); errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", - new Object[] {check}, request )); + new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); + } + if(!check.toLowerCase().matches("^[a-z][a-z]$")) { + log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", + new Object[] {check}, request )); + } + } else { + log.warn("CPEPS config countrycode is empty : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty", + new Object[] {check}, request )); } - } else { - log.warn("CPEPS config countrycode is empty : " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty", - new Object[] {check}, request )); } // check url - check = current.getURL(); + String check = current.getURL(); if (MiscUtil.isNotEmpty(check)) { if (!ValidationHelper.validateURL(check)) { log.info("CPEPS config URL is invalid : " + check); diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index a86b9fede..f7ef2c415 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -230,7 +230,9 @@ function newPeps() { var lastindex = 1; } var nextindex = lastindex + 1; - clone.innerHTML = clone.innerHTML.replace(//, ''); + + clone.innerHTML = clone.innerHTML.replace(/[A-Z]{2}/, '
'); clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex); clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); target.parentNode.appendChild(clone); diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index 9b94bcef5..21ba246c1 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -252,7 +252,7 @@
+ -- cgit v1.2.3 From bab51d46c3d57ac1fe32f184d5fd8acef53ad618 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 7 Jul 2014 09:11:42 +0200 Subject: check for peps country code uniqueness --- .../id/configuration/data/GeneralStorkConfig.java | 20 ++++++++++ .../struts/action/EditGeneralConfigAction.java | 13 +------ .../validation/moaconfig/StorkConfigValidator.java | 45 +++++++++++++--------- .../resources/applicationResources_de.properties | 1 + .../resources/applicationResources_en.properties | 1 + 5 files changed, 49 insertions(+), 31 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java index 9e5ba684c..b1e268fef 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java @@ -25,12 +25,14 @@ package at.gv.egovernment.moa.id.configuration.data; import java.util.ArrayList; import java.util.List; +import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.STORK; import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; + import org.apache.log4j.Logger; public class GeneralStorkConfig { @@ -88,6 +90,24 @@ public class GeneralStorkConfig { } public List getCpepslist() { + if (null == cpepslist) + return null; + + MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); + + List cpepss = dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS(); + + // make CountryCode "readonly" + for (CPEPS newone : cpepslist) { + for (CPEPS current : cpepss) { + if (null != newone) + if (current.getHjid().equals(newone.getHjid())) { + newone.setCountryCode(current.getCountryCode()); + break; + } + } + } + return cpepslist; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index ef0672e99..0f1673c3a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -512,20 +512,9 @@ public class EditGeneralConfigAction extends BasicAction { else stork.setAttributes((List) (new ArrayList())); - if (storkconfig.getCpepslist() != null) { - - // make CountryCode "readonly" - for(CPEPS newone : storkconfig.getCpepslist()) { - for(CPEPS current : stork.getCPEPS()) { - if(current.getHjid().equals(newone.getHjid())) { - newone.setCountryCode(current.getCountryCode()); - break; - } - } - } + if (storkconfig.getCpepslist() != null) stork.setCPEPS(storkconfig.getCpepslist()); - } else stork.setCPEPS((List) (new ArrayList())); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java index 5ec3af519..f7d61653d 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java @@ -32,29 +32,27 @@ public class StorkConfigValidator { if(null == current) continue; - if(null == current.getHjid()) { - // check country code - String check = current.getCountryCode(); - if (MiscUtil.isNotEmpty(check)) { - if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { - log.warn("CPEPS config countrycode contains potentail XSS characters: " + check); + // check country code + String check = current.getCountryCode(); + if (MiscUtil.isNotEmpty(check)) { + if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { + log.warn("CPEPS config countrycode contains potentail XSS characters: " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", + new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); + } + if(!check.toLowerCase().matches("^[a-z][a-z]$")) { + log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check); errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", - new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); - } - if(!check.toLowerCase().matches("^[a-z][a-z]$")) { - log.warn("CPEPS config countrycode does not comply to ISO 3166-2 : " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.cc", - new Object[] {check}, request )); - } - } else { - log.warn("CPEPS config countrycode is empty : " + check); - errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty", - new Object[] {check}, request )); + new Object[] {check}, request )); } + } else { + log.warn("CPEPS config countrycode is empty : " + check); + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.empty", + new Object[] {check}, request )); } - + // check url - String check = current.getURL(); + check = current.getURL(); if (MiscUtil.isNotEmpty(check)) { if (!ValidationHelper.validateURL(check)) { log.info("CPEPS config URL is invalid : " + check); @@ -66,6 +64,15 @@ public class StorkConfigValidator { new Object[] {check}, request )); } } + + // ensure uniqueness of country code + for (CPEPS one : form.getCpepslist()) + for (CPEPS another : form.getCpepslist()) + if (null != one && null != another) + if (!one.equals(another) && one.getCountryCode().equals(another.getCountryCode())) { + errors.add(LanguageHelper.getErrorString("validation.stork.cpeps.duplicate", request)); + break; + } } // check qaa diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties index e4e7a0b63..2c71d86a5 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties @@ -453,6 +453,7 @@ validation.general.testcredentials.oid.valid=Die Testdaten OID {0} ist ung\u00FC validation.stork.cpeps.cc=CPEPS L\u00E4ndercode folgt nicht ISO 3166-2 validation.stork.cpeps.empty=CPEPS Konfiguration ist unvollst\u00E4ndig validation.stork.cpeps.url=CPEPS URL ist ung\u00FCltig +validation.stork.cpeps.duplicate=L\u00E4ndercodes sind nicht eindeutig validation.stork.requestedattributes=STORK Attribute sind fehlerhaft. Bsp.: attr1, attr2 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 diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties index dcf36103b..a494ef089 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties @@ -450,6 +450,7 @@ validation.general.testcredentials.oid.valid=The OID {0} for test credentials is validation.stork.cpeps.cc=CPEPS country code is not based on 3166-2 validation.stork.cpeps.empty=CPEPS configuration is incomplete validation.stork.cpeps.url=CPEPS URL is invalid +validation.stork.cpeps.duplicate=Country codes are not unique validation.stork.requestedattributes=STORK attributes are incorrect. Example: attr1, attr2 validation.stork.qaa.outofrange=Valid QAA values are 1, 2, 3, and 4 validation.stork.attributes.empty=Only one attribute can be provided -- cgit v1.2.3 From 5e77090ce5f718f5d6c50e4d2e2a2337a92e91a6 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 7 Jul 2014 09:19:40 +0200 Subject: many-to-many around cpeps list handling --- .../src/main/resources/config/bindings.xjb | 20 ++++++++++++++++++++ .../src/main/resources/config/moaid_config_2.0.xsd | 2 ++ 2 files changed, 22 insertions(+) (limited to 'id') diff --git a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb b/id/server/moa-id-commons/src/main/resources/config/bindings.xjb index cf04319c8..43fe21465 100644 --- a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb +++ b/id/server/moa-id-commons/src/main/resources/config/bindings.xjb @@ -2,6 +2,8 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" + xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations" + xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" jaxb:extensionBindingPrefixes="hj"> @@ -12,4 +14,22 @@ adapter="com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter"/> + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index 8bc532236..f99304dcc 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -803,6 +803,7 @@ Name zum Key eines KeyStores, der den privaten Schlüssel zum Erstellen einer Signatur darstellt + @@ -822,6 +823,7 @@ + -- cgit v1.2.3 From f595cb0d46358e44fad838dd01a449e40c52e18b Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Mon, 7 Jul 2014 10:33:51 +0200 Subject: fixed many-to-many sql syntax hibernate problem with linux mysqlserver --- id/server/moa-id-commons/src/main/resources/config/bindings.xjb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'id') diff --git a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb b/id/server/moa-id-commons/src/main/resources/config/bindings.xjb index 43fe21465..21714849b 100644 --- a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb +++ b/id/server/moa-id-commons/src/main/resources/config/bindings.xjb @@ -17,7 +17,7 @@ - + @@ -25,7 +25,7 @@ - + -- cgit v1.2.3 From 45727ed45e3deec0fff835a26f9b87adcfd0c6ba Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 8 Jul 2014 09:38:37 +0200 Subject: fix exception if attribute is not provided --- .../moa/id/auth/stork/STORKResponseProcessor.java | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'id') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 2c8b44404..2f1e50a05 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -136,8 +136,10 @@ public class STORKResponseProcessor { Logger.trace("Starting call..."); // if there is no signedDoc attribute, we cannot go on + String fiscalNumber = null; String citizenSignature = getAttributeValue("signedDoc", attributeList); - String fiscalNumber = getAttributeValue("fiscalNumber", attributeList); + if (hasAttribute("fiscalNumber", attributeList)) + fiscalNumber = getAttributeValue("fiscalNumber", attributeList); // if we have a signedDoc we test for a representation case // - according to stork samlengine and commons @@ -156,14 +158,15 @@ public class STORKResponseProcessor { String eIdentifier = getAttributeValue("eIdentifier", attributeList); String givenName = getAttributeValue("givenName", attributeList); String lastName = getAttributeValue("surname", attributeList); - String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + String dateOfBirth = null; + if (hasAttribute("dateOfBirth", attributeList)) { + dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); + } // gender attribute is mandatory here because of some legal stuff String gender = getAttributeValue("gender", attributeList); - if (!StringUtils.isEmpty(dateOfBirth)) - dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); - identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, null, null, mandate, targetType, targetValue, oaFriendlyName, filters, fiscalNumber); @@ -187,14 +190,15 @@ public class STORKResponseProcessor { String eIdentifier = getAttributeValue("eIdentifier", attributeList); String givenName = getAttributeValue("givenName", attributeList); String lastName = getAttributeValue("surname", attributeList); - String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + String dateOfBirth = null; + if (hasAttribute("dateOfBirth", attributeList)) { + dateOfBirth = getAttributeValue("dateOfBirth", attributeList); + dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); + } // gender attribute is mandatory here because of some legal stuff String gender = getAttributeValue("gender", attributeList); - - if (!StringUtils.isEmpty(dateOfBirth)) - dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); - + identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, gender, citizenSignature, representative, represented, mandate, targetType, targetValue, oaFriendlyName, filters, fiscalNumber); @@ -204,9 +208,11 @@ public class STORKResponseProcessor { String eIdentifier = getAttributeValue("eIdentifier", attributeList); String givenName = getAttributeValue("givenName", attributeList); String lastName = getAttributeValue("surname", attributeList); - String dateOfBirth = getAttributeValue("dateOfBirth", attributeList); - if (!StringUtils.isEmpty(dateOfBirth)) + String dateOfBirth = null; + if (hasAttribute("dateOfBirth", attributeList)) { + dateOfBirth = getAttributeValue("dateOfBirth", attributeList); dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth); + } identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier, givenName, lastName, dateOfBirth, citizenSignature, fiscalNumber); } -- cgit v1.2.3
Country ShortcodePEPS URL
+ " onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>
Country ShortcodePEPS URL
- " onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/>