aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-02-11 08:13:51 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-02-11 08:13:51 +0100
commitb905c43b4630d290026d03e744413b20f1b73551 (patch)
treecebfc91f43ad1e5eda977d4fc2509859abd7c4da /id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
parentf86ebab09aad5971c86dce3827d46a0d41003994 (diff)
downloadmoa-id-spss-b905c43b4630d290026d03e744413b20f1b73551.tar.gz
moa-id-spss-b905c43b4630d290026d03e744413b20f1b73551.tar.bz2
moa-id-spss-b905c43b4630d290026d03e744413b20f1b73551.zip
* add OA specific BKU selection template
* add OA specific send-assertion template * add OA specific applet height and width configuration * add PVP2.x reload checkbox in PVP2.x OA configuration * add new elements to MOA-ID configuration
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java112
1 files changed, 97 insertions, 15 deletions
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 25c3f24b9..b0de196ca 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
@@ -34,6 +34,7 @@ import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -63,7 +64,6 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO;
import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplicationType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.STORK;
import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType;
import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType;
import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType;
@@ -85,6 +85,7 @@ import at.gv.egovernment.moa.id.configuration.helper.MailHelper;
import at.gv.egovernment.moa.id.configuration.validation.FormularCustomizationValitator;
import at.gv.egovernment.moa.id.configuration.validation.TargetValidator;
import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper;
+import at.gv.egovernment.moa.id.configuration.validation.oa.OAFileUploadValidation;
import at.gv.egovernment.moa.id.configuration.validation.oa.OAGeneralConfigValidation;
import at.gv.egovernment.moa.id.configuration.validation.oa.OAOAUTH20ConfigValidation;
import at.gv.egovernment.moa.id.configuration.validation.oa.OAPVP2ConfigValidation;
@@ -126,9 +127,12 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
private OAOAuth20Config oauth20OA = new OAOAuth20Config();
private OASTORKConfig storkOA = new OASTORKConfig();
private FormularCustomization formOA = new FormularCustomization();
-
+
private InputStream stream;
+ private Map<String, byte[]> sendAssertionForm = new HashMap<String, byte[]>();
+ private Map<String, byte[]> bkuSelectionForm = new HashMap<String, byte[]>();
+
// STRUTS actions
public String inital() {
HttpSession session = request.getSession();
@@ -365,6 +369,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
OASTORKConfigValidation validator_stork = new OASTORKConfigValidation();
FormularCustomizationValitator validator_form = new FormularCustomizationValitator();
OAOAUTH20ConfigValidation validatior_oauth20 = new OAOAUTH20ConfigValidation();
+ OAFileUploadValidation valiator_fileUpload = new OAFileUploadValidation();
errors.addAll(validatior_general.validate(generalOA, authUser.isAdmin()));
errors.addAll(validatior_pvp2.validate(pvp2OA));
@@ -374,6 +379,37 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
errors.addAll(validator_form.validate(formOA));
errors.addAll(validatior_oauth20.validate(oauth20OA));
+ //validate BKU-selection template
+ List<String> templateError = valiator_fileUpload.validate(generalOA.getBkuSelectionFileUploadFileName()
+ , generalOA.getBkuSelectionFileUpload(), "validation.general.bkuselection", bkuSelectionForm);
+ if (templateError != null && templateError.size() == 0) {
+ if (bkuSelectionForm != null && bkuSelectionForm.size() > 0)
+ session.setAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE, bkuSelectionForm);
+
+ else
+ bkuSelectionForm = (Map<String, byte[]>) session.getAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
+
+ } else {
+ errors.addAll(templateError);
+
+ }
+
+ //validate send-assertion template
+ templateError = valiator_fileUpload.validate(generalOA.getSendAssertionFileUploadFileName()
+ , generalOA.getSendAssertionFileUpload(), "validation.general.sendassertion", sendAssertionForm);
+ if (templateError != null && templateError.size() == 0) {
+ if (sendAssertionForm != null && sendAssertionForm.size() > 0)
+ session.setAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE, sendAssertionForm);
+
+ else
+ sendAssertionForm = (Map<String, byte[]>) session.getAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
+
+ } else {
+ errors.addAll(templateError);
+
+ }
+
+
// Do not allow SSO in combination with special BKUSelection features
if (ssoOA.isUseSSO() && (formOA.isOnlyMandateAllowed() || !formOA.isShowMandateLoginButton())) {
log.warn("Special BKUSelection features can not be used in combination with SSO");
@@ -432,12 +468,26 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
}
}
+
+ //save OA configuration
+ String error = saveOAConfigToDatabase(onlineapplication, newentry);
+ if (MiscUtil.isNotEmpty(error)) {
+ log.warn("OA configuration can not be stored!");
+ addActionError(error);
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ return Constants.STRUTS_ERROR_VALIDATION;
+ }
+ //set metadata reload flag if reload is required
if (pvp2OA.getMetaDataURL() != null) {
try {
if (isMetaDataRefreshRequired
- || !pvp2OA.getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) {
+ || !pvp2OA.getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())
+ || pvp2OA.getFileUpload() != null
+ || pvp2OA.isReLoad()) {
log.debug("Set PVP2 Metadata refresh flag.");
MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
@@ -451,16 +501,6 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
}
-
- String error = saveOAConfigToDatabase(onlineapplication, newentry);
- if (MiscUtil.isNotEmpty(error)) {
- log.warn("OA configuration can not be stored!");
- addActionError(error);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- return Constants.STRUTS_ERROR_VALIDATION;
- }
}
Object nextPageAttr = session.getAttribute(Constants.SESSION_RETURNAREA);
@@ -495,9 +535,12 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
} else
addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.success", generalOA.getIdentifier(), request));
- request.getSession().setAttribute(Constants.SESSION_OAID, null);
- ConfigurationDBUtils.closeSession();
+ //remove session attributes
+ session.setAttribute(Constants.SESSION_OAID, null);
+ session.removeAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
+ session.removeAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
+ ConfigurationDBUtils.closeSession();
return Constants.STRUTS_SUCCESS;
}
@@ -808,6 +851,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
}
+ //store BKU-URLs
BKUURLS bkuruls = new BKUURLS();
authoa.setBKUURLS(bkuruls);
if (authUser.isAdmin()) {
@@ -822,6 +866,41 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
authoa.setTemplates(templates);
}
+ //store BKU-selection and send-assertion templates
+ if (authUser.isAdmin()) {
+
+ if(generalOA.isDeleteBKUTemplate())
+ templates.setBKUSelectionTemplate(null);
+
+ if (generalOA.isDeleteSendAssertionTemplate())
+ templates.setSendAssertionTemplate(null);
+
+
+ if (bkuSelectionForm != null && bkuSelectionForm.size() > 0) {
+ TransformsInfoType template = new TransformsInfoType();
+
+ Iterator<String> interator = bkuSelectionForm.keySet().iterator();
+ template.setFilename(interator.next());
+ template.setTransformation(bkuSelectionForm.get(
+ template.getFilename()));
+
+ templates.setBKUSelectionTemplate(template);
+ }
+
+ if (sendAssertionForm != null && sendAssertionForm.size() > 0) {
+ TransformsInfoType template = new TransformsInfoType();
+
+ Iterator<String> interator = sendAssertionForm.keySet().iterator();
+ template.setFilename(interator.next());
+ template.setTransformation(sendAssertionForm.get(
+ template.getFilename()));
+
+ templates.setSendAssertionTemplate(template);
+ }
+ }
+
+
+ //store BKU-selection customization
BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization();
if (bkuselectioncustom == null) {
bkuselectioncustom = new BKUSelectionCustomizationType();
@@ -887,6 +966,9 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
bkuselectioncustom.setFontType(formOA.getFontType());
+ bkuselectioncustom.setAppletHeight(formOA.getApplet_height());
+ bkuselectioncustom.setAppletWidth(formOA.getApplet_width());
+
}
// set default transformation if it is empty