From a49bdd53d713a73f706d120f3e386a1ed71ae67e Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 1 Oct 2013 14:18:25 +0200 Subject: @MOA-ID ConfigWebTool: --update commercial-register number input validator --some short bugfixes @MOA-ID: --update advanced statistic logger --Move Exception classes to a special package --add to Exception types --- .../auth/pvp2/MetaDataVerificationFilter.java | 2 +- .../configuration/filter/AuthenticationFilter.java | 1 - .../configuration/struts/action/EditOAAction.java | 34 ++++++++++++++++++++-- .../validation/oa/OAGeneralConfigValidation.java | 30 +++++++++---------- 4 files changed, 47 insertions(+), 20 deletions(-) (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java index d08354c43..043ae6811 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/MetaDataVerificationFilter.java @@ -9,7 +9,7 @@ import org.opensaml.saml2.metadata.provider.MetadataFilter; import org.opensaml.xml.XMLObject; import org.opensaml.xml.security.x509.BasicX509Credential; -import at.gv.egovernment.moa.id.MOAIDException; +import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.protocols.pvp2x.verification.EntityVerifier; public class MetaDataVerificationFilter implements MetadataFilter { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java index e7e1beb45..c795e20ba 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java @@ -1,7 +1,6 @@ package at.gv.egovernment.moa.id.configuration.filter; import java.io.IOException; -import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import java.util.regex.Pattern; 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 6a7087c85..1676b014d 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 @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; @@ -20,6 +21,7 @@ import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUSelectionCustomizationType; import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS; +import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.MOAKeyBoxSelector; @@ -119,6 +121,7 @@ ServletResponseAware { && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); addActionError(LanguageHelper.getErrorString("error.editoa.mailverification")); + return Constants.STRUTS_SUCCESS; } @@ -186,16 +189,31 @@ ServletResponseAware { && !userdb.isIsMailAddressVerified()) { log.info("Online-Applikation managemant disabled. Mail address is not verified."); addActionError(LanguageHelper.getErrorString("error.editoa.mailverification")); + return Constants.STRUTS_SUCCESS; } - + + MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration(); + if (moaidconfig != null) { + DefaultBKUs defaultbkus = moaidconfig.getDefaultBKUs(); + if (defaultbkus != null) { + generalOA.setBkuHandyURL(defaultbkus.getHandyBKU()); + generalOA.setBkuLocalURL(defaultbkus.getLocalBKU()); + generalOA.setBkuOnlineURL(defaultbkus.getOnlineBKU()); + } + } + //set UserSpezific OA Parameters if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb); + + + ConfigurationDBUtils.closeSession(); newOA = true; formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); + return Constants.STRUTS_OA_EDIT; } @@ -616,8 +634,13 @@ ServletResponseAware { dboa.setType(Constants.MOA_CONFIG_BUSINESSSERVICE); String num = generalOA.getIdentificationNumber().replaceAll(" ", ""); - if (num.startsWith(Constants.IDENIFICATIONTYPE_FN)) + if (num.startsWith(Constants.IDENIFICATIONTYPE_FN)) { num = num.substring(Constants.IDENIFICATIONTYPE_FN.length()); + + num = at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(num); + + //num = StringUtils.leftPad(num, 7, '0'); + } if (num.startsWith(Constants.IDENIFICATIONTYPE_ZVR)) num = num.substring(Constants.IDENIFICATIONTYPE_ZVR.length()); @@ -858,7 +881,12 @@ ServletResponseAware { deaktivededBusinessService = true; String[] split = bpk.split("\\+"); generalOA.setIdentificationType(split[1].substring(1)); - generalOA.setIdentificationNumber(split[2]); + + if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN)) + generalOA.setIdentificationNumber( + at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(split[2])); + else + generalOA.setIdentificationNumber(split[2]); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java index 8ef7c44cf..9903b5391 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java @@ -54,11 +54,11 @@ public class OAGeneralConfigValidation { //Check BKU URLs if (isAdmin) { check =form.getBkuHandyURL(); - if (MiscUtil.isEmpty(check)) { - log.info("Empty Handy-BKU URL"); - errors.add(LanguageHelper.getErrorString("validation.general.bku.handy.empty")); - - } else { + if (MiscUtil.isNotEmpty(check)) { +// log.info("Empty Handy-BKU URL"); +// errors.add(LanguageHelper.getErrorString("validation.general.bku.handy.empty")); +// +// } else { if (!ValidationHelper.validateURL(check)) { log.info("Not valid Handy-BKU URL"); errors.add(LanguageHelper.getErrorString("validation.general.bku.handy.valid")); @@ -66,11 +66,11 @@ public class OAGeneralConfigValidation { } check =form.getBkuLocalURL(); - if (MiscUtil.isEmpty(check)) { - log.info("Empty Local-BKU URL"); - errors.add(LanguageHelper.getErrorString("validation.general.bku.local.empty")); - - } else { + if (MiscUtil.isNotEmpty(check)) { +// log.info("Empty Local-BKU URL"); +// errors.add(LanguageHelper.getErrorString("validation.general.bku.local.empty")); +// +// } else { if (!ValidationHelper.validateURL(check)) { log.info("Not valid Online-BKU URL"); errors.add(LanguageHelper.getErrorString("validation.general.bku.local.valid")); @@ -78,11 +78,11 @@ public class OAGeneralConfigValidation { } check =form.getBkuOnlineURL(); - if (MiscUtil.isEmpty(check)) { - log.info("Empty Online-BKU URL"); - errors.add(LanguageHelper.getErrorString("validation.general.bku.online.empty")); - - } else { + if (MiscUtil.isNotEmpty(check)) { +// log.info("Empty Online-BKU URL"); +// errors.add(LanguageHelper.getErrorString("validation.general.bku.online.empty")); +// +// } else { if (!ValidationHelper.validateURL(check)) { log.info("Not valid Online-BKU URL"); errors.add(LanguageHelper.getErrorString("validation.general.bku.online.valid")); -- cgit v1.2.3