diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2013-09-04 07:18:39 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2013-09-04 07:18:39 +0200 |
commit | 8854b5c2c1e342b891271a04face4f4479653d46 (patch) | |
tree | 5dd6054fad6827dc50eeaf95dd629467458d2a12 /id/ConfigWebTool/src/main/java/at | |
parent | 7c6ecaa8adb365a6c670cb86bb68be94136dc6a0 (diff) | |
download | moa-id-spss-8854b5c2c1e342b891271a04face4f4479653d46.tar.gz moa-id-spss-8854b5c2c1e342b891271a04face4f4479653d46.tar.bz2 moa-id-spss-8854b5c2c1e342b891271a04face4f4479653d46.zip |
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
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at')
6 files changed, 183 insertions, 31 deletions
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<String, String> keyBoxIdentifierList; - private String templateURL = null; - + private boolean legacy = false; + List<String> SLTemplates = null; + private Map<String, byte[]> transformations; @@ -141,12 +140,21 @@ public class OAGeneralConfig { TemplatesType templates = oaauth.getTemplates(); if (templates != null) { aditionalAuthBlockText = templates.getAditionalAuthBlockText(); - TemplateType templatetype = templates.getTemplate(); + List<TemplateType> templatetype = templates.getTemplate(); if (templatetype != null) { - templateURL = templatetype.getURL(); + if (SLTemplates == null) { + SLTemplates = new ArrayList<String>(); + } + + for (TemplateType el : templatetype) { + SLTemplates.add(el.getURL()); + } } } + + if (SLTemplates != null && SLTemplates.size() > 0) + legacy = true; List<TransformsInfoType> transforminfos = oaauth.getTransformsInfo(); transformations = new HashMap<String, byte[]>(); @@ -306,20 +314,6 @@ public class OAGeneralConfig { } /** - * @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 */ public Map<String, byte[]> getTransformations() { @@ -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<String>(); + 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<String>(); + 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<String>(); + 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<TemplateType> template = templates.getTemplate(); + if (generalOA.isLegacy()) { + if (template == null) + template = new ArrayList<TemplateType>(); + 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<TransformsInfoType> 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)) { |