diff options
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java')
-rw-r--r-- | id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java | 94 |
1 files changed, 40 insertions, 54 deletions
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 6cea7d33f..da87a197f 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 @@ -72,66 +72,58 @@ public class EditGeneralConfigAction extends ActionSupport public String loadConfig() { Object authUserObj = request.getSession().getAttribute(Constants.SESSION_AUTH); - - if (authUserObj != null && authUserObj instanceof AuthenticatedUser) { - authUser = (AuthenticatedUser) authUserObj; + authUser = (AuthenticatedUser) authUserObj; - if (authUser.isAdmin()) { - - MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); - - moaconfig = new GeneralMOAIDConfig(); - moaconfig.parse(dbconfig); - - ConfigurationDBUtils.closeSession(); - - return Constants.STRUTS_SUCCESS; + if (authUser.isAdmin()) { - } else { - addActionError(LanguageHelper.getErrorString("errors.notallowed", request)); - return Constants.STRUTS_NOTALLOWED; - } + MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration(); + + moaconfig = new GeneralMOAIDConfig(); + moaconfig.parse(dbconfig); - } else - return Constants.STRUTS_REAUTHENTICATE; + ConfigurationDBUtils.closeSession(); + + return Constants.STRUTS_SUCCESS; + + } else { + addActionError(LanguageHelper.getErrorString("errors.notallowed", request)); + return Constants.STRUTS_NOTALLOWED; + } } public String saveConfig() { Object authUserObj = request.getSession().getAttribute(Constants.SESSION_AUTH); - if (authUserObj != null && authUserObj instanceof AuthenticatedUser) { - authUser = (AuthenticatedUser) authUserObj; + authUser = (AuthenticatedUser) authUserObj; + + if (authUser.isAdmin()) { - if (authUser.isAdmin()) { - - MOAConfigValidator validator = new MOAConfigValidator(); - - List<String> errors = validator.validate(moaconfig); + MOAConfigValidator validator = new MOAConfigValidator(); + + List<String> errors = validator.validate(moaconfig); - if (errors.size() > 0) { - log.info("General MOA-ID configuration has some erros."); - for (String el : errors) - addActionError(el); - - return Constants.STRUTS_ERROR_VALIDATION; - } - - String error = saveFormToDatabase(); - - if (error != null) { - log.warn("General MOA-ID config can not be stored in Database"); - addActionError(error); - return Constants.STRUTS_SUCCESS; - } + if (errors.size() > 0) { + log.info("General MOA-ID configuration has some erros."); + for (String el : errors) + addActionError(el); - } else { - addActionError(LanguageHelper.getErrorString("errors.notallowed", request)); - return Constants.STRUTS_NOTALLOWED; + return Constants.STRUTS_ERROR_VALIDATION; + } + + String error = saveFormToDatabase(); + + if (error != null) { + log.warn("General MOA-ID config can not be stored in Database"); + addActionError(error); + return Constants.STRUTS_SUCCESS; } - } else - return Constants.STRUTS_REAUTHENTICATE; + } else { + addActionError(LanguageHelper.getErrorString("errors.notallowed", request)); + return Constants.STRUTS_NOTALLOWED; + } + addActionMessage(LanguageHelper.getGUIString("webpages.moaconfig.save.success")); return Constants.STRUTS_SUCCESS; @@ -141,10 +133,7 @@ public class EditGeneralConfigAction extends ActionSupport Object authUserObj = request.getSession().getAttribute(Constants.SESSION_AUTH); - if (authUserObj != null && authUserObj instanceof AuthenticatedUser) { - authUser = (AuthenticatedUser) authUserObj; - } else - return Constants.STRUTS_REAUTHENTICATE; + authUser = (AuthenticatedUser) authUserObj; return Constants.STRUTS_SUCCESS; } @@ -349,10 +338,7 @@ public class EditGeneralConfigAction extends ActionSupport idlsigners = new IdentityLinkSigners(); dbauth.setIdentityLinkSigners(idlsigners); } - if (moaconfig.getIdlSignersList().size() > 0) { - idlsigners.setX509SubjectName(moaconfig.getIdlSignersList()); - } - + ForeignIdentities dbforeign = dbauth.getForeignIdentities(); if (dbforeign == null) { dbforeign = new ForeignIdentities(); |