aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
diff options
context:
space:
mode:
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.java648
1 files changed, 98 insertions, 550 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 88dcbb5da..2cbac64ff 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
@@ -67,25 +67,46 @@ public class EditOAAction extends BasicAction {
private boolean newOA;
private String formID;
- private boolean onlyBusinessService = false;
- private boolean subTargetSet = false;
- private boolean deaktivededBusinessService = false;
private boolean isMetaDataRefreshRequired = false;
-
private String nextPage;
-
- private OAGeneralConfig generalOA = new OAGeneralConfig();
- private OAPVP2Config pvp2OA = new OAPVP2Config();
- private OASAML1Config saml1OA = new OASAML1Config();
- private OASSOConfig ssoOA = new OASSOConfig();
- 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[]>();
+
+ private LinkedHashMap<String, IOnlineApplicationData> formList;
+
+ /**
+ *
+ */
+ public EditOAAction() {
+ formList = new LinkedHashMap<String, IOnlineApplicationData>();
+
+ OAGeneralConfig generalOA = new OAGeneralConfig();
+ formList.put(generalOA.getName(), generalOA);
+
+ OAAuthenticationData authOA = new OAAuthenticationData();
+ formList.put(authOA.getName(), authOA);
+
+ OASSOConfig ssoOA = new OASSOConfig();
+ formList.put(ssoOA.getName(), ssoOA);
+
+ OASAML1Config saml1OA = new OASAML1Config();
+ formList.put(saml1OA.getName(), saml1OA);
+
+ OAPVP2Config pvp2OA = new OAPVP2Config();
+ formList.put(pvp2OA.getName(), pvp2OA);
+
+ OAOAuth20Config oauth20OA = new OAOAuth20Config();
+ formList.put(oauth20OA.getName(), oauth20OA);
+
+ OASTORKConfig storkOA = new OASTORKConfig();
+ formList.put(storkOA.getName(), storkOA);
+
+ Map<String, String> map = new HashMap<String, String>();
+ map.putAll(FormBuildUtils.getDefaultMap());
+ FormularCustomization formOA = new FormularCustomization(map);
+ formList.put(formOA.getName(), formOA);
+
+ }
+
// STRUTS actions
public String inital() {
@@ -134,32 +155,19 @@ public class EditOAAction extends BasicAction {
}
}
- generalOA.parse(onlineapplication);
- ssoOA.parse(onlineapplication);
- saml1OA.parse(onlineapplication);
- oauth20OA.parse(onlineapplication, request);
- session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret());
-
- storkOA.parse(onlineapplication);
-
- Map<String, String> map = new HashMap<String, String>();
- map.putAll(FormBuildUtils.getDefaultMap());
- formOA.parse(onlineapplication, map);
-
- session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, map);
-
- List<String> errors = pvp2OA.parse(onlineapplication, request);
-
+ List<String> errors = new ArrayList<String>();
+
+
+ for (IOnlineApplicationData form : formList.values()) {
+ List<String> error = form.parse(onlineapplication, authUser, request);
+ if (error != null)
+ errors.addAll(error);
+ }
if (errors.size() > 0) {
for (String el : errors)
addActionError(el);
}
- subTargetSet = MiscUtil.isNotEmpty(generalOA.getTarget_subsector());
-
- // set UserSpezific OA Parameters
- if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
-
ConfigurationDBUtils.closeSession();
session.setAttribute(Constants.SESSION_OAID, oaid);
@@ -192,35 +200,13 @@ public class EditOAAction extends BasicAction {
addActionError(LanguageHelper.getErrorString("error.editoa.mailverification", request));
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();
-
- //VIDP attribute provider configuration
- storkOA = new OASTORKConfig();
- storkOA.getAttributeProviderPlugins().add(new AttributeProviderPlugin());
newOA = true;
formID = Random.nextRandom();
session.setAttribute(Constants.SESSION_FORMID, formID);
-
session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, null);
-
- this.oauth20OA.generateClientSecret();
- session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret());
-
+ session.setAttribute(Constants.SESSION_OAUTH20SECRET, ((OAOAuth20Config)formList.get(new OAOAuth20Config().getName())).getClientSecret());
+
return Constants.STRUTS_OA_EDIT;
}
@@ -276,7 +262,8 @@ public class EditOAAction extends BasicAction {
}
// valid DBID and check entry
- String oaidentifier = generalOA.getIdentifier();
+ OAGeneralConfig oaGeneralForm = ((OAGeneralConfig)formList.get(new OAGeneralConfig().getName()));
+ String oaidentifier = oaGeneralForm.getIdentifier();
if (MiscUtil.isEmpty(oaidentifier)) {
log.info("Empty OA identifier");
errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.empty", request));
@@ -310,66 +297,18 @@ public class EditOAAction extends BasicAction {
}
}
- // set UserSpezific OA Parameters
- if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
-
- // check form
- OAGeneralConfigValidation validatior_general = new OAGeneralConfigValidation();
- OAPVP2ConfigValidation validatior_pvp2 = new OAPVP2ConfigValidation();
- OASAML1ConfigValidation validatior_saml1 = new OASAML1ConfigValidation();
- OASSOConfigValidation validatior_sso = new OASSOConfigValidation();
- 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(), request));
- errors.addAll(validatior_pvp2.validate(pvp2OA, request));
- errors.addAll(validatior_saml1.validate(saml1OA, generalOA, request));
- errors.addAll(validatior_sso.validate(ssoOA, authUser.isAdmin(), request));
- errors.addAll(validator_stork.validate(storkOA, request));
- errors.addAll(validator_form.validate(formOA, request));
- errors.addAll(validatior_oauth20.validate(oauth20OA, request));
-
- //validate BKU-selection template
- List<String> templateError = valiator_fileUpload.validate(generalOA.getBkuSelectionFileUploadFileName()
- , generalOA.getBkuSelectionFileUpload(), "validation.general.bkuselection", bkuSelectionForm, request);
- 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, request);
- 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);
-
- }
-
+ //validate forms
+ for (IOnlineApplicationData form : formList.values())
+ errors.addAll(form.validate(oaGeneralForm, authUser, request));
// Do not allow SSO in combination with special BKUSelection features
- if (ssoOA.isUseSSO() && (formOA.isOnlyMandateAllowed() || !formOA.isShowMandateLoginButton())) {
+ if (getSsoOA().isUseSSO() && (getFormOA().isOnlyMandateAllowed() || !getFormOA().isShowMandateLoginButton())) {
log.warn("Special BKUSelection features can not be used in combination with SSO");
errors.add(LanguageHelper.getErrorString("validation.general.bkuselection.specialfeatures.valid", request));
}
if (errors.size() > 0) {
- log.info("OAConfiguration with ID " + generalOA.getIdentifier() + " has some errors.");
+ log.info("OAConfiguration with ID " + oaGeneralForm.getIdentifier() + " has some errors.");
for (String el : errors)
addActionError(el);
@@ -383,7 +322,7 @@ public class EditOAAction extends BasicAction {
if (onlineapplication == null) {
onlineapplication = new OnlineApplication();
- newentry = true;
+ onlineapplication.setIsNew(true);
onlineapplication.setIsActive(false);
if (!authUser.isAdmin()) {
@@ -393,7 +332,8 @@ public class EditOAAction extends BasicAction {
isMetaDataRefreshRequired = true;
} else {
- if (!authUser.isAdmin() && !onlineapplication.getPublicURLPrefix().equals(generalOA.getIdentifier())) {
+ onlineapplication.setIsNew(false);
+ if (!authUser.isAdmin() && !onlineapplication.getPublicURLPrefix().equals(oaGeneralForm.getIdentifier())) {
onlineapplication.setIsAdminRequired(true);
onlineapplication.setIsActive(false);
@@ -403,7 +343,7 @@ public class EditOAAction extends BasicAction {
}
if ((onlineapplication.isIsAdminRequired() == null)
- || (authUser.isAdmin() && generalOA.isActive() && onlineapplication.isIsAdminRequired())) {
+ || (authUser.isAdmin() && oaGeneralForm.isActive() && onlineapplication.isIsAdminRequired())) {
onlineapplication.setIsAdminRequired(false);
isMetaDataRefreshRequired = true;
@@ -422,7 +362,7 @@ public class EditOAAction extends BasicAction {
}
//save OA configuration
- String error = saveOAConfigToDatabase(onlineapplication, newentry);
+ String error = saveOAConfigToDatabase(onlineapplication);
if (MiscUtil.isNotEmpty(error)) {
log.warn("OA configuration can not be stored!");
addActionError(error);
@@ -433,13 +373,13 @@ public class EditOAAction extends BasicAction {
}
//set metadata reload flag if reload is required
- if (pvp2OA.getMetaDataURL() != null) {
+ if (getPvp2OA().getMetaDataURL() != null) {
try {
if (isMetaDataRefreshRequired
- || !pvp2OA.getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())
- || pvp2OA.getFileUpload() != null
- || pvp2OA.isReLoad()) {
+ || !getPvp2OA().getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())
+ || getPvp2OA().getFileUpload() != null
+ || getPvp2OA().isReLoad()) {
log.debug("Set PVP2 Metadata refresh flag.");
MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
@@ -474,7 +414,7 @@ public class EditOAAction extends BasicAction {
if (openUsers != null) numusers = openUsers.size();
try {
- addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.success.admin", generalOA.getIdentifier(), request));
+ addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.success.admin", oaGeneralForm.getIdentifier(), request));
if (numusers > 0 || numoas > 0) MailHelper.sendAdminMail(numoas, numusers);
@@ -483,7 +423,7 @@ public class EditOAAction extends BasicAction {
}
} else
- addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.success", generalOA.getIdentifier(), request));
+ addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.success", oaGeneralForm.getIdentifier(), request));
//remove session attributes
session.setAttribute(Constants.SESSION_OAID, null);
@@ -514,7 +454,7 @@ public class EditOAAction extends BasicAction {
session.setAttribute(Constants.SESSION_OAID, null);
- addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.cancle", generalOA.getIdentifier(), request));
+ addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.cancle", getGeneralOA().getIdentifier(), request));
ConfigurationDBUtils.closeSession();
@@ -560,7 +500,7 @@ public class EditOAAction extends BasicAction {
return Constants.STRUTS_SUCCESS;
}
- String oaidentifier = generalOA.getIdentifier();
+ String oaidentifier = getGeneralOA().getIdentifier();
if (MiscUtil.isEmpty(oaidentifier)) {
log.info("Empty OA identifier");
addActionError(LanguageHelper.getErrorString("validation.general.oaidentifier.empty", request));
@@ -620,13 +560,13 @@ public class EditOAAction extends BasicAction {
ConfigurationDBUtils.closeSession();
- addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", generalOA.getIdentifier(), request));
+ addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", oaidentifier, request));
return Constants.STRUTS_SUCCESS;
} else {
ConfigurationDBUtils.closeSession();
- addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", generalOA.getIdentifier(), request));
+ addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", oaidentifier, request));
return Constants.STRUTS_SUCCESS;
}
@@ -712,335 +652,13 @@ public class EditOAAction extends BasicAction {
return Constants.STRUTS_SUCCESS;
}
- private String saveOAConfigToDatabase(OnlineApplication dboa, boolean newentry) {
-
- AuthComponentOA authoa = dboa.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dboa.setAuthComponentOA(authoa);
- }
-
- if (authUser.isAdmin()) dboa.setIsActive(generalOA.isActive());
-
- dboa.setFriendlyName(generalOA.getFriendlyName());
- dboa.setCalculateHPI(generalOA.isCalculateHPI());
- dboa.setRemoveBPKFromAuthBlock(generalOA.isHideBPKAuthBlock());
-
- if (authUser.isAdmin())
- dboa.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(generalOA.getKeyBoxIdentifier()));
- else {
- if (newentry) dboa.setKeyBoxIdentifier(MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR);
- }
-
- dboa.setPublicURLPrefix(generalOA.getIdentifier());
-
- if (generalOA.isBusinessService() || onlyBusinessService) {
-
- dboa.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
-
- String num = generalOA.getIdentificationNumber().replaceAll(" ", "");
- 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());
-
- if (num.startsWith(Constants.IDENIFICATIONTYPE_ERSB))
- num = num.substring(Constants.IDENIFICATIONTYPE_ERSB.length());
-
- IdentificationNumber idnumber = new IdentificationNumber();
-
- if (generalOA.getIdentificationType().equals(Constants.IDENIFICATIONTYPE_STORK)) {
- idnumber.setValue(Constants.PREFIX_STORK + "AT" + "+" + num);
- idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType()));
- } else {
- idnumber.setValue(Constants.PREFIX_WPBK + generalOA.getIdentificationType() + "+" + num);
- idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType()));
- }
-
-
- authoa.setIdentificationNumber(idnumber);
-
- } else {
- dboa.setType(null);
-
- if (authUser.isAdmin()) {
- if (MiscUtil.isNotEmpty(generalOA.getTarget_admin()) && generalOA.isAdminTarget()) {
- dboa.setTarget(generalOA.getTarget_admin());
- dboa.setTargetFriendlyName(generalOA.getTargetFriendlyName());
-
- } else {
-
- String target = generalOA.getTarget();
-
- if (MiscUtil.isNotEmpty(generalOA.getTarget_subsector()) && subTargetSet)
- dboa.setTarget(target + "-" + generalOA.getTarget_subsector());
- else
- dboa.setTarget(target);
-
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dboa.setTargetFriendlyName(targetname);
-
- }
-
- } else {
-
- if (MiscUtil.isNotEmpty(generalOA.getTarget())) {
-
- String target = generalOA.getTarget();
-
- if (MiscUtil.isNotEmpty(generalOA.getTarget_subsector()) && subTargetSet)
- dboa.setTarget(target + "-" + generalOA.getTarget_subsector());
-
- else
- dboa.setTarget(target);
-
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dboa.setTargetFriendlyName(targetname);
-
- }
- }
- }
-
- //store BKU-URLs
- BKUURLS bkuruls = new BKUURLS();
- authoa.setBKUURLS(bkuruls);
- if (authUser.isAdmin()) {
- bkuruls.setHandyBKU(generalOA.getBkuHandyURL());
- bkuruls.setLocalBKU(generalOA.getBkuLocalURL());
- bkuruls.setOnlineBKU(generalOA.getBkuOnlineURL());
- }
-
- TemplatesType templates = authoa.getTemplates();
- if (templates == null) {
- templates = new TemplatesType();
- 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();
- templates.setBKUSelectionCustomization(bkuselectioncustom);
- }
-
- Mandates mandates = new Mandates();
- if (generalOA.isUseMandates()) {
- mandates.setProfiles(generalOA.getMandateProfiles());
-
- } else {
- mandates.setProfiles(new String());
- }
-
- authoa.setMandates(mandates);
- bkuselectioncustom.setMandateLoginButton(MiscUtil.isNotEmpty(generalOA.getMandateProfiles()));
- bkuselectioncustom.setOnlyMandateLoginAllowed(formOA.isOnlyMandateAllowed());
-
- if (authUser.isAdmin()) {
- templates.setAditionalAuthBlockText(generalOA.getAditionalAuthBlockText());
-
- 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);
- } else
- template.add(new TemplateType());
- if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL2())) {
- TemplateType el = new TemplateType();
- el.setURL(generalOA.getSLTemplateURL2());
- template.add(el);
- } else
- template.add(new TemplateType());
- if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL3())) {
- TemplateType el = new TemplateType();
- el.setURL(generalOA.getSLTemplateURL3());
- template.add(el);
- } else
- template.add(new TemplateType());
-
- } else {
- if (template != null && template.size() > 0) template.clear();
- }
-
- bkuselectioncustom.setBackGroundColor(parseColor(formOA.getBackGroundColor()));
- bkuselectioncustom.setFrontColor(parseColor(formOA.getFrontColor()));
-
- bkuselectioncustom.setHeaderBackGroundColor(parseColor(formOA.getHeader_BackGroundColor()));
- bkuselectioncustom.setHeaderFrontColor(parseColor(formOA.getHeader_FrontColor()));
- bkuselectioncustom.setHeaderText(formOA.getHeader_text());
-
- bkuselectioncustom.setButtonBackGroundColor(parseColor(formOA.getButton_BackGroundColor()));
- bkuselectioncustom.setButtonBackGroundColorFocus(parseColor(formOA.getButton_BackGroundColorFocus()));
- bkuselectioncustom.setButtonFontColor(parseColor(formOA.getButton_FrontColor()));
-
- if (MiscUtil.isNotEmpty(formOA.getAppletRedirectTarget()))
- bkuselectioncustom.setAppletRedirectTarget(formOA.getAppletRedirectTarget());
-
- bkuselectioncustom.setFontType(formOA.getFontType());
-
- bkuselectioncustom.setAppletHeight(formOA.getApplet_height());
- bkuselectioncustom.setAppletWidth(formOA.getApplet_width());
-
- }
-
- // set default transformation if it is empty
- List<TransformsInfoType> transformsInfo = authoa.getTransformsInfo();
- if (transformsInfo == null) {
- // TODO: set OA specific transformation if it is required
-
- }
-
- OAPVP2 pvp2 = authoa.getOAPVP2();
- if (pvp2 == null) {
- pvp2 = new OAPVP2();
- authoa.setOAPVP2(pvp2);
- }
-
- try {
-
- if (pvp2OA.getFileUpload() != null) {
- pvp2.setCertificate(pvp2OA.getCertificate());
- pvp2OA.setReLoad(true);
- }
-
- } catch (CertificateException e) {
- log.info("Uploaded Certificate can not be found", e);
- return LanguageHelper.getErrorString("validation.pvp2.certificate.notfound", request);
- } catch (IOException e) {
- log.info("Uploaded Certificate can not be parsed", e);
- return LanguageHelper.getErrorString("validation.pvp2.certificate.format", request);
- }
-
- if (pvp2OA.getMetaDataURL() != null &&
- !pvp2OA.getMetaDataURL().equals(pvp2.getMetadataURL()))
- pvp2OA.setReLoad(true);
- pvp2.setMetadataURL(pvp2OA.getMetaDataURL());
-
- if (pvp2OA.isReLoad())
- pvp2.setUpdateRequiredItem(new Date());
-
- OASAML1 saml1 = authoa.getOASAML1();
- if (saml1 == null) {
- saml1 = new OASAML1();
- authoa.setOASAML1(saml1);
- saml1.setIsActive(false);
- }
-
- if (authUser.isAdmin()) {
- saml1.setIsActive(saml1OA.isActive());
- }
-
- if (saml1.isIsActive() != null && saml1.isIsActive()) {
- saml1.setProvideAUTHBlock(saml1OA.isProvideAuthBlock());
- saml1.setProvideCertificate(saml1OA.isProvideCertificate());
- saml1.setProvideFullMandatorData(saml1OA.isProvideFullMandateData());
- saml1.setProvideIdentityLink(saml1OA.isProvideIdentityLink());
- saml1.setProvideStammzahl(saml1OA.isProvideStammZahl());
- saml1.setUseCondition(saml1OA.isUseCondition());
- saml1.setConditionLength(BigInteger.valueOf(saml1OA.getConditionLength()));
- // TODO: set sourceID
- // saml1.setSourceID("");
- }
-
- OASSO sso = authoa.getOASSO();
- if (sso == null) {
- sso = new OASSO();
- authoa.setOASSO(sso);
- sso.setAuthDataFrame(true);
- }
- sso.setUseSSO(ssoOA.isUseSSO());
-
- if (authUser.isAdmin()) sso.setAuthDataFrame(ssoOA.isShowAuthDataFrame());
-
- sso.setSingleLogOutURL(ssoOA.getSingleLogOutURL());
-
- if (oauth20OA != null) {
- log.debug("Saving OAuth 2.0 configuration:");
- OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20();
- if (oaOAuth20 == null) {
- oaOAuth20 = new OAOAUTH20();
- authoa.setOAOAUTH20(oaOAuth20);
- }
-
- oaOAuth20.setOAuthClientId(generalOA.getIdentifier());
- // oaOAuth20.setOAuthClientSecret(oauth20OA.getClientSecret());
- oaOAuth20.setOAuthRedirectUri(oauth20OA.getRedirectUri());
- log.debug("client id: " + oauth20OA.getClientId());
- log.debug("client secret: " + oauth20OA.getClientSecret());
- log.debug("redirect uri:" + oauth20OA.getRedirectUri());
-
- oaOAuth20.setOAuthClientSecret((String) request.getSession().getAttribute(Constants.SESSION_OAUTH20SECRET));
- request.getSession().setAttribute(Constants.SESSION_OAUTH20SECRET, null);
-
- }
-
-
- // fetch stork configuration from database model
- OASTORK stork = authoa.getOASTORK();
- if (stork == null) {
- // if there is none, create a new one with default values.
- stork = new OASTORK();
- authoa.setOASTORK(stork);
- stork.setStorkLogonEnabled(false);
- }
- // transfer the incoming data to the database model
- stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled());
- stork.setQaa(storkOA.getQaa());
- stork.setOAAttributes(storkOA.getAttributes());
- stork.setVidpEnabled(storkOA.isVidpEnabled());
- stork.setRequireConsent(storkOA.isRequireConsent());
- stork.setAttributeProviders(storkOA.getAttributeProviderPlugins());
- stork.setCPEPS(storkOA.getEnabledCPEPS());
-
+ private String saveOAConfigToDatabase(OnlineApplication dboa) {
+
+ for (IOnlineApplicationData form : formList.values())
+ form.store(dboa, authUser, request);
+
try {
- if (newentry) {
+ if (dboa.isIsNew()) {
ConfigurationDBUtils.save(dboa);
if (!authUser.isAdmin()) {
@@ -1063,41 +681,6 @@ public class EditOAAction extends BasicAction {
return null;
}
- private String parseColor(String color) {
- String value = "";
-
- if (MiscUtil.isNotEmpty(color)) {
- if (!color.startsWith("#"))
- value = "#" + color;
- else
- value = color;
- }
- return value;
- }
-
- private void generateUserSpecificConfigurationOptions(UserDatabase userdb) {
-
- if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) {
- String bpk = userdb.getBpk();
- if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN) || bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_ZVR) || bpk.startsWith(Constants.IDENIFICATIONTYPE_STORK)) {
- onlyBusinessService = true;
- generalOA.setBusinessService(true);
- }
-
- deaktivededBusinessService = true;
-
- String[] split = bpk.split("\\+");
- generalOA.setIdentificationType(split[1].substring(1));
-
- if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN))
- generalOA.setIdentificationNumber(at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(split[2]));
- else
- generalOA.setIdentificationNumber(split[2]);
-
- }
-
- }
-
public String setGeneralOAConfig() {
return Constants.STRUTS_SUCCESS;
@@ -1123,44 +706,53 @@ public class EditOAAction extends BasicAction {
return Constants.STRUTS_SUCCESS;
}
+
+ public OAAuthenticationData getAuthOA() {
+ return (OAAuthenticationData) formList.get(new OAAuthenticationData().getName());
+ }
+
+ public void setAuthOA(OAAuthenticationData generalOA) {
+ formList.put(generalOA.getName(), generalOA);
+ }
+
public OAGeneralConfig getGeneralOA() {
- return generalOA;
+ return (OAGeneralConfig) formList.get(new OAGeneralConfig().getName());
}
public void setGeneralOA(OAGeneralConfig generalOA) {
- this.generalOA = generalOA;
+ formList.put(generalOA.getName(), generalOA);
}
public OAPVP2Config getPvp2OA() {
- return pvp2OA;
+ return (OAPVP2Config) formList.get(new OAPVP2Config().getName());
}
public void setPvp2OA(OAPVP2Config pvp2oa) {
- pvp2OA = pvp2oa;
+ formList.put(pvp2oa.getName(), pvp2oa);
}
public OASAML1Config getSaml1OA() {
- return saml1OA;
+ return (OASAML1Config) formList.get(new OASAML1Config().getName());
}
public void setSaml1OA(OASAML1Config saml1oa) {
- saml1OA = saml1oa;
+ formList.put(saml1oa.getName(), saml1oa);
}
public OASSOConfig getSsoOA() {
- return ssoOA;
+ return (OASSOConfig) formList.get(new OASSOConfig().getName());
}
public void setSsoOA(OASSOConfig ssoOA) {
- this.ssoOA = ssoOA;
+ formList.put(ssoOA.getName(), ssoOA);
}
public OASTORKConfig getStorkOA() {
- return storkOA;
+ return (OASTORKConfig) formList.get(new OASTORKConfig().getName());
}
public void setStorkOA(OASTORKConfig storkOA) {
- this.storkOA = storkOA;
+ formList.put(storkOA.getName(), storkOA);
}
/**
@@ -1206,61 +798,17 @@ public class EditOAAction extends BasicAction {
}
/**
- * @return the onlyBusinessService
- */
- public boolean isOnlyBusinessService() {
- return onlyBusinessService;
- }
-
- /**
- * @param onlyBusinessService the onlyBusinessService to set
- */
- public void setOnlyBusinessService(boolean onlyBusinessService) {
- this.onlyBusinessService = onlyBusinessService;
- }
-
-
- /**
- * @return the subTargetSet
- */
- public boolean isSubTargetSet() {
- return subTargetSet;
- }
-
- /**
- * @param subTargetSet the subTargetSet to set
- */
- public void setSubTargetSet(boolean subTargetSet) {
- this.subTargetSet = subTargetSet;
- }
-
- /**
- * @return the deaktivededBusinessService
- */
- public boolean isDeaktivededBusinessService() {
- return deaktivededBusinessService;
- }
-
-
- /**
- * @param deaktivededBusinessService the deaktivededBusinessService to set
- */
- public void setDeaktivededBusinessService(boolean deaktivededBusinessService) {
- this.deaktivededBusinessService = deaktivededBusinessService;
- }
-
- /**
* @return the formOA
*/
public FormularCustomization getFormOA() {
- return formOA;
+ return (FormularCustomization) formList.get(new FormularCustomization(null).getName());
}
/**
* @param formOA the formOA to set
*/
public void setFormOA(FormularCustomization formOA) {
- this.formOA = formOA;
+ formList.put(formOA.getName(), formOA);
}
/**
@@ -1271,11 +819,11 @@ public class EditOAAction extends BasicAction {
}
public OAOAuth20Config getOauth20OA() {
- return oauth20OA;
+ return (OAOAuth20Config) formList.get(new OAOAuth20Config().getName());
}
public void setOauth20OA(OAOAuth20Config oauth20OA) {
- this.oauth20OA = oauth20OA;
+ formList.put(oauth20OA.getName(), oauth20OA);
}
}