aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-05-06 12:32:05 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-05-06 12:32:05 +0200
commit66fdd9718584335322e3b1aea3e34c1dee330502 (patch)
tree6f7701ff770e85c8d2b81eab60fc1d66d8a335ff /id/ConfigWebTool/src/main/java/at/gv
parent761e3c17f3679ed4bbc3402c8552d7e2a1e77d1b (diff)
downloadmoa-id-spss-66fdd9718584335322e3b1aea3e34c1dee330502.tar.gz
moa-id-spss-66fdd9718584335322e3b1aea3e34c1dee330502.tar.bz2
moa-id-spss-66fdd9718584335322e3b1aea3e34c1dee330502.zip
split OA target configuration from general OA configuration
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java328
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java29
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java64
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OATargetConfigValidation.java (renamed from id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java)34
4 files changed, 87 insertions, 368 deletions
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 5c0a2b1a6..05e163c23 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
@@ -22,58 +22,33 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.configuration.data.oa;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
+import org.apache.log4j.Logger;
+
import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA;
-import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
-import at.gv.egovernment.moa.id.commons.validation.TargetValidator;
+import at.gv.egovernment.moa.id.commons.validation.ValidationHelper;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OAGeneralConfigValidation;
+import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.util.MiscUtil;
public class OAGeneralConfig implements IOnlineApplicationData{
-
+ private static final Logger log = Logger.getLogger(OAGeneralConfig.class);
+
private boolean isActive = false;
private String dbID = null;
private String identifier = null;
private String friendlyName = null;
+ private boolean businessService = false;
- private boolean businessService = false;
- private boolean deaktivededBusinessService = false;
-
- private boolean subTargetSet = false;
-
- private String target = null;
- private String target_subsector = null;
- private String target_admin = null;
- private static List<String> targetList = null;
- private String targetFriendlyName = null;
- private boolean isAdminTarget = false;
-
- private String identificationNumber = null;
- private String identificationType = null;
- private static List<String> identificationTypeList = null;
-
- public OAGeneralConfig() {
-
-
- targetList = TargetValidator.getListOfTargets();
- target = "";
-
- identificationTypeList = Arrays.asList(
- Constants.IDENIFICATIONTYPE_FN,
- Constants.IDENIFICATIONTYPE_ZVR,
- Constants.IDENIFICATIONTYPE_ERSB,
- Constants.IDENIFICATIONTYPE_STORK);
- }
/* (non-Javadoc)
* @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
@@ -93,69 +68,10 @@ public class OAGeneralConfig implements IOnlineApplicationData{
friendlyName = dbOAConfig.getFriendlyName();
identifier = dbOAConfig.getPublicURLPrefix();
- subTargetSet = MiscUtil.isNotEmpty(getTarget_subsector());
-
- String target_full = dbOAConfig.getTarget();
- if (MiscUtil.isNotEmpty(target_full)) {
- if (TargetValidator.isValidTarget(target_full)) {
- target = target_full;
-
- } else {
- String[] target_split = target_full.split("-");
-
- if (TargetValidator.isValidTarget(target_split[0])) {
- target = target_split[0];
- if (target_split.length > 1)
- target_subsector = target_split[1];
-
- } else {
- target = "";
- target_subsector = null;
- target_admin = target_full;
- isAdminTarget = true;
- }
- }
- targetFriendlyName = dbOAConfig.getTargetFriendlyName();
- }
-
if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE))
businessService = true;
else
businessService = false;
-
-
- AuthComponentOA oaauth = dbOAConfig.getAuthComponentOA();
- if (oaauth != null) {
-
- IdentificationNumber idnumber = oaauth.getIdentificationNumber();
- if (idnumber != null) {
- String number = idnumber.getValue();
- if (MiscUtil.isNotEmpty(number)) {
- String[] split = number.split("\\+");
-
- if (Constants.PREFIX_WPBK.startsWith(split[0]) && split.length >= 2) {
- identificationType = split[1];
- identificationNumber = split[2];
- } else if (Constants.PREFIX_STORK.startsWith(split[0]) && split.length >= 2) {
- //identificationType = split[1]; // setting at as iden category ?
- identificationType = Constants.IDENIFICATIONTYPE_STORK;
- identificationNumber = split[2]; // setting sp country as ident type -> sp ident
- }
- }
-
- if (authUser.isOnlyBusinessService()) {
- deaktivededBusinessService = authUser.isOnlyBusinessService();
- setBusinessService(authUser.isOnlyBusinessService());
-
- identificationType = authUser.getBusinessServiceType();
- identificationNumber = authUser.getBusinessServiceNumber();
-
- }
-
- }
- }
-
-
return null;
}
@@ -177,88 +93,14 @@ public class OAGeneralConfig implements IOnlineApplicationData{
dbOA.setPublicURLPrefix(getIdentifier());
dbOA.setFriendlyName(getFriendlyName());
-
- if (isBusinessService() || authUser.isOnlyBusinessService()) {
+ if (isBusinessService() || authUser.isOnlyBusinessService()) {
dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
-
- String num = null;
- if (authUser.isOnlyBusinessService()) {
- deaktivededBusinessService = authUser.isOnlyBusinessService();
- setBusinessService(authUser.isOnlyBusinessService());
- num = authUser.getBusinessServiceType() + authUser.getBusinessServiceNumber();
-
- } else {
-
- num = 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 (getIdentificationType().equals(Constants.IDENIFICATIONTYPE_STORK)) {
- idnumber.setValue(Constants.PREFIX_STORK + "AT" + "+" + num);
- idnumber.setType(Constants.BUSINESSSERVICENAMES.get(getIdentificationType()));
- } else {
- idnumber.setValue(Constants.PREFIX_WPBK + getIdentificationType() + "+" + num);
- idnumber.setType(Constants.BUSINESSSERVICENAMES.get(getIdentificationType()));
- }
- authoa.setIdentificationNumber(idnumber);
-
} else {
- dbOA.setType(null);
-
- if (authUser.isAdmin()) {
- if (MiscUtil.isNotEmpty(getTarget_admin()) && isAdminTarget()) {
- dbOA.setTarget(getTarget_admin());
- dbOA.setTargetFriendlyName(getTargetFriendlyName());
-
- } else {
-
- String target = getTarget();
-
- if (MiscUtil.isNotEmpty(getTarget_subsector()) && subTargetSet)
- dbOA.setTarget(target + "-" + getTarget_subsector());
- else
- dbOA.setTarget(target);
-
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dbOA.setTargetFriendlyName(targetname);
-
- }
-
- } else {
-
- if (MiscUtil.isNotEmpty(getTarget())) {
-
- String target = getTarget();
-
- if (MiscUtil.isNotEmpty(getTarget_subsector()) && subTargetSet)
- dbOA.setTarget(target + "-" + getTarget_subsector());
-
- else
- dbOA.setTarget(target);
-
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dbOA.setTargetFriendlyName(targetname);
-
- }
- }
+ dbOA.setType(null);
}
-
+
return null;
}
@@ -270,9 +112,35 @@ public class OAGeneralConfig implements IOnlineApplicationData{
@Override
public List<String> validate(OAGeneralConfig general,
AuthenticatedUser authUser, HttpServletRequest request) {
- return new OAGeneralConfigValidation().validate(this, authUser.isAdmin(), request);
+
+ List<String> errors = new ArrayList<String>();
+ String check;
+
+ //check OA FriendlyName
+ check = getFriendlyName();
+ if (MiscUtil.isNotEmpty(check)) {
+ if (ValidationHelper.containsPotentialCSSCharacter(check, false)) {
+ log.warn("OAFriendlyName contains potentail XSS characters: " + check);
+ errors.add(LanguageHelper.getErrorString("validation.general.oafriendlyname.valid",
+ new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request ));
+ }
+ } else {
+ log.info("OA friendlyName is empty");
+ errors.add(LanguageHelper.getErrorString("validation.general.oafriendlyname.empty", request));
+ }
+
+ return errors;
+
+ }
+
+ public boolean isBusinessService() {
+ return businessService;
}
+ public void setBusinessService(boolean businessService) {
+ this.businessService = businessService;
+ }
+
public String getIdentifier() {
return identifier;
}
@@ -289,38 +157,6 @@ public class OAGeneralConfig implements IOnlineApplicationData{
this.friendlyName = friendlyName;
}
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String getTargetFriendlyName() {
- return targetFriendlyName;
- }
-
- public void setTargetFriendlyName(String targetFriendlyName) {
- this.targetFriendlyName = targetFriendlyName;
- }
-
- public String getIdentificationNumber() {
- return identificationNumber;
- }
-
- public void setIdentificationNumber(String identificationNumber) {
- this.identificationNumber = identificationNumber;
- }
-
- public String getIdentificationType() {
- return identificationType;
- }
-
- public void setIdentificationType(String identificationType) {
- this.identificationType = identificationType;
- }
-
public boolean isActive() {
return isActive;
}
@@ -329,14 +165,6 @@ public class OAGeneralConfig implements IOnlineApplicationData{
this.isActive = isActive;
}
- public boolean isBusinessService() {
- return businessService;
- }
-
- public void setBusinessService(boolean businessService) {
- this.businessService = businessService;
- }
-
/**
* @return the dbID
*/
@@ -358,84 +186,4 @@ public class OAGeneralConfig implements IOnlineApplicationData{
public void setDbID(String dbID) {
this.dbID = dbID;
}
-
-
- /**
- * @return the target_subsector
- */
- public String getTarget_subsector() {
- return target_subsector;
- }
-
-
- /**
- * @param target_subsector the target_subsector to set
- */
- public void setTarget_subsector(String target_subsector) {
- this.target_subsector = target_subsector;
- }
-
-
- /**
- * @return the target_admin
- */
- public String getTarget_admin() {
- return target_admin;
- }
-
-
- /**
- * @param target_admin the target_admin to set
- */
- public void setTarget_admin(String target_admin) {
- this.target_admin = target_admin;
- }
-
-
- /**
- * @return the targetList
- */
- public List<String> getTargetList() {
- return targetList;
- }
-
-
- /**
- * @return the identificationTypeList
- */
- public List<String> getIdentificationTypeList() {
- return identificationTypeList;
- }
-
-
- /**
- * @return the isAdminTarget
- */
- public boolean isAdminTarget() {
- return isAdminTarget;
- }
-
-
- /**
- * @param isAdminTarget the isAdminTarget to set
- */
- public void setAdminTarget(boolean isAdminTarget) {
- this.isAdminTarget = isAdminTarget;
- }
-
- /**
- * @return the deaktivededBusinessService
- */
- public boolean isDeaktivededBusinessService() {
- return deaktivededBusinessService;
- }
-
-
- /**
- * @param deaktivededBusinessService the deaktivededBusinessService to set
- */
- public void setDeaktivededBusinessService(boolean deaktivededBusinessService) {
- this.deaktivededBusinessService = deaktivededBusinessService;
- }
-
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java
index 5db77a515..5fe9625ba 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java
@@ -22,14 +22,12 @@
*/
package at.gv.egovernment.moa.id.configuration.struts.action;
-import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.log4j.Logger;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
-import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
import at.gv.egovernment.moa.id.commons.validation.ValidationHelper;
@@ -67,7 +65,7 @@ public class BasicOAAction extends BasicAction {
}
- protected OnlineApplication populateOnlineApplicationFromRequest(LinkedHashMap<String, IOnlineApplicationData> requestedFormList) throws BasicOAActionException{
+ protected OnlineApplication populateOnlineApplicationFromRequest() throws BasicOAActionException{
if (!ValidationHelper.validateOAID(oaidobj)) {
throw new BasicOAActionException(
LanguageHelper.getErrorString("errors.edit.oa.oaid", request),
@@ -107,34 +105,11 @@ public class BasicOAAction extends BasicAction {
Constants.STRUTS_ERROR);
}
}
-
- List<String> errors = new ArrayList<String>();
- for (IOnlineApplicationData form : requestedFormList.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);
- }
-
- ConfigurationDBUtils.closeSession();
- session.setAttribute(Constants.SESSION_OAID, oaid);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
-
- newOA = false;
-
+
return onlineapplication;
}
- protected OnlineApplication populateOnlineApplicationFromRequest() throws BasicOAActionException{
- return populateOnlineApplicationFromRequest(formList);
- }
-
protected void populateBasicNewOnlineApplicationInformation() {
session.setAttribute(Constants.SESSION_OAID, null);
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 ae1104905..e9850200a 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
@@ -57,6 +57,9 @@ public class EditOAAction extends BasicOAAction {
public EditOAAction() {
super();
+ OATargetConfiguration oaTarget = new OATargetConfiguration();
+ formList.put(oaTarget.getName(), oaTarget);
+
OAAuthenticationData authOA = new OAAuthenticationData();
formList.put(authOA.getName(), authOA);
@@ -88,7 +91,26 @@ public class EditOAAction extends BasicOAAction {
try {
populateBasicInformations();
- populateOnlineApplicationFromRequest();
+ OnlineApplication onlineapplication = populateOnlineApplicationFromRequest();
+
+ 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);
+ }
+
+ setNewOA(false);
+
+ ConfigurationDBUtils.closeSession();
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ session.setAttribute(Constants.SESSION_OAID, oaid);
return Constants.STRUTS_OA_EDIT;
@@ -496,32 +518,6 @@ public class EditOAAction extends BasicOAAction {
return null;
}
-
- public String setGeneralOAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setSAML1OAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setPVP2OAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setSSOOAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setSTORKOAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
public OAAuthenticationData getAuthOA() {
return (OAAuthenticationData) formList.get(new OAAuthenticationData().getName());
@@ -598,5 +594,19 @@ public class EditOAAction extends BasicOAAction {
public void setOauth20OA(OAOAuth20Config oauth20OA) {
formList.put(oauth20OA.getName(), oauth20OA);
}
+
+ /**
+ * @return the formOA
+ */
+ public OATargetConfiguration getTargetConfig() {
+ return (OATargetConfiguration) formList.get(new OATargetConfiguration().getName());
+ }
+
+ /**
+ * @param formOA the formOA to set
+ */
+ public void setTargetConfig(OATargetConfiguration formOA) {
+ formList.put(formOA.getName(), formOA);
+ }
}
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/OATargetConfigValidation.java
index 82037e39d..650553ab3 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/OATargetConfigValidation.java
@@ -32,35 +32,21 @@ import org.apache.log4j.Logger;
import at.gv.egovernment.moa.id.commons.validation.ValidationHelper;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig;
+import at.gv.egovernment.moa.id.configuration.data.oa.OATargetConfiguration;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.validation.CompanyNumberValidator;
import at.gv.egovernment.moa.util.MiscUtil;
-public class OAGeneralConfigValidation {
+public class OATargetConfigValidation {
- private static final Logger log = Logger.getLogger(OASSOConfigValidation.class);
+ private static final Logger log = Logger.getLogger(OATargetConfigValidation.class);
- public List<String> validate(OAGeneralConfig form, boolean isAdmin, HttpServletRequest request) {
+ public List<String> validate(OATargetConfiguration form, boolean isAdmin, OAGeneralConfig general, HttpServletRequest request) {
List<String> errors = new ArrayList<String>();
String check;
-
- //check OA FriendlyName
- check = form.getFriendlyName();
- if (MiscUtil.isNotEmpty(check)) {
- if (ValidationHelper.containsPotentialCSSCharacter(check, false)) {
- log.warn("OAFriendlyName contains potentail XSS characters: " + check);
- errors.add(LanguageHelper.getErrorString("validation.general.oafriendlyname.valid",
- new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request ));
- }
- } else {
- log.info("OA friendlyName is empty");
- errors.add(LanguageHelper.getErrorString("validation.general.oafriendlyname.empty", request));
- }
-
- boolean businessservice = form.isBusinessService();
-
- if (businessservice) {
+
+ if (general.isBusinessService()) {
//check identification type
check = form.getIdentificationType();
@@ -104,11 +90,11 @@ public class OAGeneralConfigValidation {
if (!isAdmin) {
//check PublicURL Prefix allows PublicService
- if (!ValidationHelper.isPublicServiceAllowed(form.getIdentifier())) {
- log.warn("PublicURLPrefix does not allow PublicService: " + form.getIdentifier());
+ if (!ValidationHelper.isPublicServiceAllowed(general.getIdentifier())) {
+ log.warn("PublicURLPrefix does not allow PublicService: " + general.getIdentifier());
errors.add(LanguageHelper.getErrorString("validation.general.target.publicserviceurl",
- new Object[] {form.getIdentifier()}, request ));
- form.setBusinessService(true);
+ new Object[] {general.getIdentifier()}, request ));
+ general.setBusinessService(true);
return errors;
}