From 8854b5c2c1e342b891271a04face4f4479653d46 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 4 Sep 2013 07:18:39 +0200 Subject: Configuration Tool Update and Bugfix -- Username/Password login update -- EditUser, insert second password textfield -- OAConfig: insert OA specific SecurityLayer Templates -- OAConfig: SecurityLayer Version only for admin --- .../id/configuration/data/UserDatabaseFrom.java | 16 +++ .../id/configuration/data/oa/OAGeneralConfig.java | 115 +++++++++++++++++---- .../configuration/struts/action/EditOAAction.java | 31 +++++- .../configuration/struts/action/IndexAction.java | 7 +- .../validation/UserDatabaseFormValidator.java | 15 ++- .../validation/oa/OAGeneralConfigValidation.java | 30 ++++++ .../main/resources/applicationResources.properties | 11 ++ id/ConfigWebTool/src/main/webapp/js/common.js | 12 +++ .../src/main/webapp/jsp/editOAGeneral.jsp | 51 ++++++--- id/ConfigWebTool/src/main/webapp/jsp/edituser.jsp | 7 ++ 10 files changed, 250 insertions(+), 45 deletions(-) (limited to 'id/ConfigWebTool') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/UserDatabaseFrom.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/UserDatabaseFrom.java index e62160285..881cdf277 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/UserDatabaseFrom.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/UserDatabaseFrom.java @@ -14,6 +14,7 @@ public class UserDatabaseFrom { private String phone; private String username; private String password; + private String password_second; private boolean active = false; private boolean admin = false; private boolean passwordActive; @@ -232,6 +233,21 @@ public class UserDatabaseFrom { public void setUserID(String userID) { this.userID = userID; } + + /** + * @return the password_second + */ + public String getPassword_second() { + return password_second; + } + + /** + * @param password_second the password_second to set + */ + public void setPassword_second(String password_second) { + this.password_second = password_second; + } + } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java index 129d62346..57ae4863a 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java @@ -41,9 +41,7 @@ public class OAGeneralConfig { private String identificationType = null; private String aditionalAuthBlockText = null; - - //TODO: look Template!!! - + private String mandateProfiles = null; private boolean isActive = false; @@ -55,8 +53,9 @@ public class OAGeneralConfig { private String keyBoxIdentifier = null; private static Map keyBoxIdentifierList; - private String templateURL = null; - + private boolean legacy = false; + List SLTemplates = null; + private Map transformations; @@ -141,12 +140,21 @@ public class OAGeneralConfig { TemplatesType templates = oaauth.getTemplates(); if (templates != null) { aditionalAuthBlockText = templates.getAditionalAuthBlockText(); - TemplateType templatetype = templates.getTemplate(); + List templatetype = templates.getTemplate(); if (templatetype != null) { - templateURL = templatetype.getURL(); + if (SLTemplates == null) { + SLTemplates = new ArrayList(); + } + + for (TemplateType el : templatetype) { + SLTemplates.add(el.getURL()); + } } } + + if (SLTemplates != null && SLTemplates.size() > 0) + legacy = true; List transforminfos = oaauth.getTransformsInfo(); transformations = new HashMap(); @@ -305,20 +313,6 @@ public class OAGeneralConfig { this.keyBoxIdentifier = keyBoxIdentifier; } - /** - * @return the templateURL - */ - public String getTemplateURL() { - return templateURL; - } - - /** - * @param templateURL the templateURL to set - */ - public void setTemplateURL(String templateURL) { - this.templateURL = templateURL; - } - /** * @return the transformations */ @@ -388,6 +382,85 @@ public class OAGeneralConfig { keyBoxIdentifierList = list; } + + /** + * @return the legacy + */ + public boolean isLegacy() { + return legacy; + } + + + /** + * @param legacy the legacy to set + */ + public void setLegacy(boolean legacy) { + this.legacy = legacy; + } + + + /** + * @return the sLTemplateURL1 + */ + public String getSLTemplateURL1() { + if (SLTemplates != null && SLTemplates.size() > 0) + return SLTemplates.get(0); + else + return null; + } + + + /** + * @param sLTemplateURL1 the sLTemplateURL1 to set + */ + public void setSLTemplateURL1(String sLTemplateURL1) { + if (SLTemplates == null) + SLTemplates = new ArrayList(); + SLTemplates.add(sLTemplateURL1); + } + + + /** + * @return the sLTemplateURL2 + */ + public String getSLTemplateURL2() { + if (SLTemplates != null && SLTemplates.size() > 1) + return SLTemplates.get(1); + else + return null; + } + + + /** + * @param sLTemplateURL2 the sLTemplateURL2 to set + */ + public void setSLTemplateURL2(String sLTemplateURL2) { + if (SLTemplates == null) + SLTemplates = new ArrayList(); + SLTemplates.add(sLTemplateURL2); + } + + + /** + * @return the sLTemplateURL3 + */ + public String getSLTemplateURL3() { + if (SLTemplates != null && SLTemplates.size() > 2) + return SLTemplates.get(2); + else + return null; + } + + + /** + * @param sLTemplateURL3 the sLTemplateURL3 to set + */ + public void setSLTemplateURL3(String sLTemplateURL3) { + if (SLTemplates == null) + SLTemplates = new ArrayList(); + SLTemplates.add(sLTemplateURL3); + } + } 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 0f2a40aa7..297d80726 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 @@ -370,12 +370,35 @@ ServletResponseAware { } templates.setAditionalAuthBlockText(generalOA.getAditionalAuthBlockText()); - TemplateType template = templates.getTemplate(); - if (template == null) { - //TODO: if OA specific templateURL is required + List template = templates.getTemplate(); + if (generalOA.isLegacy()) { + if (template == null) + template = new ArrayList(); + else + template.clear(); + + if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL1())) { + TemplateType el = new TemplateType(); + el.setURL(generalOA.getSLTemplateURL1()); + template.add(el); + } + if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL2())) { + TemplateType el = new TemplateType(); + el.setURL(generalOA.getSLTemplateURL2()); + template.add(el); + } + if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL3())) { + TemplateType el = new TemplateType(); + el.setURL(generalOA.getSLTemplateURL3()); + template.add(el); + } + + } else { + if (template != null && template.size() > 0) + template.clear(); } - + //set default transformation if it is empty List transformsInfo = authoa.getTransformsInfo(); if (transformsInfo == null) { diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java index 6aeebcf7b..6078caa87 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java @@ -72,22 +72,23 @@ public class IndexAction extends ActionSupport implements ServletRequestAware, } } + UserDatabase dbuser = ConfigurationDBRead.getUserWithUserName(username); if (dbuser == null) { log.warn("Unknown Username"); - addActionError(LanguageHelper.getErrorString("webpages.index.username.unkown")); + addActionError(LanguageHelper.getErrorString("webpages.index.login.notallowed")); return Constants.STRUTS_ERROR; } else { if (!dbuser.isIsActive()) { log.warn("Username " + dbuser.getUsername() + " is not active"); - addActionError(LanguageHelper.getErrorString("webpages.index.username.notactive")); + addActionError(LanguageHelper.getErrorString("webpages.index.login.notallowed")); return Constants.STRUTS_ERROR; } if (!dbuser.getPassword().equals(key)) { log.warn("Username " + dbuser.getUsername() + " use a false password"); - addActionError(LanguageHelper.getErrorString("webpages.index.password.false")); + addActionError(LanguageHelper.getErrorString("webpages.index.login.notallowed")); return Constants.STRUTS_ERROR; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java index 8e6edf52a..276b0b4c8 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/UserDatabaseFormValidator.java @@ -111,6 +111,7 @@ public class UserDatabaseFormValidator { } check = form.getPassword(); + if (MiscUtil.isEmpty(check)) { if (userID == -1) { log.warn("Password is empty"); @@ -124,9 +125,17 @@ public class UserDatabaseFormValidator { } } else { - String key = AuthenticationHelper.generateKeyFormPassword(check); - if (key == null) { - errors.add(LanguageHelper.getErrorString("validation.edituser.password.valid")); + + if (check.equals(form.getPassword_second())) { + + String key = AuthenticationHelper.generateKeyFormPassword(check); + if (key == null) { + errors.add(LanguageHelper.getErrorString("validation.edituser.password.valid")); + } + + } + else { + errors.add(LanguageHelper.getErrorString("validation.edituser.password.equal")); } } 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 06b50ac3c..fa992674e 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 @@ -91,6 +91,36 @@ public class OAGeneralConfigValidation { } } + //check LegacyMode SLTemplates + if (form.isLegacy()) { + if (MiscUtil.isEmpty(form.getSLTemplateURL1()) && + MiscUtil.isEmpty(form.getSLTemplateURL2()) && + MiscUtil.isEmpty(form.getSLTemplateURL3()) ) { + log.info("Empty OA-specific SecurityLayer Templates"); + errors.add(LanguageHelper.getErrorString("validation.general.sltemplates.empty")); + + } else { + check = form.getSLTemplateURL1(); + if (MiscUtil.isNotEmpty(check) && + !ValidationHelper.validateURL(check) ) { + log.info("First OA-specific SecurityLayer Templates is not valid"); + errors.add(LanguageHelper.getErrorString("validation.general.sltemplate1.valid")); + } + check = form.getSLTemplateURL2(); + if (MiscUtil.isNotEmpty(check) && + !ValidationHelper.validateURL(check) ) { + log.info("Second OA-specific SecurityLayer Templates is not valid"); + errors.add(LanguageHelper.getErrorString("validation.general.sltemplate2.valid")); + } + check = form.getSLTemplateURL3(); + if (MiscUtil.isNotEmpty(check) && + !ValidationHelper.validateURL(check) ) { + log.info("Third OA-specific SecurityLayer Templates is not valid"); + errors.add(LanguageHelper.getErrorString("validation.general.sltemplate3.valid")); + } + } + } + //check Mandate Profiles check = form.getMandateProfiles(); if (MiscUtil.isNotEmpty(check)) { diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties index 46f591cb3..0effc6961 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties @@ -28,6 +28,7 @@ webpages.index.header=Willkommen bei der MOA-ID 2.x Konfigurationsapplikation webpages.index.desciption.head=Um dieses Service nutzen zu k\u00F6nnen m\u00FCssen sie sich einloggen. webpages.index.login=Anmelden webpages.index.logout=Abmelden +webpages.index.login.notallowed=Entweder sind Benutzername oder Passwort sind nicht korrekt oder der Account wurde noch nicht aktiviert. webpages.index.username.unkown=Der Benutzer ist nicht bekannt. webpages.index.username.notactive=Der Benutzer wurde durch den Administrator noch nicht freigeschalten. webpages.index.password.false=Das Passwort stimmt nicht. @@ -58,6 +59,7 @@ webpages.edituser.mail=EMail Adresse webpages.edituser.access.header=Zugangsdaten webpages.edituser.username=Benutzername webpages.edituser.password=Kennwort +webpages.edituser.password_second=Kennwort wiederholen webpages.edituser.bpk=BPK webpages.edituser.role.header=Rechte und Role webpages.edituser.active=Benutzer ist aktiviert @@ -139,6 +141,10 @@ webpages.oaconfig.general.bku.online=Online BKU webpages.oaconfig.general.bku.handy=Handy BKU webpages.oaconfig.general.bku.slversion=SecurityLayer Version webpages.oaconfig.general.bku.keyboxidentifier=KeyBoxIdentifier +webpages.oaconfig.general.bku.legacy=Legacy Modus +webpages.oaconfig.general.bku.sltemplate.first=1. SecurityLayer Template +webpages.oaconfig.general.bku.sltemplate.second=2. SecurityLayer Template +webpages.oaconfig.general.bku.sltemplate.third=3. SecurityLayer Template webpages.oaconfig.general.identification=Eindeutiger Identifikatior (PublicURLPrefix) webpages.oaconfig.general.mandate.header=Vollmachten webpages.oaconfig.general.mandate.profiles=Profile @@ -212,6 +218,7 @@ validation.edituser.username.valid=Der Benutzername enth\u00E4lt nicht erlaubte validation.edituser.username.duplicate=Der Benutzername ist bereits vergeben validation.edituser.password.empty=Das Passwort ist leer. validation.edituser.password.valid=Das Passwort konnte nicht in einen g\u00FCltigen Schl\u00FCssel transferiert werden. +validation.edituser.password.equal=Die Passw\u00F6rter sind nicht identisch. validation.edituser.bpk.valid=Die BPK enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} validation.general.AlternativeSourceID=Die AlternaticeSourceID enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} @@ -273,6 +280,10 @@ validation.general.oafriendlyname.empty=Es wurde keine Online-Applikation angege validation.general.oafriendlyname=Der Name der Online-Applikation enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} validation.general.keyboxidentifier.empty=Es wurde kein KeyBoxIdentifier ausgew\u00E4hlt. validation.general.keyboxidentifier.valid=Der KeyBoxIdentifier hat ein ung\u00FCltiges Format. +validation.general.sltemplates.empty=Wenn der Legacymodus verwendet werden soll muss zumindest ein SecurityLayer Template angegeben werden. +validation.general.sltemplate1.valid=Die erste SecurityLayer Template URL hat kein g\u00FCltiges Format. +validation.general.sltemplate2.valid=Die zweite SecurityLayer Template URL hat kein g\u00FCltiges Format. +validation.general.sltemplate3.valid=Die dritte SecurityLayer Template URL hat kein g\u00FCltiges Format. validation.general.mandate.profiles=Die Liste von Vollmachtsprofilen enth\u00E4lt nicht erlaubte Zeichen. Folgende Zeichen sind nicht erlaubt\: {0} validation.general.target.empty=Der Target f\u00FCr die Online-Applikation ist leer. validation.general.target.valid=Der Target f\u00FCr die Online-Applikation hat kein g\u00FCltiges Format. diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index 5271a4006..249cb37fa 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -52,8 +52,20 @@ function userOA(userid){ $('#selectUserForm_OAID').val(userid); $('#selectUserForm').submit(); } +function oaLegacyService() { + if ($('#OAislegacy').attr('checked') == 'checked') { + + $('#oa_config_sltemplates').css('display', "block"); + + } else { + + $('#oa_config_sltemplates').css('display', "none"); + + } +} function oaOnLoad() { oaBusinessService(); oaSSOService(); + oaLegacyService(); return true; } \ No newline at end of file diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index 4d9642130..60f253222 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -121,20 +121,14 @@ cssClass="textfield_long"> - - - -<%-- - --%> - + + + + + + +
+ + + + + + +
+ diff --git a/id/ConfigWebTool/src/main/webapp/jsp/edituser.jsp b/id/ConfigWebTool/src/main/webapp/jsp/edituser.jsp index a332fb425..067bcd57d 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/edituser.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/edituser.jsp @@ -93,6 +93,13 @@ cssClass="textfield_long" maxlength="16"> + + +