aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa
diff options
context:
space:
mode:
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java92
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java55
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java1572
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java633
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java275
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java362
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java267
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java439
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java237
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java383
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java184
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java623
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java851
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java202
14 files changed, 3205 insertions, 2970 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java
index 63c82037f..c2344e059 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java
@@ -4,61 +4,61 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAStorkAttribut
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.StorkAttribute;
public class AttributeHelper {
- private boolean isUsed = false;
- private String name;
- private boolean mandatory;
- private boolean readonly;
+ private boolean isUsed = false;
+ private String name;
+ private boolean mandatory;
+ private boolean readonly;
- public AttributeHelper() {
- // TODO Auto-generated constructor stub
- }
+ public AttributeHelper() {
+ // TODO Auto-generated constructor stub
+ }
- public AttributeHelper(OAStorkAttribute attribute) {
- isUsed = true;
- name = attribute.getName();
- mandatory = attribute.isMandatory();
- }
+ public AttributeHelper(OAStorkAttribute attribute) {
+ isUsed = true;
+ name = attribute.getName();
+ mandatory = attribute.isMandatory();
+ }
- public AttributeHelper(StorkAttribute attribute) {
- name = attribute.getName();
- mandatory = false;
- if (attribute.isMandatory()==null) { // TODO check details
- attribute.setMandatory(false);
- } else {
- readonly = attribute.isMandatory();
- }
- isUsed = readonly;
- }
+ public AttributeHelper(StorkAttribute attribute) {
+ name = attribute.getName();
+ mandatory = false;
+ if (attribute.isMandatory() == null) { // TODO check details
+ attribute.setMandatory(false);
+ } else {
+ readonly = attribute.isMandatory();
+ }
+ isUsed = readonly;
+ }
- public boolean isUsed() {
- return isUsed;
- }
+ public boolean isUsed() {
+ return isUsed;
+ }
- public void setUsed(boolean used) {
- isUsed = used;
- }
+ public void setUsed(boolean used) {
+ isUsed = used;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String newname) {
- name = newname;
- }
+ public void setName(String newname) {
+ name = newname;
+ }
- public boolean isMandatory() {
- return mandatory;
- }
+ public boolean isMandatory() {
+ return mandatory;
+ }
- public void setMandatory(boolean value) {
- mandatory = value;
- }
+ public void setMandatory(boolean value) {
+ mandatory = value;
+ }
- public boolean isReadOnly() {
- return readonly;
- }
+ public boolean isReadOnly() {
+ return readonly;
+ }
- public void setReadOnly(boolean value) {
- // we do not allow setting the readonly field
- }
+ public void setReadOnly(boolean value) {
+ // we do not allow setting the readonly field
+ }
} \ No newline at end of file
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java
index 8195c993d..0ba3ed36c 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/IOnlineApplicationData.java
@@ -34,31 +34,34 @@ import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
*
*/
public interface IOnlineApplicationData {
-
- public String getName();
-
- /**
- * Parse OnlineApplication database object to formData
- * @param dbOAConfig
- * @return List of Errors
- */
- public List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request);
-
- /**
- * Store formData to OnlineApplication database object
- * @param dboa: Database data object
- * @param authUser
- * @param request:
- * @return Error description
- */
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request);
-
- /**
- * Validate formData
- * @param general
- * @param request
- * @return
- */
- public List<String> validate(OAGeneralConfig general, AuthenticatedUser authUser, HttpServletRequest request);
+
+ String getName();
+
+ /**
+ * Parse OnlineApplication database object to formData
+ *
+ * @param dbOAConfig
+ * @return List of Errors
+ */
+ List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request);
+
+ /**
+ * Store formData to OnlineApplication database object
+ *
+ * @param dboa: Database data object
+ * @param authUser
+ * @param request:
+ * @return Error description
+ */
+ String store(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request);
+
+ /**
+ * Validate formData
+ *
+ * @param general
+ * @param request
+ * @return
+ */
+ List<String> validate(OAGeneralConfig general, AuthenticatedUser authUser, HttpServletRequest request);
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java
index b3db074a2..b3f0620f0 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java
@@ -29,8 +29,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.BKUURLS;
@@ -47,105 +45,105 @@ import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.validation.oa.OAAuthenticationDataValidation;
import at.gv.egovernment.moa.util.MiscUtil;
+import lombok.extern.slf4j.Slf4j;
/**
* @author tlenz
*
*/
+@Slf4j
public class OAAuthenticationData implements IOnlineApplicationData {
- private static final Logger log = Logger.getLogger(OAAuthenticationData.class);
-
- private String bkuOnlineURL = null;
- private String bkuHandyURL = null;
- private String bkuLocalURL = null;
-
- private String mandateProfiles = null;
- private boolean useMandates = false;
-
- private List<String> misServicesList = new ArrayList<String>();
- private List<String> elgaServicesList = new ArrayList<String>();
- private List<String> szrgwServicesList = new ArrayList<String>();
- private List<String> eidServicesList = new ArrayList<String>();
- private String misServiceSelected = null;
- private String elgaServiceSelected = null;
- private String szrgwServiceSelected = null;
- private String eidServiceSelected = null;
-
- private boolean calculateHPI = false;
-
- private String keyBoxIdentifier = null;
- private static Map<String, String> keyBoxIdentifierList;
-
- private boolean legacy = false;
- List<String> SLTemplates = null;
-
- private Map<String, byte[]> transformations;
-
- private boolean enableTestCredentials = false;
- private List<String> testCredentialOIDs = null;
- private boolean useTestIDLValidationTrustStore = false;
- private boolean useTestAuthblockValidationTrustStore = false;
-
-
- //SL2.0
- private boolean sl20Active = false;
- private String sl20EndPoints = null;
-
- private boolean isMoaidMode = false;
-
- /**
- * @param isMoaidMode
- *
- */
- public OAAuthenticationData() {
- try {
- this.isMoaidMode = ConfigurationProvider.getInstance().isMOAIDMode();
- } catch (ConfigurationException e) {
- e.printStackTrace();
-
- }
-
- keyBoxIdentifierList = new HashMap<String, String>();
- MOAKeyBoxSelector[] values = MOAKeyBoxSelector.values();
- for (int i=0; i<values.length; i++) {
- keyBoxIdentifierList.put(values[i].value(), values[i].value());
- }
-
- keyBoxIdentifier = MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR.value();
-
-
- try {
- MOAIDConfiguration dbconfig = ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration();
-
- if (this.isMoaidMode) {
- try {
- elgaServicesList = KeyValueUtils.getListOfCSVValues(dbconfig.getElgaMandateServiceURLs());
- misServicesList = KeyValueUtils.getListOfCSVValues(
- dbconfig.getAuthComponentGeneral().getOnlineMandates().getConnectionParameter().getURL());
- } catch (NullPointerException e) {}
-
- try {
- szrgwServicesList = KeyValueUtils.getListOfCSVValues(
- dbconfig.getAuthComponentGeneral().getForeignIdentities().getConnectionParameter().getURL());
- } catch (NullPointerException e) {}
-
- }
-
-
- try {
- eidServicesList = KeyValueUtils.getListOfCSVValues(dbconfig.getEidSystemServiceURLs());
- } catch (NullPointerException e) {}
-
-
- } catch (ConfigurationException e) {
- log.error("MOA-ID-Configuration initialization FAILED.", e);
-
- }
-
+ private String bkuOnlineURL = null;
+ private String bkuHandyURL = null;
+ private String bkuLocalURL = null;
+
+ private String mandateProfiles = null;
+ private boolean useMandates = false;
+
+ private List<String> misServicesList = new ArrayList<>();
+ private List<String> elgaServicesList = new ArrayList<>();
+ private List<String> szrgwServicesList = new ArrayList<>();
+ private List<String> eidServicesList = new ArrayList<>();
+ private String misServiceSelected = null;
+ private String elgaServiceSelected = null;
+ private String szrgwServiceSelected = null;
+ private String eidServiceSelected = null;
+
+ private boolean calculateHPI = false;
+
+ private String keyBoxIdentifier = null;
+ private static Map<String, String> keyBoxIdentifierList;
+
+ private boolean legacy = false;
+ List<String> SLTemplates = null;
+
+ private Map<String, byte[]> transformations;
+
+ private boolean enableTestCredentials = false;
+ private List<String> testCredentialOIDs = null;
+ private boolean useTestIDLValidationTrustStore = false;
+ private boolean useTestAuthblockValidationTrustStore = false;
+
+ // SL2.0
+ private boolean sl20Active = false;
+ private String sl20EndPoints = null;
+
+ private boolean isMoaidMode = false;
+
+ /**
+ * @param isMoaidMode
+ *
+ */
+ public OAAuthenticationData() {
+ try {
+ this.isMoaidMode = ConfigurationProvider.getInstance().isMOAIDMode();
+ } catch (final ConfigurationException e) {
+ e.printStackTrace();
+
+ }
+
+ keyBoxIdentifierList = new HashMap<>();
+ final MOAKeyBoxSelector[] values = MOAKeyBoxSelector.values();
+ for (final MOAKeyBoxSelector value : values) {
+ keyBoxIdentifierList.put(value.value(), value.value());
+ }
+
+ keyBoxIdentifier = MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR.value();
+
+ try {
+ final MOAIDConfiguration dbconfig = ConfigurationProvider.getInstance().getDbRead()
+ .getMOAIDConfiguration();
+
+ if (this.isMoaidMode) {
+ try {
+ elgaServicesList = KeyValueUtils.getListOfCSVValues(dbconfig.getElgaMandateServiceURLs());
+ misServicesList = KeyValueUtils.getListOfCSVValues(
+ dbconfig.getAuthComponentGeneral().getOnlineMandates().getConnectionParameter().getURL());
+ } catch (final NullPointerException e) {
+ }
+
+ try {
+ szrgwServicesList = KeyValueUtils.getListOfCSVValues(
+ dbconfig.getAuthComponentGeneral().getForeignIdentities().getConnectionParameter().getURL());
+ } catch (final NullPointerException e) {
+ }
+
+ }
+
+ try {
+ eidServicesList = KeyValueUtils.getListOfCSVValues(dbconfig.getEidSystemServiceURLs());
+ } catch (final NullPointerException e) {
+ }
+
+ } catch (final ConfigurationException e) {
+ log.error("MOA-ID-Configuration initialization FAILED.", e);
+
+ }
+
// bkuLocalURL = Constants.DEFAULT_LOCALBKU_URL;
// bkuHandyURL = Constants.DEFAULT_HANDYBKU_URL;
-//
+//
// MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
// if (moaidconfig != null) {
// DefaultBKUs defaultbkus = moaidconfig.getDefaultBKUs();
@@ -155,34 +153,43 @@ public class OAAuthenticationData implements IOnlineApplicationData {
// setBkuOnlineURL(defaultbkus.getOnlineBKU());
// }
// }
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OAAuthenticationData";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) {
- keyBoxIdentifier = dbOA.getKeyBoxIdentifier().value();
-
- szrgwServiceSelected = dbOA.getSelectedSZRGWServiceURL();
- eidServiceSelected = dbOA.getSelectedEIDServiceURL();
-
- AuthComponentOA oaauth = dbOA.getAuthComponentOA();
- if (oaauth != null) {
- BKUURLS bkuurls = oaauth.getBKUURLS();
-
- String defaulthandy = "";
- String defaultlocal = "";
- String defaultonline = "";
-
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OAAuthenticationData";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) {
+ keyBoxIdentifier = dbOA.getKeyBoxIdentifier().value();
+
+ szrgwServiceSelected = dbOA.getSelectedSZRGWServiceURL();
+ eidServiceSelected = dbOA.getSelectedEIDServiceURL();
+
+ final AuthComponentOA oaauth = dbOA.getAuthComponentOA();
+ if (oaauth != null) {
+ final BKUURLS bkuurls = oaauth.getBKUURLS();
+
+ final String defaulthandy = "";
+ final String defaultlocal = "";
+ final String defaultonline = "";
+
// MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration();
// if (dbconfig != null) {
// DefaultBKUs defaultbkus = dbconfig.getDefaultBKUs();
@@ -192,674 +199,685 @@ public class OAAuthenticationData implements IOnlineApplicationData {
// defaultonline = defaultbkus.getOnlineBKU();
// }
// }
-
- if (bkuurls != null) {
-
- if (MiscUtil.isEmpty(bkuurls.getHandyBKU()))
- bkuHandyURL = defaulthandy;
- else
- bkuHandyURL = bkuurls.getHandyBKU();
-
- if (MiscUtil.isEmpty(bkuurls.getLocalBKU()))
- bkuLocalURL = defaultlocal;
- else
- bkuLocalURL = bkuurls.getLocalBKU();
-
- if (MiscUtil.isEmpty(bkuurls.getOnlineBKU()))
- bkuOnlineURL = defaultonline;
- else
- bkuOnlineURL = bkuurls.getOnlineBKU();
- }
-
- Mandates mandates = oaauth.getMandates();
- if (mandates != null) {
-
- mandateProfiles = null;
-
- List<String> profileList = mandates.getProfileName();
- for (String el : profileList) {
- if (mandateProfiles == null)
- mandateProfiles = el;
-
- else
- mandateProfiles += "," + el;
- }
-
- //TODO: only for RC1
- if (MiscUtil.isNotEmpty(mandates.getProfiles())) {
- if (mandateProfiles == null)
- mandateProfiles = mandates.getProfiles();
-
- else
- mandateProfiles += "," + mandates.getProfiles();
-
- }
-
- if (mandateProfiles != null)
- useMandates = true;
-
- else
- useMandates = false;
-
- misServiceSelected = mandates.getSelectedMISServiceURL();
- elgaServiceSelected = mandates.getSelecteELGAServiceURL();
-
- }
-
- TemplatesType templates = oaauth.getTemplates();
- if (templates != null) {
- List<TemplateType> templatetype = templates.getTemplate();
-
- if (templatetype != null) {
- 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[]>();
- for (TransformsInfoType el : transforminfos) {
- transformations.put(el.getFilename(), el.getTransformation());
- }
- }
-
- if (oaauth.getTestCredentials() != null) {
- enableTestCredentials = oaauth.getTestCredentials().isEnableTestCredentials();
- testCredentialOIDs = new ArrayList<String>();
- testCredentialOIDs.addAll(oaauth.getTestCredentials().getCredentialOID());
-
- useTestAuthblockValidationTrustStore = oaauth.getTestCredentials().isUseTestAuthBlockTrustStore();
- useTestIDLValidationTrustStore = oaauth.getTestCredentials().isUseTestIDLTrustStore();
- }
-
- //parse SL2.0 information
- if (oaauth.isSl20Active()) {
- //parse SL2.0 endpoint information
- if (oaauth.getSl20EndPoints() != null) {
- if (KeyValueUtils.isCSVValueString(oaauth.getSl20EndPoints()))
- sl20EndPoints = KeyValueUtils.normalizeCSVValueString(oaauth.getSl20EndPoints());
-
- else {
- if (oaauth.getSl20EndPoints().contains(KeyValueUtils.CSV_DELIMITER)) {
- //remove trailing comma if exist
- sl20EndPoints = oaauth.getSl20EndPoints().substring(0,
- oaauth.getSl20EndPoints().indexOf(KeyValueUtils.CSV_DELIMITER));
-
- } else
- sl20EndPoints = oaauth.getSl20EndPoints();
-
- }
- }
- sl20Active = oaauth.isSl20Active();
-
- }
-
-
- return null;
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
- AuthComponentOA authoa = dbOA.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dbOA.setAuthComponentOA(authoa);
+
+ if (bkuurls != null) {
+
+ if (MiscUtil.isEmpty(bkuurls.getHandyBKU())) {
+ bkuHandyURL = defaulthandy;
+ } else {
+ bkuHandyURL = bkuurls.getHandyBKU();
+ }
+
+ if (MiscUtil.isEmpty(bkuurls.getLocalBKU())) {
+ bkuLocalURL = defaultlocal;
+ } else {
+ bkuLocalURL = bkuurls.getLocalBKU();
+ }
+
+ if (MiscUtil.isEmpty(bkuurls.getOnlineBKU())) {
+ bkuOnlineURL = defaultonline;
+ } else {
+ bkuOnlineURL = bkuurls.getOnlineBKU();
+ }
+ }
+
+ final Mandates mandates = oaauth.getMandates();
+ if (mandates != null) {
+
+ mandateProfiles = null;
+
+ final List<String> profileList = mandates.getProfileName();
+ for (final String el : profileList) {
+ if (mandateProfiles == null) {
+ mandateProfiles = el;
+ } else {
+ mandateProfiles += "," + el;
+ }
+ }
+
+ // TODO: only for RC1
+ if (MiscUtil.isNotEmpty(mandates.getProfiles())) {
+ if (mandateProfiles == null) {
+ mandateProfiles = mandates.getProfiles();
+ } else {
+ mandateProfiles += "," + mandates.getProfiles();
+ }
+
+ }
+
+ if (mandateProfiles != null) {
+ useMandates = true;
+ } else {
+ useMandates = false;
+ }
+
+ misServiceSelected = mandates.getSelectedMISServiceURL();
+ elgaServiceSelected = mandates.getSelecteELGAServiceURL();
+
+ }
+
+ final TemplatesType templates = oaauth.getTemplates();
+ if (templates != null) {
+ final List<TemplateType> templatetype = templates.getTemplate();
+
+ if (templatetype != null) {
+ if (SLTemplates == null) {
+ SLTemplates = new ArrayList<>();
+ }
+
+ for (final TemplateType el : templatetype) {
+ SLTemplates.add(el.getURL());
+ }
}
-
- dbOA.setCalculateHPI(isCalculateHPI());
-
- if (MiscUtil.isNotEmpty(getSzrgwServiceSelected()))
- dbOA.setSelectedSZRGWServiceURL(getSzrgwServiceSelected());
-
-
- if (MiscUtil.isNotEmpty(getEidServiceSelected()))
- dbOA.setSelectedEIDServiceURL(getEidServiceSelected());
-
- if (authUser.isAdmin()) {
-
- //store BKU-URLs
- BKUURLS bkuruls = new BKUURLS();
- authoa.setBKUURLS(bkuruls);
- bkuruls.setHandyBKU(getBkuHandyURL());
- bkuruls.setLocalBKU(getBkuLocalURL());
- bkuruls.setOnlineBKU(getBkuOnlineURL());
-
- //store SecurtiyLayerTemplates
- TemplatesType templates = authoa.getTemplates();
- if (templates == null) {
- templates = new TemplatesType();
- authoa.setTemplates(templates);
- }
- List<TemplateType> template = templates.getTemplate();
- if (isLegacy()) {
-
- if (template == null)
- template = new ArrayList<TemplateType>();
- else
- template.clear();
-
- if (MiscUtil.isNotEmpty(getSLTemplateURL1())) {
- TemplateType el = new TemplateType();
- el.setURL(getSLTemplateURL1());
- template.add(el);
- } else
- template.add(new TemplateType());
- if (MiscUtil.isNotEmpty(getSLTemplateURL2())) {
- TemplateType el = new TemplateType();
- el.setURL(getSLTemplateURL2());
- template.add(el);
- } else
- template.add(new TemplateType());
- if (MiscUtil.isNotEmpty(getSLTemplateURL3())) {
- TemplateType el = new TemplateType();
- el.setURL(getSLTemplateURL3());
- template.add(el);
- } else
- template.add(new TemplateType());
-
- } else {
- if (template != null && template.size() > 0) template.clear();
- }
-
-
- //store keyBox Identifier
- dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(getKeyBoxIdentifier()));
+ }
+
+ if (SLTemplates != null && SLTemplates.size() > 0) {
+ legacy = true;
+ }
+
+ final List<TransformsInfoType> transforminfos = oaauth.getTransformsInfo();
+ transformations = new HashMap<>();
+ for (final TransformsInfoType el : transforminfos) {
+ transformations.put(el.getFilename(), el.getTransformation());
+ }
+ }
+
+ if (oaauth.getTestCredentials() != null) {
+ enableTestCredentials = oaauth.getTestCredentials().isEnableTestCredentials();
+ testCredentialOIDs = new ArrayList<>();
+ testCredentialOIDs.addAll(oaauth.getTestCredentials().getCredentialOID());
+
+ useTestAuthblockValidationTrustStore = oaauth.getTestCredentials().isUseTestAuthBlockTrustStore();
+ useTestIDLValidationTrustStore = oaauth.getTestCredentials().isUseTestIDLTrustStore();
+ }
+
+ // parse SL2.0 information
+ if (oaauth.isSl20Active()) {
+ // parse SL2.0 endpoint information
+ if (oaauth.getSl20EndPoints() != null) {
+ if (KeyValueUtils.isCSVValueString(oaauth.getSl20EndPoints())) {
+ sl20EndPoints = KeyValueUtils.normalizeCSVValueString(oaauth.getSl20EndPoints());
} else {
- if (dbOA.isIsNew()) dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR);
+ if (oaauth.getSl20EndPoints().contains(KeyValueUtils.CSV_DELIMITER)) {
+ // remove trailing comma if exist
+ sl20EndPoints = oaauth.getSl20EndPoints().substring(0,
+ oaauth.getSl20EndPoints().indexOf(KeyValueUtils.CSV_DELIMITER));
+
+ } else {
+ sl20EndPoints = oaauth.getSl20EndPoints();
+ }
+
}
-
- Mandates mandates = new Mandates();
- if (isUseMandates()) {
-
- String[] profileList = getMandateProfiles().split(",");
-
- List<String> dbProfiles = mandates.getProfileName();
- if (dbProfiles == null) {
- dbProfiles = new ArrayList<String>();
- mandates.setProfileName(dbProfiles);
-
- }
-
- for (String el: profileList)
- dbProfiles.add(el.trim());
-
- mandates.setProfiles(null);
-
- if (MiscUtil.isNotEmpty(getMisServiceSelected()))
- mandates.setSelectedMISServiceURL(getMisServiceSelected());
-
- if (MiscUtil.isNotEmpty(getElgaServiceSelected()))
- mandates.setSelecteELGAServiceURL(getElgaServiceSelected());
-
+ }
+ sl20Active = oaauth.isSl20Active();
+
+ }
+
+ return null;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
+
+ dbOA.setCalculateHPI(isCalculateHPI());
+
+ if (MiscUtil.isNotEmpty(getSzrgwServiceSelected())) {
+ dbOA.setSelectedSZRGWServiceURL(getSzrgwServiceSelected());
+ }
+
+ if (MiscUtil.isNotEmpty(getEidServiceSelected())) {
+ dbOA.setSelectedEIDServiceURL(getEidServiceSelected());
+ }
+
+ if (authUser.isAdmin()) {
+
+ // store BKU-URLs
+ final BKUURLS bkuruls = new BKUURLS();
+ authoa.setBKUURLS(bkuruls);
+ bkuruls.setHandyBKU(getBkuHandyURL());
+ bkuruls.setLocalBKU(getBkuLocalURL());
+ bkuruls.setOnlineBKU(getBkuOnlineURL());
+
+ // store SecurtiyLayerTemplates
+ TemplatesType templates = authoa.getTemplates();
+ if (templates == null) {
+ templates = new TemplatesType();
+ authoa.setTemplates(templates);
+ }
+ List<TemplateType> template = templates.getTemplate();
+ if (isLegacy()) {
+
+ if (template == null) {
+ template = new ArrayList<>();
} else {
- mandates.setProfiles(null);
- mandates.getProfileName().clear();
-
+ template.clear();
}
- authoa.setMandates(mandates);
- // set default transformation if it is empty
- List<TransformsInfoType> transformsInfo = authoa.getTransformsInfo();
- if (transformsInfo == null) {
- // TODO: set OA specific transformation if it is required
+ if (MiscUtil.isNotEmpty(getSLTemplateURL1())) {
+ final TemplateType el = new TemplateType();
+ el.setURL(getSLTemplateURL1());
+ template.add(el);
+ } else {
+ template.add(new TemplateType());
+ }
+ if (MiscUtil.isNotEmpty(getSLTemplateURL2())) {
+ final TemplateType el = new TemplateType();
+ el.setURL(getSLTemplateURL2());
+ template.add(el);
+ } else {
+ template.add(new TemplateType());
+ }
+ if (MiscUtil.isNotEmpty(getSLTemplateURL3())) {
+ final TemplateType el = new TemplateType();
+ el.setURL(getSLTemplateURL3());
+ template.add(el);
+ } else {
+ template.add(new TemplateType());
+ }
+ } else {
+ if (template != null && template.size() > 0) {
+ template.clear();
}
-
- if (enableTestCredentials) {
- TestCredentials testing = authoa.getTestCredentials();
+ }
+
+ // store keyBox Identifier
+ dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(getKeyBoxIdentifier()));
+ } else {
+ if (dbOA.isIsNew()) {
+ dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR);
+ }
+ }
+
+ final Mandates mandates = new Mandates();
+ if (isUseMandates()) {
+
+ final String[] profileList = getMandateProfiles().split(",");
+
+ List<String> dbProfiles = mandates.getProfileName();
+ if (dbProfiles == null) {
+ dbProfiles = new ArrayList<>();
+ mandates.setProfileName(dbProfiles);
+
+ }
+
+ for (final String el : profileList) {
+ dbProfiles.add(el.trim());
+ }
+
+ mandates.setProfiles(null);
+
+ if (MiscUtil.isNotEmpty(getMisServiceSelected())) {
+ mandates.setSelectedMISServiceURL(getMisServiceSelected());
+ }
+
+ if (MiscUtil.isNotEmpty(getElgaServiceSelected())) {
+ mandates.setSelecteELGAServiceURL(getElgaServiceSelected());
+ }
+
+ } else {
+ mandates.setProfiles(null);
+ mandates.getProfileName().clear();
+
+ }
+ authoa.setMandates(mandates);
+
+ // set default transformation if it is empty
+ final List<TransformsInfoType> transformsInfo = authoa.getTransformsInfo();
+ if (transformsInfo == null) {
+ // TODO: set OA specific transformation if it is required
+
+ }
+
+ if (enableTestCredentials) {
+ TestCredentials testing = authoa.getTestCredentials();
// if (testing != null)
// ConfigurationDBUtils.delete(testing);
- testing = new TestCredentials();
- authoa.setTestCredentials(testing);
- testing.setEnableTestCredentials(enableTestCredentials);
- testing.setCredentialOID(testCredentialOIDs);
-
+ testing = new TestCredentials();
+ authoa.setTestCredentials(testing);
+ testing.setEnableTestCredentials(enableTestCredentials);
+ testing.setCredentialOID(testCredentialOIDs);
+
+ } else {
+ final TestCredentials testing = authoa.getTestCredentials();
+ if (testing != null) {
+ testing.setEnableTestCredentials(false);
+ }
+
+ }
+
+ TestCredentials testing = authoa.getTestCredentials();
+ if (testing == null) {
+ testing = new TestCredentials();
+ authoa.setTestCredentials(testing);
+
+ }
+ testing.setUseTestAuthBlockTrustStore(useTestAuthblockValidationTrustStore);
+ testing.setUseTestIDLTrustStore(useTestIDLValidationTrustStore);
+
+ // store SL2.0 information
+ authoa.setSl20Active(isSl20Active());
+ authoa.setSl20EndPoints(getSl20EndPoints());
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ return new OAAuthenticationDataValidation().validate(this, authUser.isAdmin(), request);
+ }
+
+ /**
+ * @return the bkuOnlineURL
+ */
+ public String getBkuOnlineURL() {
+ return bkuOnlineURL;
+ }
+
+ /**
+ * @param bkuOnlineURL the bkuOnlineURL to set
+ */
+ public void setBkuOnlineURL(String bkuOnlineURL) {
+ this.bkuOnlineURL = bkuOnlineURL;
+ }
+
+ /**
+ * @return the bkuHandyURL
+ */
+ public String getBkuHandyURL() {
+ return bkuHandyURL;
+ }
+
+ /**
+ * @param bkuHandyURL the bkuHandyURL to set
+ */
+ public void setBkuHandyURL(String bkuHandyURL) {
+ this.bkuHandyURL = bkuHandyURL;
+ }
+
+ /**
+ * @return the bkuLocalURL
+ */
+ public String getBkuLocalURL() {
+ return bkuLocalURL;
+ }
+
+ /**
+ * @param bkuLocalURL the bkuLocalURL to set
+ */
+ public void setBkuLocalURL(String bkuLocalURL) {
+ this.bkuLocalURL = bkuLocalURL;
+ }
+
+ /**
+ * @return the mandateProfiles
+ */
+ public String getMandateProfiles() {
+ return mandateProfiles;
+ }
+
+ /**
+ * @param mandateProfiles the mandateProfiles to set
+ */
+ public void setMandateProfiles(String mandateProfiles) {
+ this.mandateProfiles = mandateProfiles;
+ }
+
+ /**
+ * @return the useMandates
+ */
+ public boolean isUseMandates() {
+ return useMandates;
+ }
+
+ /**
+ * @param useMandates the useMandates to set
+ */
+ public void setUseMandates(boolean useMandates) {
+ this.useMandates = useMandates;
+ }
+
+ /**
+ * @return the calculateHPI
+ */
+ public boolean isCalculateHPI() {
+ return calculateHPI;
+ }
+
+ /**
+ * @param calculateHPI the calculateHPI to set
+ */
+ public void setCalculateHPI(boolean calculateHPI) {
+ this.calculateHPI = calculateHPI;
+ }
+
+ /**
+ * @return the keyBoxIdentifier
+ */
+ public String getKeyBoxIdentifier() {
+ return keyBoxIdentifier;
+ }
+
+ /**
+ * @param keyBoxIdentifier the keyBoxIdentifier to set
+ */
+ public void setKeyBoxIdentifier(String keyBoxIdentifier) {
+ this.keyBoxIdentifier = keyBoxIdentifier;
+ }
+
+ /**
+ * @return the keyBoxIdentifierList
+ */
+ public Map<String, String> getKeyBoxIdentifierList() {
+ return keyBoxIdentifierList;
+ }
+
+ /**
+ * @return the legacy
+ */
+ public boolean isLegacy() {
+ return legacy;
+ }
+
+ /**
+ * @param legacy the legacy to set
+ */
+ public void setLegacy(boolean legacy) {
+ this.legacy = legacy;
+ }
+
+ /**
+ * @return the transformations
+ */
+ public Map<String, byte[]> getTransformations() {
+ return transformations;
+ }
+
+ /**
+ * @param transformations the transformations to set
+ */
+ public void setTransformations(Map<String, byte[]> transformations) {
+ this.transformations = transformations;
+ }
+
+ /**
+ * @return the sLTemplates
+ */
+ public List<String> getSLTemplates() {
+ return SLTemplates;
+ }
+
+ /**
+ * @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<>();
+ }
+ 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<>();
+ }
+ 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<>();
+ }
+ SLTemplates.add(sLTemplateURL3);
+ }
+
+ /**
+ * @return the enableTestCredentials
+ */
+ public boolean isEnableTestCredentials() {
+ return enableTestCredentials;
+ }
+
+ /**
+ * @param enableTestCredentials the enableTestCredentials to set
+ */
+ public void setEnableTestCredentials(boolean enableTestCredentials) {
+ this.enableTestCredentials = enableTestCredentials;
+ }
+
+ /**
+ * @return the testCredentialOIDs
+ */
+ public String getTestCredentialOIDs() {
+ String value = null;
+ if (testCredentialOIDs != null) {
+ for (final String el : testCredentialOIDs) {
+ if (value == null) {
+ value = el;
} else {
- TestCredentials testing = authoa.getTestCredentials();
- if (testing != null) {
- testing.setEnableTestCredentials(false);
- }
-
+ value += "," + el;
}
-
- TestCredentials testing = authoa.getTestCredentials();
- if (testing == null) {
- testing = new TestCredentials();
- authoa.setTestCredentials(testing);
-
- }
- testing.setUseTestAuthBlockTrustStore(useTestAuthblockValidationTrustStore);
- testing.setUseTestIDLTrustStore(useTestIDLValidationTrustStore);
-
-
- //store SL2.0 information
- authoa.setSl20Active(isSl20Active());
- authoa.setSl20EndPoints(getSl20EndPoints());
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- return new OAAuthenticationDataValidation().validate(this, authUser.isAdmin(), request);
- }
-
-
- /**
- * @return the bkuOnlineURL
- */
- public String getBkuOnlineURL() {
- return bkuOnlineURL;
- }
-
-
- /**
- * @param bkuOnlineURL the bkuOnlineURL to set
- */
- public void setBkuOnlineURL(String bkuOnlineURL) {
- this.bkuOnlineURL = bkuOnlineURL;
- }
-
-
- /**
- * @return the bkuHandyURL
- */
- public String getBkuHandyURL() {
- return bkuHandyURL;
- }
-
-
- /**
- * @param bkuHandyURL the bkuHandyURL to set
- */
- public void setBkuHandyURL(String bkuHandyURL) {
- this.bkuHandyURL = bkuHandyURL;
- }
-
-
- /**
- * @return the bkuLocalURL
- */
- public String getBkuLocalURL() {
- return bkuLocalURL;
- }
-
-
- /**
- * @param bkuLocalURL the bkuLocalURL to set
- */
- public void setBkuLocalURL(String bkuLocalURL) {
- this.bkuLocalURL = bkuLocalURL;
- }
-
-
- /**
- * @return the mandateProfiles
- */
- public String getMandateProfiles() {
- return mandateProfiles;
- }
-
-
- /**
- * @param mandateProfiles the mandateProfiles to set
- */
- public void setMandateProfiles(String mandateProfiles) {
- this.mandateProfiles = mandateProfiles;
- }
-
-
- /**
- * @return the useMandates
- */
- public boolean isUseMandates() {
- return useMandates;
- }
-
-
- /**
- * @param useMandates the useMandates to set
- */
- public void setUseMandates(boolean useMandates) {
- this.useMandates = useMandates;
- }
-
-
- /**
- * @return the calculateHPI
- */
- public boolean isCalculateHPI() {
- return calculateHPI;
- }
-
-
- /**
- * @param calculateHPI the calculateHPI to set
- */
- public void setCalculateHPI(boolean calculateHPI) {
- this.calculateHPI = calculateHPI;
- }
-
-
- /**
- * @return the keyBoxIdentifier
- */
- public String getKeyBoxIdentifier() {
- return keyBoxIdentifier;
- }
-
-
- /**
- * @param keyBoxIdentifier the keyBoxIdentifier to set
- */
- public void setKeyBoxIdentifier(String keyBoxIdentifier) {
- this.keyBoxIdentifier = keyBoxIdentifier;
- }
-
-
- /**
- * @return the keyBoxIdentifierList
- */
- public Map<String, String> getKeyBoxIdentifierList() {
- return keyBoxIdentifierList;
- }
-
-
- /**
- * @return the legacy
- */
- public boolean isLegacy() {
- return legacy;
- }
-
-
- /**
- * @param legacy the legacy to set
- */
- public void setLegacy(boolean legacy) {
- this.legacy = legacy;
- }
-
-
- /**
- * @return the transformations
- */
- public Map<String, byte[]> getTransformations() {
- return transformations;
- }
-
-
- /**
- * @param transformations the transformations to set
- */
- public void setTransformations(Map<String, byte[]> transformations) {
- this.transformations = transformations;
- }
-
-
- /**
- * @return the sLTemplates
- */
- public List<String> getSLTemplates() {
- return SLTemplates;
- }
-
- /**
- * @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);
- }
-
- /**
- * @return the enableTestCredentials
- */
- public boolean isEnableTestCredentials() {
- return enableTestCredentials;
- }
-
- /**
- * @param enableTestCredentials the enableTestCredentials to set
- */
- public void setEnableTestCredentials(boolean enableTestCredentials) {
- this.enableTestCredentials = enableTestCredentials;
- }
-
- /**
- * @return the testCredentialOIDs
- */
- public String getTestCredentialOIDs() {
- String value = null;
- if (testCredentialOIDs != null) {
- for (String el : testCredentialOIDs) {
- if (value == null)
- value = el;
- else
- value += "," + el;
-
- }
- }
-
- return value;
- }
-
- public List<String> getTestCredialOIDList() {
- return this.testCredentialOIDs;
- }
-
- /**
- * @param testCredentialOIDs the testCredentialOIDs to set
- */
- public void setTestCredentialOIDs(String testCredentialOIDs) {
- if (MiscUtil.isNotEmpty(testCredentialOIDs)) {
- String[] oidList = testCredentialOIDs.split(",");
-
- this.testCredentialOIDs = new ArrayList<String>();
- for (int i=0; i<oidList.length; i++)
- this.testCredentialOIDs.add(oidList[i].trim());
- }
- }
-
- /**
- * @return the useTestIDLValidationTrustStore
- */
- public boolean isUseTestIDLValidationTrustStore() {
- return useTestIDLValidationTrustStore;
- }
-
- /**
- * @param useTestIDLValidationTrustStore the useTestIDLValidationTrustStore to set
- */
- public void setUseTestIDLValidationTrustStore(
- boolean useTestIDLValidationTrustStore) {
- this.useTestIDLValidationTrustStore = useTestIDLValidationTrustStore;
- }
-
- /**
- * @return the useTestAuthblockValidationTrustStore
- */
- public boolean isUseTestAuthblockValidationTrustStore() {
- return useTestAuthblockValidationTrustStore;
- }
-
- /**
- * @param useTestAuthblockValidationTrustStore the useTestAuthblockValidationTrustStore to set
- */
- public void setUseTestAuthblockValidationTrustStore(
- boolean useTestAuthblockValidationTrustStore) {
- this.useTestAuthblockValidationTrustStore = useTestAuthblockValidationTrustStore;
- }
-
- /**
- * @return the misServiceSelected
- */
- public String getMisServiceSelected() {
- return misServiceSelected;
- }
-
- /**
- * @param misServiceSelected the misServiceSelected to set
- */
- public void setMisServiceSelected(String misServiceSelected) {
- this.misServiceSelected = misServiceSelected;
- }
-
- /**
- * @return the elgaServiceSelected
- */
- public String getElgaServiceSelected() {
- return elgaServiceSelected;
- }
-
- /**
- * @param elgaServiceSelected the elgaServiceSelected to set
- */
- public void setElgaServiceSelected(String elgaServiceSelected) {
- this.elgaServiceSelected = elgaServiceSelected;
- }
-
- /**
- * @return the szrgwServiceSelected
- */
- public String getSzrgwServiceSelected() {
- return szrgwServiceSelected;
- }
-
- /**
- * @param szrgwServiceSelected the szrgwServiceSelected to set
- */
- public void setSzrgwServiceSelected(String szrgwServiceSelected) {
- this.szrgwServiceSelected = szrgwServiceSelected;
- }
-
- /**
- * @return the misServicesList
- */
- public List<String> getMisServicesList() {
- return misServicesList;
- }
-
- /**
- * @return the elgaServicesList
- */
- public List<String> getElgaServicesList() {
- return elgaServicesList;
- }
-
- /**
- * @return the szrgwServicesList
- */
- public List<String> getSzrgwServicesList() {
- return szrgwServicesList;
- }
-
- public List<String> getEidServicesList() {
- return eidServicesList;
- }
-
- public String getEidServiceSelected() {
- return eidServiceSelected;
- }
-
- public void setEidServiceSelected(String eidServiceSelected) {
- this.eidServiceSelected = eidServiceSelected;
- }
-
- public boolean isSl20Active() {
- return sl20Active;
- }
-
- public void setSl20Active(boolean sl20Active) {
- this.sl20Active = sl20Active;
- }
-
- public String getSl20EndPoints() {
- return sl20EndPoints;
- }
-
- public void setSl20EndPoints(String sl20EndPoints) {
- if (MiscUtil.isNotEmpty(sl20EndPoints))
- this.sl20EndPoints =
- KeyValueUtils.removeAllNewlineFromString(sl20EndPoints);
- else
- this.sl20EndPoints = sl20EndPoints;
- }
-
- public boolean isMoaidMode() {
- return isMoaidMode;
- }
-
+
+ }
+ }
+
+ return value;
+ }
+
+ public List<String> getTestCredialOIDList() {
+ return this.testCredentialOIDs;
+ }
+
+ /**
+ * @param testCredentialOIDs the testCredentialOIDs to set
+ */
+ public void setTestCredentialOIDs(String testCredentialOIDs) {
+ if (MiscUtil.isNotEmpty(testCredentialOIDs)) {
+ final String[] oidList = testCredentialOIDs.split(",");
+
+ this.testCredentialOIDs = new ArrayList<>();
+ for (final String element : oidList) {
+ this.testCredentialOIDs.add(element.trim());
+ }
+ }
+ }
+
+ /**
+ * @return the useTestIDLValidationTrustStore
+ */
+ public boolean isUseTestIDLValidationTrustStore() {
+ return useTestIDLValidationTrustStore;
+ }
+
+ /**
+ * @param useTestIDLValidationTrustStore the useTestIDLValidationTrustStore to
+ * set
+ */
+ public void setUseTestIDLValidationTrustStore(
+ boolean useTestIDLValidationTrustStore) {
+ this.useTestIDLValidationTrustStore = useTestIDLValidationTrustStore;
+ }
+
+ /**
+ * @return the useTestAuthblockValidationTrustStore
+ */
+ public boolean isUseTestAuthblockValidationTrustStore() {
+ return useTestAuthblockValidationTrustStore;
+ }
+
+ /**
+ * @param useTestAuthblockValidationTrustStore the
+ * useTestAuthblockValidationTrustStore
+ * to set
+ */
+ public void setUseTestAuthblockValidationTrustStore(
+ boolean useTestAuthblockValidationTrustStore) {
+ this.useTestAuthblockValidationTrustStore = useTestAuthblockValidationTrustStore;
+ }
+
+ /**
+ * @return the misServiceSelected
+ */
+ public String getMisServiceSelected() {
+ return misServiceSelected;
+ }
+
+ /**
+ * @param misServiceSelected the misServiceSelected to set
+ */
+ public void setMisServiceSelected(String misServiceSelected) {
+ this.misServiceSelected = misServiceSelected;
+ }
+
+ /**
+ * @return the elgaServiceSelected
+ */
+ public String getElgaServiceSelected() {
+ return elgaServiceSelected;
+ }
+
+ /**
+ * @param elgaServiceSelected the elgaServiceSelected to set
+ */
+ public void setElgaServiceSelected(String elgaServiceSelected) {
+ this.elgaServiceSelected = elgaServiceSelected;
+ }
+
+ /**
+ * @return the szrgwServiceSelected
+ */
+ public String getSzrgwServiceSelected() {
+ return szrgwServiceSelected;
+ }
+
+ /**
+ * @param szrgwServiceSelected the szrgwServiceSelected to set
+ */
+ public void setSzrgwServiceSelected(String szrgwServiceSelected) {
+ this.szrgwServiceSelected = szrgwServiceSelected;
+ }
+
+ /**
+ * @return the misServicesList
+ */
+ public List<String> getMisServicesList() {
+ return misServicesList;
+ }
+
+ /**
+ * @return the elgaServicesList
+ */
+ public List<String> getElgaServicesList() {
+ return elgaServicesList;
+ }
+
+ /**
+ * @return the szrgwServicesList
+ */
+ public List<String> getSzrgwServicesList() {
+ return szrgwServicesList;
+ }
+
+ public List<String> getEidServicesList() {
+ return eidServicesList;
+ }
+
+ public String getEidServiceSelected() {
+ return eidServiceSelected;
+ }
+
+ public void setEidServiceSelected(String eidServiceSelected) {
+ this.eidServiceSelected = eidServiceSelected;
+ }
+
+ public boolean isSl20Active() {
+ return sl20Active;
+ }
+
+ public void setSl20Active(boolean sl20Active) {
+ this.sl20Active = sl20Active;
+ }
+
+ public String getSl20EndPoints() {
+ return sl20EndPoints;
+ }
+
+ public void setSl20EndPoints(String sl20EndPoints) {
+ if (MiscUtil.isNotEmpty(sl20EndPoints)) {
+ this.sl20EndPoints =
+ KeyValueUtils.removeAllNewlineFromString(sl20EndPoints);
+ } else {
+ this.sl20EndPoints = sl20EndPoints;
+ }
+ }
+
+ public boolean isMoaidMode() {
+ return isMoaidMode;
+ }
+
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java
index bac69cf34..1f4d842ca 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OABPKEncryption.java
@@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.SerializationUtils;
-import org.apache.log4j.Logger;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.commons.api.data.BPKDecryptionParameters;
@@ -49,322 +48,342 @@ import at.gv.egovernment.moa.id.configuration.utils.ConfigurationEncryptionUtils
import at.gv.egovernment.moa.id.configuration.validation.oa.OAFileUploadValidation;
import at.gv.egovernment.moa.id.data.EncryptedData;
import at.gv.egovernment.moa.util.MiscUtil;
+import lombok.extern.slf4j.Slf4j;
/**
* @author tlenz
*
*/
+@Slf4j
public class OABPKEncryption implements IOnlineApplicationData {
- private static final Logger log = Logger.getLogger(OABPKEncryption.class);
-
- private static final String MODULENAME = "bPKEncryptionDecryption";
-
- private String keyStorePassword = null;
- private String keyAlias = null;
- private String keyPassword = null;
-
- private Map<String, byte[]> keyStoreForm = new HashMap<String, byte[]>();
-
- private List<File> keyStoreFileUpload = null;
- private List<String> keyStoreFileUploadContentType = null;
- private List<String> keyStoreFileUploadFileName = new ArrayList<String>();;
- private boolean deletekeyStore = false;
- private boolean validationError = false;
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return MODULENAME;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA,
- AuthenticatedUser authUser, HttpServletRequest request) {
- AuthComponentOA oaAuth = dbOA.getAuthComponentOA();
- if (oaAuth != null) {
- EncBPKInformation bPKEncDec = oaAuth.getEncBPKInformation();
- if (bPKEncDec != null) {
- BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
- if (bPKDec != null) {
- keyAlias = bPKDec.getKeyAlias();
- if (bPKDec.getKeyStoreFileName() != null)
- keyStoreFileUploadFileName.add(bPKDec.getKeyStoreFileName());
-
- }
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
- AuthComponentOA oaAuth = dbOA.getAuthComponentOA();
- if (oaAuth == null) {
- oaAuth = new AuthComponentOA();
- dbOA.setAuthComponentOA(oaAuth);
-
- }
- EncBPKInformation bPKEncDec = oaAuth.getEncBPKInformation();
- if (bPKEncDec == null) {
- bPKEncDec = new EncBPKInformation();
- oaAuth.setEncBPKInformation(bPKEncDec);
-
- }
-
- BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
- if (bPKDec == null) {
- bPKDec = new BPKDecryption();
- bPKEncDec.setBPKDecryption(bPKDec);
- }
-
- if (isDeletekeyStore()) {
- bPKDec.setIv(null);
- bPKDec.setKeyAlias(null);
- bPKDec.setKeyInformation(null);
- bPKDec.setKeyStoreFileName(null);
-
- }
-
- BPKDecryptionParameters keyInfo = new BPKDecryptionParameters();
- if (keyStoreForm != null && keyStoreForm.size() > 0) {
- keyInfo.setKeyAlias(keyAlias);
- keyInfo.setKeyPassword(keyPassword);
- keyInfo.setKeyStorePassword(keyStorePassword);
-
- Iterator<String> interator = keyStoreForm.keySet().iterator();
- bPKDec.setKeyStoreFileName(interator.next());
- bPKDec.setKeyAlias(keyAlias);
- keyInfo.setKeyStore(keyStoreForm.get(
- bPKDec.getKeyStoreFileName()));
-
- //encrypt key information
- byte[] serKeyInfo = SerializationUtils.serialize(keyInfo);
- try {
- EncryptedData encryptkeyInfo = ConfigurationEncryptionUtils.getInstance().encrypt(serKeyInfo);
- bPKDec.setIv(encryptkeyInfo.getIv());
- bPKDec.setKeyInformation(encryptkeyInfo.getEncData());
-
- } catch (BuildException e) {
- log.error("Configuration encryption FAILED.", e);
- return LanguageHelper.getErrorString("error.general.text", request);
-
- }
- }
-
- request.getSession().setAttribute(Constants.SESSION_BPKENCRYPTIONDECRYPTION, null);
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- HttpSession session = request.getSession();
- List<String> errors = new ArrayList<String>();
-
- String check = null;
-
- OAFileUploadValidation valiator_fileUpload = new OAFileUploadValidation();
- //validate BKU-selection template
- List<String> templateError = valiator_fileUpload.validate(getKeyStoreFileUploadFileName()
- , getKeyStoreFileUpload(), "validation.bPKDec.keyStore", keyStoreForm, request);
- if (templateError != null && templateError.size() == 0) {
- if (keyStoreForm != null && keyStoreForm.size() > 0) {
- session.setAttribute(Constants.SESSION_BPKENCRYPTIONDECRYPTION, keyStoreForm);
-
- } else
- keyStoreForm = (Map<String, byte[]>) session.getAttribute(Constants.SESSION_BPKENCRYPTIONDECRYPTION);
-
- } else {
- errors.addAll(templateError);
+ private static final String MODULENAME = "bPKEncryptionDecryption";
+
+ private String keyStorePassword = null;
+ private String keyAlias = null;
+ private String keyPassword = null;
+
+ private Map<String, byte[]> keyStoreForm = new HashMap<>();
+
+ private List<File> keyStoreFileUpload = null;
+ private List<String> keyStoreFileUploadContentType = null;
+ private List<String> keyStoreFileUploadFileName = new ArrayList<>();
+ private boolean deletekeyStore = false;
+ private boolean validationError = false;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return MODULENAME;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ final AuthComponentOA oaAuth = dbOA.getAuthComponentOA();
+ if (oaAuth != null) {
+ final EncBPKInformation bPKEncDec = oaAuth.getEncBPKInformation();
+ if (bPKEncDec != null) {
+ final BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
+ if (bPKDec != null) {
+ keyAlias = bPKDec.getKeyAlias();
+ if (bPKDec.getKeyStoreFileName() != null) {
+ keyStoreFileUploadFileName.add(bPKDec.getKeyStoreFileName());
+ }
}
-
- if (keyStoreForm != null && keyStoreForm.size() > 0) {
- check = getKeyStorePassword();
- if (MiscUtil.isEmpty(check)) {
- log.info("bPK decryption keystore password is empty");
- errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyStorePassword.empty", request));
-
- } else {
- if (ValidationHelper.containsNotValidCharacter(check, false)) {
- log.warn("bPK decryption keystore password contains potentail XSS characters: " + check);
- errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyStorePassword.valid",
- new Object[] {ValidationHelper.getNotValidCharacter(false)}, request ));
-
- }
- }
-
- check = getKeyAlias();
- if (MiscUtil.isEmpty(check)) {
- log.info("bPK decryption key alias is empty");
- errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyAlias.empty", request));
-
- } else {
- if (ValidationHelper.containsNotValidCharacter(check, false)) {
- log.warn("bPK decryption key alias contains potentail XSS characters: " + check);
- errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyAlias.valid",
- new Object[] {ValidationHelper.getNotValidCharacter(false)}, request ));
-
- }
- }
-
- check = getKeyPassword();
- if (MiscUtil.isNotEmpty(check)) {
- if (ValidationHelper.containsNotValidCharacter(check, false)) {
- log.warn("bPK decryption key password contains potentail XSS characters: " + check);
- errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyPassword.valid",
- new Object[] {ValidationHelper.getNotValidCharacter(false)}, request ));
-
- }
- }
-
- BPKDecryptionParameters keyInfo = new BPKDecryptionParameters();
- keyInfo.setKeyAlias(keyAlias);
- keyInfo.setKeyPassword(keyPassword);
- keyInfo.setKeyStorePassword(keyStorePassword);
- Iterator<String> interator = keyStoreForm.keySet().iterator();
- String fileName = interator.next();
- keyInfo.setKeyStore(keyStoreForm.get(fileName));
- if (keyInfo.getPrivateKey() == null) {
- log.info("Open keyStore FAILED.");
- errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyStore.file.valid", request));
-
- }
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ AuthComponentOA oaAuth = dbOA.getAuthComponentOA();
+ if (oaAuth == null) {
+ oaAuth = new AuthComponentOA();
+ dbOA.setAuthComponentOA(oaAuth);
+
+ }
+ EncBPKInformation bPKEncDec = oaAuth.getEncBPKInformation();
+ if (bPKEncDec == null) {
+ bPKEncDec = new EncBPKInformation();
+ oaAuth.setEncBPKInformation(bPKEncDec);
+
+ }
+
+ BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
+ if (bPKDec == null) {
+ bPKDec = new BPKDecryption();
+ bPKEncDec.setBPKDecryption(bPKDec);
+ }
+
+ if (isDeletekeyStore()) {
+ bPKDec.setIv(null);
+ bPKDec.setKeyAlias(null);
+ bPKDec.setKeyInformation(null);
+ bPKDec.setKeyStoreFileName(null);
+
+ }
+
+ final BPKDecryptionParameters keyInfo = new BPKDecryptionParameters();
+ if (keyStoreForm != null && keyStoreForm.size() > 0) {
+ keyInfo.setKeyAlias(keyAlias);
+ keyInfo.setKeyPassword(keyPassword);
+ keyInfo.setKeyStorePassword(keyStorePassword);
+
+ final Iterator<String> interator = keyStoreForm.keySet().iterator();
+ bPKDec.setKeyStoreFileName(interator.next());
+ bPKDec.setKeyAlias(keyAlias);
+ keyInfo.setKeyStore(keyStoreForm.get(
+ bPKDec.getKeyStoreFileName()));
+
+ // encrypt key information
+ final byte[] serKeyInfo = SerializationUtils.serialize(keyInfo);
+ try {
+ final EncryptedData encryptkeyInfo = ConfigurationEncryptionUtils.getInstance().encrypt(serKeyInfo);
+ bPKDec.setIv(encryptkeyInfo.getIv());
+ bPKDec.setKeyInformation(encryptkeyInfo.getEncData());
+
+ } catch (final BuildException e) {
+ log.error("Configuration encryption FAILED.", e);
+ return LanguageHelper.getErrorString("error.general.text", request);
+
+ }
+ }
+
+ request.getSession().setAttribute(Constants.SESSION_BPKENCRYPTIONDECRYPTION, null);
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ final HttpSession session = request.getSession();
+ final List<String> errors = new ArrayList<>();
+
+ String check = null;
+
+ final OAFileUploadValidation valiator_fileUpload = new OAFileUploadValidation();
+ // validate BKU-selection template
+ final List<String> templateError = valiator_fileUpload.validate(getKeyStoreFileUploadFileName(),
+ getKeyStoreFileUpload(), "validation.bPKDec.keyStore", keyStoreForm, request);
+ if (templateError != null && templateError.size() == 0) {
+ if (keyStoreForm != null && keyStoreForm.size() > 0) {
+ session.setAttribute(Constants.SESSION_BPKENCRYPTIONDECRYPTION, keyStoreForm);
+
+ } else {
+ keyStoreForm = (Map<String, byte[]>) session.getAttribute(Constants.SESSION_BPKENCRYPTIONDECRYPTION);
+ }
+
+ } else {
+ errors.addAll(templateError);
+
+ }
+
+ if (keyStoreForm != null && keyStoreForm.size() > 0) {
+ check = getKeyStorePassword();
+ if (MiscUtil.isEmpty(check)) {
+ log.info("bPK decryption keystore password is empty");
+ errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyStorePassword.empty", request));
+
+ } else {
+ if (ValidationHelper.containsNotValidCharacter(check, false)) {
+ log.warn("bPK decryption keystore password contains potentail XSS characters: " + check);
+ errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyStorePassword.valid",
+ new Object[] { ValidationHelper.getNotValidCharacter(false) }, request));
+
}
-
- if (errors.size() > 0) {
- validationError = true;
-
+ }
+
+ check = getKeyAlias();
+ if (MiscUtil.isEmpty(check)) {
+ log.info("bPK decryption key alias is empty");
+ errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyAlias.empty", request));
+
+ } else {
+ if (ValidationHelper.containsNotValidCharacter(check, false)) {
+ log.warn("bPK decryption key alias contains potentail XSS characters: " + check);
+ errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyAlias.valid",
+ new Object[] { ValidationHelper.getNotValidCharacter(false) }, request));
+
}
-
- return errors;
-
- }
-
- /**
- * @return the keyStorePassword
- */
- public String getKeyStorePassword() {
- return keyStorePassword;
- }
-
- /**
- * @param keyStorePassword the keyStorePassword to set
- */
- public void setKeyStorePassword(String keyStorePassword) {
- this.keyStorePassword = keyStorePassword;
- }
-
- /**
- * @return the keyAlias
- */
- public String getKeyAlias() {
- return keyAlias;
- }
-
- /**
- * @param keyAlias the keyAlias to set
- */
- public void setKeyAlias(String keyAlias) {
- this.keyAlias = keyAlias;
- }
-
- /**
- * @return the keyPassword
- */
- public String getKeyPassword() {
- return keyPassword;
- }
-
- /**
- * @param keyPassword the keyPassword to set
- */
- public void setKeyPassword(String keyPassword) {
- this.keyPassword = keyPassword;
- }
-
- /**
- * @return the keyStoreFileUpload
- */
- public List<File> getKeyStoreFileUpload() {
- return keyStoreFileUpload;
- }
-
- /**
- * @param keyStoreFileUpload the keyStoreFileUpload to set
- */
- public void setKeyStoreFileUpload(List<File> keyStoreFileUpload) {
- this.keyStoreFileUpload = keyStoreFileUpload;
- }
-
- /**
- * @return the keyStoreFileUploadContentType
- */
- public List<String> getKeyStoreFileUploadContentType() {
- return keyStoreFileUploadContentType;
- }
-
- /**
- * @param keyStoreFileUploadContentType the keyStoreFileUploadContentType to set
- */
- public void setKeyStoreFileUploadContentType(
- List<String> keyStoreFileUploadContentType) {
- this.keyStoreFileUploadContentType = keyStoreFileUploadContentType;
- }
-
- /**
- * @return the keyStoreFileUploadFileName
- */
- public List<String> getKeyStoreFileUploadFileName() {
- return keyStoreFileUploadFileName;
- }
-
- /**
- * @param keyStoreFileUploadFileName the keyStoreFileUploadFileName to set
- */
- public void setKeyStoreFileUploadFileName(
- List<String> keyStoreFileUploadFileName) {
- this.keyStoreFileUploadFileName = keyStoreFileUploadFileName;
- }
-
- /**
- * @return the deletekeyStore
- */
- public boolean isDeletekeyStore() {
- return deletekeyStore;
- }
-
- /**
- * @param deletekeyStore the deletekeyStore to set
- */
- public void setDeletekeyStore(boolean deletekeyStore) {
- this.deletekeyStore = deletekeyStore;
- }
-
- /**
- * @return the validationError
- */
- public boolean isValidationError() {
- return validationError;
- }
-
-
+ }
+
+ check = getKeyPassword();
+ if (MiscUtil.isNotEmpty(check)) {
+ if (ValidationHelper.containsNotValidCharacter(check, false)) {
+ log.warn("bPK decryption key password contains potentail XSS characters: " + check);
+ errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyPassword.valid",
+ new Object[] { ValidationHelper.getNotValidCharacter(false) }, request));
+
+ }
+ }
+
+ final BPKDecryptionParameters keyInfo = new BPKDecryptionParameters();
+ keyInfo.setKeyAlias(keyAlias);
+ keyInfo.setKeyPassword(keyPassword);
+ keyInfo.setKeyStorePassword(keyStorePassword);
+ final Iterator<String> interator = keyStoreForm.keySet().iterator();
+ final String fileName = interator.next();
+ keyInfo.setKeyStore(keyStoreForm.get(fileName));
+ if (keyInfo.getPrivateKey() == null) {
+ log.info("Open keyStore FAILED.");
+ errors.add(LanguageHelper.getErrorString("validation.bPKDec.keyStore.file.valid", request));
+
+ }
+ }
+
+ if (errors.size() > 0) {
+ validationError = true;
+
+ }
+
+ return errors;
+
+ }
+
+ /**
+ * @return the keyStorePassword
+ */
+ public String getKeyStorePassword() {
+ return keyStorePassword;
+ }
+
+ /**
+ * @param keyStorePassword the keyStorePassword to set
+ */
+ public void setKeyStorePassword(String keyStorePassword) {
+ this.keyStorePassword = keyStorePassword;
+ }
+
+ /**
+ * @return the keyAlias
+ */
+ public String getKeyAlias() {
+ return keyAlias;
+ }
+
+ /**
+ * @param keyAlias the keyAlias to set
+ */
+ public void setKeyAlias(String keyAlias) {
+ this.keyAlias = keyAlias;
+ }
+
+ /**
+ * @return the keyPassword
+ */
+ public String getKeyPassword() {
+ return keyPassword;
+ }
+
+ /**
+ * @param keyPassword the keyPassword to set
+ */
+ public void setKeyPassword(String keyPassword) {
+ this.keyPassword = keyPassword;
+ }
+
+ /**
+ * @return the keyStoreFileUpload
+ */
+ public List<File> getKeyStoreFileUpload() {
+ return keyStoreFileUpload;
+ }
+
+ /**
+ * @param keyStoreFileUpload the keyStoreFileUpload to set
+ */
+ public void setKeyStoreFileUpload(List<File> keyStoreFileUpload) {
+ this.keyStoreFileUpload = keyStoreFileUpload;
+ }
+
+ /**
+ * @return the keyStoreFileUploadContentType
+ */
+ public List<String> getKeyStoreFileUploadContentType() {
+ return keyStoreFileUploadContentType;
+ }
+
+ /**
+ * @param keyStoreFileUploadContentType the keyStoreFileUploadContentType to set
+ */
+ public void setKeyStoreFileUploadContentType(
+ List<String> keyStoreFileUploadContentType) {
+ this.keyStoreFileUploadContentType = keyStoreFileUploadContentType;
+ }
+
+ /**
+ * @return the keyStoreFileUploadFileName
+ */
+ public List<String> getKeyStoreFileUploadFileName() {
+ return keyStoreFileUploadFileName;
+ }
+
+ /**
+ * @param keyStoreFileUploadFileName the keyStoreFileUploadFileName to set
+ */
+ public void setKeyStoreFileUploadFileName(
+ List<String> keyStoreFileUploadFileName) {
+ this.keyStoreFileUploadFileName = keyStoreFileUploadFileName;
+ }
+
+ /**
+ * @return the deletekeyStore
+ */
+ public boolean isDeletekeyStore() {
+ return deletekeyStore;
+ }
+
+ /**
+ * @param deletekeyStore the deletekeyStore to set
+ */
+ public void setDeletekeyStore(boolean deletekeyStore) {
+ this.deletekeyStore = deletekeyStore;
+ }
+
+ /**
+ * @return the validationError
+ */
+ public boolean isValidationError() {
+ return validationError;
+ }
}
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 c51513193..45a3dba1b 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
@@ -27,8 +27,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
import at.gv.egovernment.moa.id.commons.validation.ValidationHelper;
@@ -36,130 +34,151 @@ import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
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 identifier = null;
- private String friendlyName = null;
- private boolean businessService = false;
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OAGeneralInformation";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser, HttpServletRequest request) {
- isActive = dbOAConfig.isIsActive();
-
- friendlyName = dbOAConfig.getFriendlyName();
- identifier = dbOAConfig.getPublicURLPrefix();
-
- if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE))
- businessService = true;
- else
- businessService = false;
-
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
- AuthComponentOA authoa = dbOA.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dbOA.setAuthComponentOA(authoa);
- }
-
- if (authUser.isAdmin()) dbOA.setIsActive(isActive());
-
- dbOA.setPublicURLPrefix(getIdentifier());
- dbOA.setFriendlyName(getFriendlyName());
-
- if (isBusinessService() || authUser.isOnlyBusinessService()) {
- dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
-
- } else {
- dbOA.setType(null);
- }
-
- return null;
-
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
-
- List<String> errors = new ArrayList<String>();
- String check;
-
- //check OA FriendlyName
- check = getFriendlyName();
- if (MiscUtil.isNotEmpty(check)) {
- if (ValidationHelper.containsNotValidCharacter(check, false)) {
- log.warn("OAFriendlyName contains potentail XSS characters: " + check);
- errors.add(LanguageHelper.getErrorString("validation.general.oafriendlyname.valid",
- new Object[] {ValidationHelper.getNotValidCharacter(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;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public String getFriendlyName() {
- return friendlyName;
- }
-
- public void setFriendlyName(String friendlyName) {
- this.friendlyName = friendlyName;
- }
-
- public boolean isActive() {
- return isActive;
- }
-
- public void setActive(boolean isActive) {
- this.isActive = isActive;
- }
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class OAGeneralConfig implements IOnlineApplicationData {
+
+ private boolean isActive = false;
+
+ private String identifier = null;
+ private String friendlyName = null;
+ private boolean businessService = false;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OAGeneralInformation";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ isActive = dbOAConfig.isIsActive();
+
+ friendlyName = dbOAConfig.getFriendlyName();
+ identifier = dbOAConfig.getPublicURLPrefix();
+
+ if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE)) {
+ businessService = true;
+ } else {
+ businessService = false;
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
+
+ if (authUser.isAdmin()) {
+ dbOA.setIsActive(isActive());
+ }
+
+ dbOA.setPublicURLPrefix(getIdentifier());
+ dbOA.setFriendlyName(getFriendlyName());
+
+ if (isBusinessService() || authUser.isOnlyBusinessService()) {
+ dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
+
+ } else {
+ dbOA.setType(null);
+ }
+
+ return null;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+
+ final List<String> errors = new ArrayList<>();
+ String check;
+
+ // check OA FriendlyName
+ check = getFriendlyName();
+ if (MiscUtil.isNotEmpty(check)) {
+ if (ValidationHelper.containsNotValidCharacter(check, false)) {
+ log.warn("OAFriendlyName contains potentail XSS characters: " + check);
+ errors.add(LanguageHelper.getErrorString("validation.general.oafriendlyname.valid",
+ new Object[] { ValidationHelper.getNotValidCharacter(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;
+ }
+
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ public String getFriendlyName() {
+ return friendlyName;
+ }
+
+ public void setFriendlyName(String friendlyName) {
+ this.friendlyName = friendlyName;
+ }
+
+ public boolean isActive() {
+ return isActive;
+ }
+
+ public void setActive(boolean isActive) {
+ this.isActive = isActive;
+ }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java
index a4d71f0ed..ef5658ca4 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java
@@ -27,194 +27,212 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.InterfederationIDPType;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
import at.gv.egovernment.moa.id.commons.validation.ValidationHelper;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.util.MiscUtil;
+import lombok.extern.slf4j.Slf4j;
/**
* @author tlenz
*
*/
+@Slf4j
public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData {
- private static final Logger log = Logger.getLogger(OAMOAIDPInterfederationConfig.class);
-
- private String queryURL;
- private Boolean inboundSSO = true;
- private Boolean outboundSSO = true;
- private Boolean storeSSOSession = true;
- private Boolean passiveRequest = true;
- private Boolean localAuthOnError = true;
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "MOAIDPInterfederation";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA,
- AuthenticatedUser authUser, HttpServletRequest request) {
-
- InterfederationIDPType moaIDP = dbOA.getInterfederationIDP();
- if (moaIDP != null) {
- this.queryURL = moaIDP.getAttributeQueryURL();
- this.inboundSSO = moaIDP.isInboundSSO();
- this.outboundSSO = moaIDP.isOutboundSSO();
- this.storeSSOSession = moaIDP.isStoreSSOSession();
- this.localAuthOnError = moaIDP.isPerformLocalAuthenticationOnError();
- this.passiveRequest = moaIDP.isPerformPassivRequest();
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
-
- if (authUser.isAdmin()) {
- dbOA.setIsInterfederationIDP(true);
-
- InterfederationIDPType moaIDP = dbOA.getInterfederationIDP();
- if (moaIDP == null) {
- moaIDP = new InterfederationIDPType();
- dbOA.setInterfederationIDP(moaIDP);
- }
-
- moaIDP.setAttributeQueryURL(queryURL);
- moaIDP.setInboundSSO(inboundSSO);
- moaIDP.setOutboundSSO(outboundSSO);
- moaIDP.setStoreSSOSession(storeSSOSession);
- moaIDP.setPerformLocalAuthenticationOnError(localAuthOnError);
- moaIDP.setPerformPassivRequest(passiveRequest);
-
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
-
- List<String> errors = new ArrayList<String>();
-
- if (MiscUtil.isNotEmpty(queryURL)) {
- if (!ValidationHelper.validateURL(queryURL)) {
- log.info("AttributeQuery URL is not valid");
- errors.add(LanguageHelper.getErrorString("validation.interfederation.moaidp.queryurl.valid", request));
-
- }
- }
-
+ private String queryURL;
+ private Boolean inboundSSO = true;
+ private Boolean outboundSSO = true;
+ private Boolean storeSSOSession = true;
+ private Boolean passiveRequest = true;
+ private Boolean localAuthOnError = true;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "MOAIDPInterfederation";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+
+ final InterfederationIDPType moaIDP = dbOA.getInterfederationIDP();
+ if (moaIDP != null) {
+ this.queryURL = moaIDP.getAttributeQueryURL();
+ this.inboundSSO = moaIDP.isInboundSSO();
+ this.outboundSSO = moaIDP.isOutboundSSO();
+ this.storeSSOSession = moaIDP.isStoreSSOSession();
+ this.localAuthOnError = moaIDP.isPerformLocalAuthenticationOnError();
+ this.passiveRequest = moaIDP.isPerformPassivRequest();
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+
+ if (authUser.isAdmin()) {
+ dbOA.setIsInterfederationIDP(true);
+
+ InterfederationIDPType moaIDP = dbOA.getInterfederationIDP();
+ if (moaIDP == null) {
+ moaIDP = new InterfederationIDPType();
+ dbOA.setInterfederationIDP(moaIDP);
+ }
+
+ moaIDP.setAttributeQueryURL(queryURL);
+ moaIDP.setInboundSSO(inboundSSO);
+ moaIDP.setOutboundSSO(outboundSSO);
+ moaIDP.setStoreSSOSession(storeSSOSession);
+ moaIDP.setPerformLocalAuthenticationOnError(localAuthOnError);
+ moaIDP.setPerformPassivRequest(passiveRequest);
+
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+
+ final List<String> errors = new ArrayList<>();
+
+ if (MiscUtil.isNotEmpty(queryURL)) {
+ if (!ValidationHelper.validateURL(queryURL)) {
+ log.info("AttributeQuery URL is not valid");
+ errors.add(LanguageHelper.getErrorString("validation.interfederation.moaidp.queryurl.valid",
+ request));
+
+ }
+ }
+
// if (inboundSSO && MiscUtil.isEmpty(queryURL)) {
// log.info("Inbound Single Sign-On requires AttributQueryURL configuration.");
// errors.add(LanguageHelper.getErrorString("validation.interfederation.moaidp.queryurl.empty", request));
// }
-
- return errors;
- }
-
- /**
- * @return the queryURL
- */
- public String getQueryURL() {
- return queryURL;
- }
-
- /**
- * @param queryURL the queryURL to set
- */
- public void setQueryURL(String queryURL) {
- this.queryURL = queryURL;
- }
-
- /**
- * @return the inboundSSO
- */
- public boolean isInboundSSO() {
- return inboundSSO.booleanValue();
- }
-
- /**
- * @param inboundSSO the inboundSSO to set
- */
- public void setInboundSSO(boolean inboundSSO) {
- this.inboundSSO = inboundSSO;
- }
-
- /**
- * @return the outboundSSO
- */
- public boolean isOutboundSSO() {
- return outboundSSO.booleanValue();
- }
-
- /**
- * @param outboundSSO the outboundSSO to set
- */
- public void setOutboundSSO(boolean outboundSSO) {
- this.outboundSSO = outboundSSO;
- }
-
- /**
- * @return the storeSSOSession
- */
- public boolean isStoreSSOSession() {
- return storeSSOSession.booleanValue();
- }
-
- /**
- * @param storeSSOSession the storeSSOSession to set
- */
- public void setStoreSSOSession(boolean storeSSOSession) {
- this.storeSSOSession = storeSSOSession;
- }
-
- /**
- * @return the passiveRequest
- */
- public boolean isPassiveRequest() {
- return passiveRequest.booleanValue();
- }
-
- /**
- * @param passiveRequest the passiveRequest to set
- */
- public void setPassiveRequest(boolean passiveRequest) {
- this.passiveRequest = passiveRequest;
- }
-
- /**
- * @return the localAuthOnError
- */
- public boolean isLocalAuthOnError() {
- return localAuthOnError.booleanValue();
- }
-
- /**
- * @param localAuthOnError the localAuthOnError to set
- */
- public void setLocalAuthOnError(boolean localAuthOnError) {
- this.localAuthOnError = localAuthOnError;
- }
-
-
+
+ return errors;
+ }
+
+ /**
+ * @return the queryURL
+ */
+ public String getQueryURL() {
+ return queryURL;
+ }
+
+ /**
+ * @param queryURL the queryURL to set
+ */
+ public void setQueryURL(String queryURL) {
+ this.queryURL = queryURL;
+ }
+
+ /**
+ * @return the inboundSSO
+ */
+ public boolean isInboundSSO() {
+ return inboundSSO.booleanValue();
+ }
+
+ /**
+ * @param inboundSSO the inboundSSO to set
+ */
+ public void setInboundSSO(boolean inboundSSO) {
+ this.inboundSSO = inboundSSO;
+ }
+
+ /**
+ * @return the outboundSSO
+ */
+ public boolean isOutboundSSO() {
+ return outboundSSO.booleanValue();
+ }
+
+ /**
+ * @param outboundSSO the outboundSSO to set
+ */
+ public void setOutboundSSO(boolean outboundSSO) {
+ this.outboundSSO = outboundSSO;
+ }
+
+ /**
+ * @return the storeSSOSession
+ */
+ public boolean isStoreSSOSession() {
+ return storeSSOSession.booleanValue();
+ }
+
+ /**
+ * @param storeSSOSession the storeSSOSession to set
+ */
+ public void setStoreSSOSession(boolean storeSSOSession) {
+ this.storeSSOSession = storeSSOSession;
+ }
+
+ /**
+ * @return the passiveRequest
+ */
+ public boolean isPassiveRequest() {
+ return passiveRequest.booleanValue();
+ }
+
+ /**
+ * @param passiveRequest the passiveRequest to set
+ */
+ public void setPassiveRequest(boolean passiveRequest) {
+ this.passiveRequest = passiveRequest;
+ }
+
+ /**
+ * @return the localAuthOnError
+ */
+ public boolean isLocalAuthOnError() {
+ return localAuthOnError.booleanValue();
+ }
+
+ /**
+ * @param localAuthOnError the localAuthOnError to set
+ */
+ public void setLocalAuthOnError(boolean localAuthOnError) {
+ this.localAuthOnError = localAuthOnError;
+ }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java
index ce50c847a..bae37b531 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAOAuth20Config.java
@@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAOAUTH20;
@@ -40,132 +39,150 @@ import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.validation.oa.OAOAUTH20ConfigValidation;
import at.gv.egovernment.moa.id.protocols.oauth20.OAuth20Util;
+import lombok.extern.slf4j.Slf4j;
-public class OAOAuth20Config implements IOnlineApplicationData{
-
- private final Logger log = Logger.getLogger(OAOAuth20Config.class);
-
- private String clientId = null;
- private String clientSecret = null;
- private String redirectUri = null;
-
- public OAOAuth20Config() {
- this.generateClientSecret();
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OAOpenIDConnect";
- }
-
- public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser, HttpServletRequest request) {
- List<String> errors = new ArrayList<String>();
-
- HttpSession session = request.getSession();
-
- AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
- if (authdata != null) {
- // set client id to public url prefix
- this.clientId = dbOAConfig.getPublicURLPrefix();
-
- OAOAUTH20 config = authdata.getOAOAUTH20();
-
- if (config != null) {
- // validate secret
- if (StringUtils.isNotEmpty(config.getOAuthClientSecret())) {
- this.clientSecret = config.getOAuthClientSecret();
- } else {
- this.generateClientSecret();
- }
-
- // validate redirectUri
- if (StringUtils.isNotEmpty(config.getOAuthRedirectUri()) && OAuth20Util.isUrl(config.getOAuthRedirectUri())) {
- this.redirectUri = config.getOAuthRedirectUri();
- } else {
- errors.add(LanguageHelper.getErrorString("error.oa.oauth.redirecturi", request));
- }
- } else {
- this.generateClientSecret();
- }
- }
-
- session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.getClientSecret());
-
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- return new OAOAUTH20ConfigValidation().validate(this, request);
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
- AuthComponentOA authoa = dbOA.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dbOA.setAuthComponentOA(authoa);
+@Slf4j
+public class OAOAuth20Config implements IOnlineApplicationData {
+
+ private String clientId = null;
+ private String clientSecret = null;
+ private String redirectUri = null;
+
+ public OAOAuth20Config() {
+ this.generateClientSecret();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OAOpenIDConnect";
+ }
+
+ @Override
+ public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ final List<String> errors = new ArrayList<>();
+
+ final HttpSession session = request.getSession();
+
+ final AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
+ if (authdata != null) {
+ // set client id to public url prefix
+ this.clientId = dbOAConfig.getPublicURLPrefix();
+
+ final OAOAUTH20 config = authdata.getOAOAUTH20();
+
+ if (config != null) {
+ // validate secret
+ if (StringUtils.isNotEmpty(config.getOAuthClientSecret())) {
+ this.clientSecret = config.getOAuthClientSecret();
+ } else {
+ this.generateClientSecret();
}
-
- log.debug("Saving OAuth 2.0 configuration:");
- OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20();
- if (oaOAuth20 == null) {
- oaOAuth20 = new OAOAUTH20();
- authoa.setOAOAUTH20(oaOAuth20);
+
+ // validate redirectUri
+ if (StringUtils.isNotEmpty(config.getOAuthRedirectUri()) && OAuth20Util.isUrl(config
+ .getOAuthRedirectUri())) {
+ this.redirectUri = config.getOAuthRedirectUri();
+ } else {
+ errors.add(LanguageHelper.getErrorString("error.oa.oauth.redirecturi", request));
}
+ } else {
+ this.generateClientSecret();
+ }
+ }
+
+ session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.getClientSecret());
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ return new OAOAUTH20ConfigValidation().validate(this, request);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
+
+ log.debug("Saving OAuth 2.0 configuration:");
+ OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20();
+ if (oaOAuth20 == null) {
+ oaOAuth20 = new OAOAUTH20();
+ authoa.setOAOAUTH20(oaOAuth20);
+ }
+
+ oaOAuth20.setOAuthClientId(dbOA.getPublicURLPrefix());
+ // oaOAuth20.setOAuthClientSecret(oauth20OA.getClientSecret());
+ oaOAuth20.setOAuthRedirectUri(getRedirectUri());
+ log.debug("client id: " + getClientId());
+ log.debug("client secret: " + getClientSecret());
+ log.debug("redirect uri:" + getRedirectUri());
+
+ oaOAuth20.setOAuthClientSecret((String) request.getSession().getAttribute(
+ Constants.SESSION_OAUTH20SECRET));
+ request.getSession().setAttribute(Constants.SESSION_OAUTH20SECRET, null);
+
+ return null;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public String getClientSecret() {
+ return clientSecret;
+ }
+
+ public void setClientSecret(String clientSecret) {
+ this.clientSecret = clientSecret;
+ }
+
+ public String getRedirectUri() {
+ return redirectUri;
+ }
+
+ public void setRedirectUri(String redirectUri) {
+ this.redirectUri = redirectUri;
+ }
- oaOAuth20.setOAuthClientId(dbOA.getPublicURLPrefix());
- // oaOAuth20.setOAuthClientSecret(oauth20OA.getClientSecret());
- oaOAuth20.setOAuthRedirectUri(getRedirectUri());
- log.debug("client id: " + getClientId());
- log.debug("client secret: " + getClientSecret());
- log.debug("redirect uri:" + getRedirectUri());
-
- oaOAuth20.setOAuthClientSecret((String) request.getSession().getAttribute(Constants.SESSION_OAUTH20SECRET));
- request.getSession().setAttribute(Constants.SESSION_OAUTH20SECRET, null);
-
- return null;
- }
-
- public String getClientId() {
- return clientId;
- }
-
- public void setClientId(String clientId) {
- this.clientId = clientId;
- }
-
- public String getClientSecret() {
- return clientSecret;
- }
-
- public void setClientSecret(String clientSecret) {
- this.clientSecret = clientSecret;
- }
-
- public String getRedirectUri() {
- return redirectUri;
- }
-
- public void setRedirectUri(String redirectUri) {
- this.redirectUri = redirectUri;
- }
-
- public void generateClientSecret() {
- this.clientSecret = UUID.randomUUID().toString();
- }
+ public void generateClientSecret() {
+ this.clientSecret = UUID.randomUUID().toString();
+ }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java
index 4be1a81de..008617e76 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAPVP2Config.java
@@ -32,228 +32,247 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
-import iaik.x509.X509Certificate;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OAPVP2;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
-import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.validation.oa.OAPVP2ConfigValidation;
import at.gv.egovernment.moa.util.Base64Utils;
import at.gv.egovernment.moa.util.MiscUtil;
+import iaik.x509.X509Certificate;
+import lombok.extern.slf4j.Slf4j;
-public class OAPVP2Config implements IOnlineApplicationData{
-
- private final Logger log = Logger.getLogger(OAPVP2Config.class);
-
- private boolean reLoad = false;
-
- private String metaDataURL = null;
- private String certificateDN = null;
-
- private File fileUpload = null;
- private String fileUploadContentType;
- private String fileUploadFileName;
-
- private byte[] storedCert = null;
-
- public OAPVP2Config() {
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OAPVP2";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser)
- */
- @Override
- public String store(OnlineApplication dboa, AuthenticatedUser authUser, HttpServletRequest request) {
- AuthComponentOA authoa = dboa.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dboa.setAuthComponentOA(authoa);
- }
- OAPVP2 pvp2 = authoa.getOAPVP2();
- if (pvp2 == null) {
- pvp2 = new OAPVP2();
- authoa.setOAPVP2(pvp2);
- }
+@Slf4j
+public class OAPVP2Config implements IOnlineApplicationData {
+
+ private boolean reLoad = false;
+
+ private String metaDataURL = null;
+ private String certificateDN = null;
+
+ private File fileUpload = null;
+ private String fileUploadContentType;
+ private String fileUploadFileName;
+
+ private byte[] storedCert = null;
+
+ public OAPVP2Config() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OAPVP2";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser)
+ */
+ @Override
+ public String store(OnlineApplication dboa, AuthenticatedUser authUser, HttpServletRequest request) {
+ AuthComponentOA authoa = dboa.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dboa.setAuthComponentOA(authoa);
+ }
+ OAPVP2 pvp2 = authoa.getOAPVP2();
+ if (pvp2 == null) {
+ pvp2 = new OAPVP2();
+ authoa.setOAPVP2(pvp2);
+ }
+
+ try {
+
+ if (getFileUpload() != null) {
+ pvp2.setCertificate(getCertificate());
+ setReLoad(true);
+
+ } else if (storedCert != null) {
+ pvp2.setCertificate(storedCert);
+ }
+
+ } catch (final CertificateException e) {
+ log.info("Uploaded Certificate can not be found", e);
+ return LanguageHelper.getErrorString("validation.pvp2.certificate.notfound", request);
+ } catch (final IOException e) {
+ log.info("Uploaded Certificate can not be parsed", e);
+ return LanguageHelper.getErrorString("validation.pvp2.certificate.format", request);
+ }
+
+ if (getMetaDataURL() != null &&
+ !getMetaDataURL().equals(pvp2.getMetadataURL())) {
+ setReLoad(true);
+ }
+ pvp2.setMetadataURL(getMetaDataURL());
+
+ if (isReLoad()) {
+ pvp2.setUpdateRequiredItem(new Date());
+ }
+
+ return null;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ return new OAPVP2ConfigValidation().validate(this, general.getIdentifier(), request);
+ }
- try {
-
- if (getFileUpload() != null) {
- pvp2.setCertificate(getCertificate());
- setReLoad(true);
-
- } else if (storedCert != null)
- pvp2.setCertificate(storedCert);
-
- } 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);
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ final List<String> errors = new ArrayList<>();
+
+ final AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
+ if (authdata != null) {
+ final OAPVP2 pvp2 = authdata.getOAPVP2();
+ if (pvp2 != null) {
+ metaDataURL = pvp2.getMetadataURL();
+
+ if (pvp2.getCertificate() != null &&
+ !new String(pvp2.getCertificate()).equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT)) {
+ try {
+ // byte[] cert = pvp2.getCertificate();
+ final byte[] cert = Base64Utils.decode(new String(pvp2.getCertificate()), false);
+ if (MiscUtil.isNotEmpty(cert)) {
+ final X509Certificate x509 = new X509Certificate(cert);
+ certificateDN = x509.getSubjectDN().getName();
+ }
+ } catch (final CertificateException e) {
+ try {
+ final byte[] cert = pvp2.getCertificate();
+ if (MiscUtil.isNotEmpty(cert)) {
+ final X509Certificate x509 = new X509Certificate(cert);
+ certificateDN = x509.getSubjectDN().getName();
+ }
+
+ } catch (final CertificateException e1) {
+ log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig
+ .getPublicURLPrefix(), e1);
+ errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request));
+
+ }
+
+ } catch (final IOException e) {
+ log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig
+ .getPublicURLPrefix());
+ errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request));
+ }
}
+ }
+ }
+ return errors;
+ }
- if (getMetaDataURL() != null &&
- !getMetaDataURL().equals(pvp2.getMetadataURL()))
- setReLoad(true);
- pvp2.setMetadataURL(getMetaDataURL());
-
- if (isReLoad())
- pvp2.setUpdateRequiredItem(new Date());
-
- return null;
-
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- return new OAPVP2ConfigValidation().validate(this, general.getIdentifier(), request);
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication)
- */
- @Override
- public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser, HttpServletRequest request) {
- List<String> errors = new ArrayList<String>();
-
- AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
- if (authdata != null) {
- OAPVP2 pvp2 = authdata.getOAPVP2();
- if (pvp2 != null) {
- metaDataURL = pvp2.getMetadataURL();
-
- if (pvp2.getCertificate() != null &&
- !(new String(pvp2.getCertificate())).equals(MOAIDConfigurationConstants.WEBGUI_EMPTY_ELEMENT)) {
- try {
- //byte[] cert = pvp2.getCertificate();
- byte[] cert = Base64Utils.decode(new String(pvp2.getCertificate()), false);
- if (MiscUtil.isNotEmpty(cert)) {
- X509Certificate x509 = new X509Certificate(cert);
- certificateDN = x509.getSubjectDN().getName();
- }
- } catch (CertificateException e) {
- try {
- byte[] cert = pvp2.getCertificate();
- if (MiscUtil.isNotEmpty(cert)) {
- X509Certificate x509 = new X509Certificate(cert);
- certificateDN = x509.getSubjectDN().getName();
- }
-
- } catch (CertificateException e1) {
- log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig.getPublicURLPrefix(), e1);
- errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request));
-
- }
-
- } catch (IOException e) {
- log.warn("PVP2 certificate can not be loaded from Online-Applikation with ID " + dbOAConfig.getPublicURLPrefix());
- errors.add(LanguageHelper.getErrorString("error.oa.pvp2.certificate", request));
- }
- }
- }
- }
- return errors;
- }
-
- public byte[] getCertificate() throws CertificateException, IOException {
-
- FileInputStream filestream = new FileInputStream(fileUpload);
- X509Certificate x509 = new X509Certificate(filestream);
- return x509.getEncoded();
- }
-
- public void setStoredCert(byte[] storedCert) {
- this.storedCert = storedCert;
- }
-
- public String getMetaDataURL() {
- return metaDataURL;
- }
- public void setMetaDataURL(String metaDataURL) {
- this.metaDataURL = metaDataURL;
- }
-
- /**
- * @return the certificateDN
- */
- public String getCertificateDN() {
- return certificateDN;
- }
-
- /**
- * @return the fileUpLoad
- */
- public File getFileUpload() {
- return fileUpload;
- }
-
- /**
- * @param fileUpLoad the fileUpLoad to set
- */
- public void setFileUpload(File fileUpload) {
- this.fileUpload = fileUpload;
- }
-
- /**
- * @return the fileUploadContentType
- */
- public String getFileUploadContentType() {
- return fileUploadContentType;
- }
-
- /**
- * @param fileUploadContentType the fileUploadContentType to set
- */
- public void setFileUploadContentType(String fileUploadContentType) {
- this.fileUploadContentType = fileUploadContentType;
- }
-
- /**
- * @return the fileUploadFileName
- */
- public String getFileUploadFileName() {
- return fileUploadFileName;
- }
-
- /**
- * @param fileUploadFileName the fileUploadFileName to set
- */
- public void setFileUploadFileName(String fileUploadFileName) {
- this.fileUploadFileName = fileUploadFileName;
- }
-
- /**
- * @return the reLoad
- */
- public boolean isReLoad() {
- return reLoad;
- }
-
- /**
- * @param reLoad the reLoad to set
- */
- public void setReLoad(boolean reLoad) {
- this.reLoad = reLoad;
- }
-
-}
+ public byte[] getCertificate() throws CertificateException, IOException {
+
+ final FileInputStream filestream = new FileInputStream(fileUpload);
+ final X509Certificate x509 = new X509Certificate(filestream);
+ return x509.getEncoded();
+ }
+
+ public void setStoredCert(byte[] storedCert) {
+ this.storedCert = storedCert;
+ }
+
+ public String getMetaDataURL() {
+ return metaDataURL;
+ }
+
+ public void setMetaDataURL(String metaDataURL) {
+ this.metaDataURL = metaDataURL;
+ }
+ /**
+ * @return the certificateDN
+ */
+ public String getCertificateDN() {
+ return certificateDN;
+ }
+ /**
+ * @return the fileUpLoad
+ */
+ public File getFileUpload() {
+ return fileUpload;
+ }
+
+ /**
+ * @param fileUpLoad the fileUpLoad to set
+ */
+ public void setFileUpload(File fileUpload) {
+ this.fileUpload = fileUpload;
+ }
+
+ /**
+ * @return the fileUploadContentType
+ */
+ public String getFileUploadContentType() {
+ return fileUploadContentType;
+ }
+
+ /**
+ * @param fileUploadContentType the fileUploadContentType to set
+ */
+ public void setFileUploadContentType(String fileUploadContentType) {
+ this.fileUploadContentType = fileUploadContentType;
+ }
+
+ /**
+ * @return the fileUploadFileName
+ */
+ public String getFileUploadFileName() {
+ return fileUploadFileName;
+ }
+
+ /**
+ * @param fileUploadFileName the fileUploadFileName to set
+ */
+ public void setFileUploadFileName(String fileUploadFileName) {
+ this.fileUploadFileName = fileUploadFileName;
+ }
+
+ /**
+ * @return the reLoad
+ */
+ public boolean isReLoad() {
+ return reLoad;
+ }
+
+ /**
+ * @param reLoad the reLoad to set
+ */
+ public void setReLoad(boolean reLoad) {
+ this.reLoad = reLoad;
+ }
+
+}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java
index 18bebf9d8..76fd31ccd 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OARevisionsLogData.java
@@ -39,113 +39,134 @@ import at.gv.egovernment.moa.util.MiscUtil;
*/
public class OARevisionsLogData implements IOnlineApplicationData {
- private boolean active = false;
- private String eventCodes = null;
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OARevisionsLogging";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA,
- AuthenticatedUser authUser, HttpServletRequest request) {
-
- if (dbOA.getIsRevisionsLogActive() != null)
- active = dbOA.getIsRevisionsLogActive();
-
- if (MiscUtil.isNotEmpty(dbOA.getEventCodes()))
- eventCodes = dbOA.getEventCodes();
-
- return null;
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
-
- dbOA.setIsRevisionsLogActive(active);
-
- if (MiscUtil.isNotEmpty(eventCodes)) {
- dbOA.setEventCodes(KeyValueUtils.normalizeCSVValueString(eventCodes));
-
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- List<String> errors = new ArrayList<String>();
-
- if (active && MiscUtil.isEmpty(eventCodes)) {
- errors.add(LanguageHelper.getErrorString(
- "error.oa.reversion.log.enabled"));
-
- }
-
- if (MiscUtil.isNotEmpty(eventCodes)) {
- String[] codes = eventCodes.split(",");
- for (String el: codes) {
- try {
- Integer.parseInt(el.trim());
-
- } catch (NumberFormatException e) {
- errors.add(LanguageHelper.getErrorString(
- "error.oa.reversion.log.eventcodes"));
- break;
-
- }
-
- }
-
- }
-
- return errors;
- }
-
- /**
- * @return the active
- */
- public boolean isActive() {
- return active;
- }
-
- /**
- * @param active the active to set
- */
- public void setActive(boolean active) {
- this.active = active;
- }
-
- /**
- * @return the eventCodes
- */
- public String getEventCodes() {
- return eventCodes;
- }
-
- /**
- * @param eventCodes the eventCodes to set
- */
- public void setEventCodes(String eventCodes) {
- this.eventCodes = eventCodes;
- }
-
-
+ private boolean active = false;
+ private String eventCodes = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OARevisionsLogging";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+
+ if (dbOA.getIsRevisionsLogActive() != null) {
+ active = dbOA.getIsRevisionsLogActive();
+ }
+
+ if (MiscUtil.isNotEmpty(dbOA.getEventCodes())) {
+ eventCodes = dbOA.getEventCodes();
+ }
+
+ return null;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+
+ dbOA.setIsRevisionsLogActive(active);
+
+ if (MiscUtil.isNotEmpty(eventCodes)) {
+ dbOA.setEventCodes(KeyValueUtils.normalizeCSVValueString(eventCodes));
+
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ final List<String> errors = new ArrayList<>();
+
+ if (active && MiscUtil.isEmpty(eventCodes)) {
+ errors.add(LanguageHelper.getErrorString(
+ "error.oa.reversion.log.enabled"));
+
+ }
+
+ if (MiscUtil.isNotEmpty(eventCodes)) {
+ final String[] codes = eventCodes.split(",");
+ for (final String el : codes) {
+ try {
+ Integer.parseInt(el.trim());
+
+ } catch (final NumberFormatException e) {
+ errors.add(LanguageHelper.getErrorString(
+ "error.oa.reversion.log.eventcodes"));
+ break;
+
+ }
+
+ }
+
+ }
+
+ return errors;
+ }
+
+ /**
+ * @return the active
+ */
+ public boolean isActive() {
+ return active;
+ }
+
+ /**
+ * @param active the active to set
+ */
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ /**
+ * @return the eventCodes
+ */
+ public String getEventCodes() {
+ return eventCodes;
+ }
+
+ /**
+ * @param eventCodes the eventCodes to set
+ */
+ public void setEventCodes(String eventCodes) {
+ this.eventCodes = eventCodes;
+ }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java
index 2922231b3..f1ee853ae 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASAML1Config.java
@@ -33,178 +33,213 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplicati
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.validation.oa.OASAML1ConfigValidation;
-public class OASAML1Config implements IOnlineApplicationData{
-
- private Boolean isActive = false;
- private Boolean provideStammZahl = false;
- private Boolean provideAuthBlock = false;
- private Boolean provideIdentityLink = false;
- private Boolean provideCertificate = false;
- private Boolean provideFullMandateData = false;
- private Boolean useCondition = false;
- private Boolean provideAllErrors = true;
- private int conditionLength = -1;
-
-
- public OASAML1Config() {
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OASAML1";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) {
- AuthComponentOA authdata = dbOA.getAuthComponentOA();
- if (authdata != null) {
- OASAML1 saml1 = authdata.getOASAML1();
- if (saml1 != null) {
- provideAuthBlock = saml1.isProvideAUTHBlock();
- provideCertificate = saml1.isProvideCertificate();
- provideFullMandateData = saml1.isProvideFullMandatorData();
- provideIdentityLink = saml1.isProvideIdentityLink();
- provideStammZahl = saml1.isProvideStammzahl();
-
- if (saml1.isProvideAllErrors() != null)
- provideAllErrors = saml1.isProvideAllErrors();
-
- if (saml1.isUseCondition() != null)
- useCondition = saml1.isUseCondition();
-
- if (saml1.getConditionLength() != null)
- conditionLength = saml1.getConditionLength().intValue();
-
- if (saml1.isIsActive() != null)
- isActive = saml1.isIsActive();
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- return new OASAML1ConfigValidation().validate(this, general, request);
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) {
- AuthComponentOA authoa = dbOA.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dbOA.setAuthComponentOA(authoa);
- }
-
- OASAML1 saml1 = authoa.getOASAML1();
- if (saml1 == null) {
- saml1 = new OASAML1();
- authoa.setOASAML1(saml1);
- saml1.setIsActive(false);
- }
-
- if (authUser.isAdmin()) {
- saml1.setIsActive(isActive());
- }
-
- if (saml1.isIsActive() != null && saml1.isIsActive()) {
- saml1.setProvideAUTHBlock(isProvideAuthBlock());
- saml1.setProvideCertificate(isProvideCertificate());
- saml1.setProvideFullMandatorData(isProvideFullMandateData());
- saml1.setProvideIdentityLink(isProvideIdentityLink());
- saml1.setProvideStammzahl(isProvideStammZahl());
- saml1.setUseCondition(isUseCondition());
- saml1.setProvideAllErrors(provideAllErrors);
- saml1.setConditionLength(BigInteger.valueOf(getConditionLength()));
- // TODO: set sourceID
- // saml1.setSourceID("");
- }
-
- return null;
- }
-
- public boolean isProvideStammZahl() {
- return provideStammZahl;
- }
- public void setProvideStammZahl(boolean provideStammZahl) {
- this.provideStammZahl = provideStammZahl;
- }
- public boolean isProvideAuthBlock() {
- return provideAuthBlock;
- }
- public void setProvideAuthBlock(boolean provideAuthBlock) {
- this.provideAuthBlock = provideAuthBlock;
- }
- public boolean isProvideIdentityLink() {
- return provideIdentityLink;
- }
- public void setProvideIdentityLink(boolean provideIdentityLink) {
- this.provideIdentityLink = provideIdentityLink;
- }
- public boolean isProvideCertificate() {
- return provideCertificate;
- }
- public void setProvideCertificate(boolean provideCertificate) {
- this.provideCertificate = provideCertificate;
- }
- public boolean isProvideFullMandateData() {
- return provideFullMandateData;
- }
- public void setProvideFullMandateData(boolean provideFullMandateData) {
- this.provideFullMandateData = provideFullMandateData;
- }
- public boolean isUseCondition() {
- return useCondition;
- }
- public void setUseCondition(boolean useCondition) {
- this.useCondition = useCondition;
- }
- public int getConditionLength() {
- return conditionLength;
- }
- public void setConditionLength(int conditionLength) {
- this.conditionLength = conditionLength;
- }
-
- /**
- * @return the isActive
- */
- public boolean isActive() {
- return isActive;
- }
-
- /**
- * @param isActive the isActive to set
- */
- public void setActive(boolean isActive) {
- this.isActive = isActive;
- }
-
- /**
- * @return the provideAllErrors
- */
- public Boolean getProvideAllErrors() {
- return provideAllErrors;
- }
-
- /**
- * @param provideAllErrors the provideAllErrors to set
- */
- public void setProvideAllErrors(Boolean provideAllErrors) {
- this.provideAllErrors = provideAllErrors;
- }
-
-
+public class OASAML1Config implements IOnlineApplicationData {
+
+ private Boolean isActive = false;
+ private Boolean provideStammZahl = false;
+ private Boolean provideAuthBlock = false;
+ private Boolean provideIdentityLink = false;
+ private Boolean provideCertificate = false;
+ private Boolean provideFullMandateData = false;
+ private Boolean useCondition = false;
+ private Boolean provideAllErrors = true;
+ private int conditionLength = -1;
+
+ public OASAML1Config() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OASAML1";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) {
+ final AuthComponentOA authdata = dbOA.getAuthComponentOA();
+ if (authdata != null) {
+ final OASAML1 saml1 = authdata.getOASAML1();
+ if (saml1 != null) {
+ provideAuthBlock = saml1.isProvideAUTHBlock();
+ provideCertificate = saml1.isProvideCertificate();
+ provideFullMandateData = saml1.isProvideFullMandatorData();
+ provideIdentityLink = saml1.isProvideIdentityLink();
+ provideStammZahl = saml1.isProvideStammzahl();
+
+ if (saml1.isProvideAllErrors() != null) {
+ provideAllErrors = saml1.isProvideAllErrors();
+ }
+
+ if (saml1.isUseCondition() != null) {
+ useCondition = saml1.isUseCondition();
+ }
+
+ if (saml1.getConditionLength() != null) {
+ conditionLength = saml1.getConditionLength().intValue();
+ }
+
+ if (saml1.isIsActive() != null) {
+ isActive = saml1.isIsActive();
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ return new OASAML1ConfigValidation().validate(this, general, request);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser, HttpServletRequest request) {
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
+
+ OASAML1 saml1 = authoa.getOASAML1();
+ if (saml1 == null) {
+ saml1 = new OASAML1();
+ authoa.setOASAML1(saml1);
+ saml1.setIsActive(false);
+ }
+
+ if (authUser.isAdmin()) {
+ saml1.setIsActive(isActive());
+ }
+
+ if (saml1.isIsActive() != null && saml1.isIsActive()) {
+ saml1.setProvideAUTHBlock(isProvideAuthBlock());
+ saml1.setProvideCertificate(isProvideCertificate());
+ saml1.setProvideFullMandatorData(isProvideFullMandateData());
+ saml1.setProvideIdentityLink(isProvideIdentityLink());
+ saml1.setProvideStammzahl(isProvideStammZahl());
+ saml1.setUseCondition(isUseCondition());
+ saml1.setProvideAllErrors(provideAllErrors);
+ saml1.setConditionLength(BigInteger.valueOf(getConditionLength()));
+ // TODO: set sourceID
+ // saml1.setSourceID("");
+ }
+
+ return null;
+ }
+
+ public boolean isProvideStammZahl() {
+ return provideStammZahl;
+ }
+
+ public void setProvideStammZahl(boolean provideStammZahl) {
+ this.provideStammZahl = provideStammZahl;
+ }
+
+ public boolean isProvideAuthBlock() {
+ return provideAuthBlock;
+ }
+
+ public void setProvideAuthBlock(boolean provideAuthBlock) {
+ this.provideAuthBlock = provideAuthBlock;
+ }
+
+ public boolean isProvideIdentityLink() {
+ return provideIdentityLink;
+ }
+
+ public void setProvideIdentityLink(boolean provideIdentityLink) {
+ this.provideIdentityLink = provideIdentityLink;
+ }
+
+ public boolean isProvideCertificate() {
+ return provideCertificate;
+ }
+
+ public void setProvideCertificate(boolean provideCertificate) {
+ this.provideCertificate = provideCertificate;
+ }
+
+ public boolean isProvideFullMandateData() {
+ return provideFullMandateData;
+ }
+
+ public void setProvideFullMandateData(boolean provideFullMandateData) {
+ this.provideFullMandateData = provideFullMandateData;
+ }
+
+ public boolean isUseCondition() {
+ return useCondition;
+ }
+
+ public void setUseCondition(boolean useCondition) {
+ this.useCondition = useCondition;
+ }
+
+ public int getConditionLength() {
+ return conditionLength;
+ }
+
+ public void setConditionLength(int conditionLength) {
+ this.conditionLength = conditionLength;
+ }
+
+ /**
+ * @return the isActive
+ */
+ public boolean isActive() {
+ return isActive;
+ }
+
+ /**
+ * @param isActive the isActive to set
+ */
+ public void setActive(boolean isActive) {
+ this.isActive = isActive;
+ }
+
+ /**
+ * @return the provideAllErrors
+ */
+ public Boolean getProvideAllErrors() {
+ return provideAllErrors;
+ }
+
+ /**
+ * @param provideAllErrors the provideAllErrors to set
+ */
+ public void setProvideAllErrors(Boolean provideAllErrors) {
+ this.provideAllErrors = provideAllErrors;
+ }
+
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java
index 1baefe4b8..ed0f1c278 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASSOConfig.java
@@ -32,88 +32,104 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplicati
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.validation.oa.OASSOConfigValidation;
-public class OASSOConfig implements IOnlineApplicationData{
-
- private boolean useSSO = false;
- private boolean showAuthDataFrame = true;
- private String singleLogOutURL = null;
-
- public OASSOConfig() {
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OASingleSignOn";
- }
-
- public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser, HttpServletRequest request) {
- AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
- if (authdata != null) {
- OASSO ssoconfig = authdata.getOASSO();
- if(ssoconfig != null) {
- useSSO = ssoconfig.isUseSSO();
- showAuthDataFrame = ssoconfig.isAuthDataFrame();
- singleLogOutURL = ssoconfig.getSingleLogOutURL();
- }
- }
-
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general, AuthenticatedUser authUser,
- HttpServletRequest request) {
- return new OASSOConfigValidation().validate(this, authUser.isAdmin(), request);
- }
-
- public String store(OnlineApplication dboa, AuthenticatedUser authUser, HttpServletRequest request) {
-
- AuthComponentOA authoa = dboa.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dboa.setAuthComponentOA(authoa);
- }
-
- OASSO sso = authoa.getOASSO();
- if (sso == null) {
- sso = new OASSO();
- authoa.setOASSO(sso);
- sso.setAuthDataFrame(true);
- }
- sso.setUseSSO(this.useSSO);
-
- if (authUser.isAdmin())
- sso.setAuthDataFrame(this.showAuthDataFrame);
-
- sso.setSingleLogOutURL(this.singleLogOutURL);
-
- return null;
- }
-
- public boolean isUseSSO() {
- return useSSO;
- }
- public void setUseSSO(boolean useSSO) {
- this.useSSO = useSSO;
- }
- public boolean isShowAuthDataFrame() {
- return showAuthDataFrame;
- }
- public void setShowAuthDataFrame(boolean showAuthDataFrame) {
- this.showAuthDataFrame = showAuthDataFrame;
- }
- public String getSingleLogOutURL() {
- return singleLogOutURL;
- }
- public void setSingleLogOutURL(String singleLogOutURL) {
- this.singleLogOutURL = singleLogOutURL;
- }
+public class OASSOConfig implements IOnlineApplicationData {
+
+ private boolean useSSO = false;
+ private boolean showAuthDataFrame = true;
+ private String singleLogOutURL = null;
+
+ public OASSOConfig() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OASingleSignOn";
+ }
+
+ @Override
+ public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ final AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
+ if (authdata != null) {
+ final OASSO ssoconfig = authdata.getOASSO();
+ if (ssoconfig != null) {
+ useSSO = ssoconfig.isUseSSO();
+ showAuthDataFrame = ssoconfig.isAuthDataFrame();
+ singleLogOutURL = ssoconfig.getSingleLogOutURL();
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ return new OASSOConfigValidation().validate(this, authUser.isAdmin(), request);
+ }
+
+ @Override
+ public String store(OnlineApplication dboa, AuthenticatedUser authUser, HttpServletRequest request) {
+
+ AuthComponentOA authoa = dboa.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dboa.setAuthComponentOA(authoa);
+ }
+
+ OASSO sso = authoa.getOASSO();
+ if (sso == null) {
+ sso = new OASSO();
+ authoa.setOASSO(sso);
+ sso.setAuthDataFrame(true);
+ }
+ sso.setUseSSO(this.useSSO);
+
+ if (authUser.isAdmin()) {
+ sso.setAuthDataFrame(this.showAuthDataFrame);
+ }
+
+ sso.setSingleLogOutURL(this.singleLogOutURL);
+
+ return null;
+ }
+
+ public boolean isUseSSO() {
+ return useSSO;
+ }
+
+ public void setUseSSO(boolean useSSO) {
+ this.useSSO = useSSO;
+ }
+
+ public boolean isShowAuthDataFrame() {
+ return showAuthDataFrame;
+ }
+
+ public void setShowAuthDataFrame(boolean showAuthDataFrame) {
+ this.showAuthDataFrame = showAuthDataFrame;
+ }
+
+ public String getSingleLogOutURL() {
+ return singleLogOutURL;
+ }
+
+ public void setSingleLogOutURL(String singleLogOutURL) {
+ this.singleLogOutURL = singleLogOutURL;
+ }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
index fb096a2a0..82ef9d1d1 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
@@ -27,8 +27,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
import at.gv.egovernment.moa.id.commons.MOAIDConstants;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AttributeProviderPlugin;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentOA;
@@ -44,306 +42,331 @@ import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.validation.oa.OASTORKConfigValidation;
import at.gv.egovernment.moa.util.MiscUtil;
//import at.gv.egovernment.moa.id.protocols.stork2.AttributeProviderFactory;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class OASTORKConfig implements IOnlineApplicationData {
+
+ private boolean isStorkLogonEnabled = false;
+ private String qaa;
+
+ private List<AttributeHelper> attributes = null;
+
+ /*
+ * VIDP settings below
+ */
+ private boolean vidpEnabled = false;
+ private List<AttributeProviderPlugin> attributeProviderPlugins = new ArrayList<>();
+ private boolean requireConsent = false;
+ private final List<String> citizenCountries;
+ private List<String> enabledCitizenCountries;
+
+ private MOAIDConfiguration dbconfig = null;
+
+ public OASTORKConfig() {
+ // fetch available citizen countries
+ citizenCountries = new ArrayList<>();
+ try {
+ dbconfig = ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration();
+
+ for (final CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK()
+ .getCPEPS()) {
+ citizenCountries.add(current.getCountryCode());
+ }
+
+ } catch (final NullPointerException e) {
+
+ } catch (final ConfigurationException e) {
+ log.error("MOA-ID-Configuration initialization FAILED.", e);
+
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OASTORK2";
+ }
+
+ /**
+ * Parses the OA config for stork entities.
+ *
+ * @param dbOAConfig the db oa config
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ final AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
+ if (authdata != null) {
+ final OASTORK config = authdata.getOASTORK();
+ if (config != null) {
+ setStorkLogonEnabled(config.isStorkLogonEnabled());
+
+ try {
+ setQaa(config.geteIDAS_LOA());
+ } catch (final NullPointerException e) {
+ // if there is no configuration available for the OA, get the default qaa level
+ try {
+ setQaa(dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK()
+ .getGeneral_eIDAS_LOA());
+
+ } catch (final NullPointerException e1) {
+ setQaa(MOAIDConstants.eIDAS_LOA_HIGH);
+
+ }
+ }
+
+ enabledCitizenCountries = new ArrayList<>();
+ if (config.getCPEPS() != null) {
+ for (final CPEPS current : config.getCPEPS()) {
+ enabledCitizenCountries.add(current.getCountryCode());
+ }
+ }
-public class OASTORKConfig implements IOnlineApplicationData{
-
- private static final Logger log = Logger.getLogger(OASTORKConfig.class);
-
- private boolean isStorkLogonEnabled = false;
- private String qaa;
-
- private List<AttributeHelper> attributes = null;
-
- /*
- * VIDP settings below
- */
- private boolean vidpEnabled = false;
- private List<AttributeProviderPlugin> attributeProviderPlugins = new ArrayList<AttributeProviderPlugin>();
- private boolean requireConsent = false;
- private List<String> citizenCountries;
- private List<String> enabledCitizenCountries;
-
- private MOAIDConfiguration dbconfig = null;
-
- public OASTORKConfig() {
- // fetch available citizen countries
- citizenCountries = new ArrayList<String>();
- try {
- dbconfig = ConfigurationProvider.getInstance().getDbRead().getMOAIDConfiguration();
-
-
- for(CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) {
- citizenCountries.add(current.getCountryCode());
- }
-
- }catch (NullPointerException e) {
-
- } catch (ConfigurationException e) {
- log.error("MOA-ID-Configuration initialization FAILED.", e);
-
- }
-
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OASTORK2";
- }
-
- /**
- * Parses the OA config for stork entities.
- *
- * @param dbOAConfig
- * the db oa config
- */
- public List<String> parse(OnlineApplication dbOAConfig, AuthenticatedUser authUser, HttpServletRequest request) {
- AuthComponentOA authdata = dbOAConfig.getAuthComponentOA();
- if (authdata != null) {
- OASTORK config = authdata.getOASTORK();
- if(config != null) {
- setStorkLogonEnabled(config.isStorkLogonEnabled());
-
- try {
- setQaa(config.geteIDAS_LOA());
- } catch(NullPointerException e) {
- // if there is no configuration available for the OA, get the default qaa level
- try {
- setQaa(dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getGeneral_eIDAS_LOA());
-
- } catch (NullPointerException e1) {
- setQaa(MOAIDConstants.eIDAS_LOA_HIGH);
-
- }
- }
-
-
- enabledCitizenCountries = new ArrayList<String>();
- if (config.getCPEPS() != null) {
- for(CPEPS current : config.getCPEPS())
- enabledCitizenCountries.add(current.getCountryCode());
- }
-
- // prepare attribute helper list
- attributes = new ArrayList<AttributeHelper>();
- try {
- try {
- for(StorkAttribute current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes()) {
- AttributeHelper tmp = null;
-
- if (config.getOAAttributes() != null) {
- for(OAStorkAttribute sepp : config.getOAAttributes())
- if(sepp.getName() != null && sepp.getName().equals(current.getName()))
- tmp = new AttributeHelper(sepp);
- }
-
- if(null == tmp)
- tmp = new AttributeHelper(current);
-
- attributes.add(tmp);
- }
-
- } catch (NullPointerException ex) {
-
- }
-
- // fetch vidp config
- if (config.isVidpEnabled() != null)
- setVidpEnabled(config.isVidpEnabled());
- else
- setVidpEnabled(false);
-
- if (config.isRequireConsent() != null)
- setRequireConsent(config.isRequireConsent());
- else
- setRequireConsent(false);
-
- attributeProviderPlugins = config.getAttributeProviders();
- // - if no attribute providers are configured, add a dummy
- // TODO this is a dirty hack since we have to have one entry to
- // clone from in the web form. Happens when time is short.
- // Sorry.
- if (attributeProviderPlugins == null || attributeProviderPlugins.isEmpty())
- attributeProviderPlugins.add(new AttributeProviderPlugin());
- } catch (NullPointerException ex) {
- log.error("Nullpointerexception encountered in Configurationinterface", ex);
+ // prepare attribute helper list
+ attributes = new ArrayList<>();
+ try {
+ try {
+ for (final StorkAttribute current : dbconfig.getAuthComponentGeneral().getForeignIdentities()
+ .getSTORK().getAttributes()) {
+ AttributeHelper tmp = null;
+
+ if (config.getOAAttributes() != null) {
+ for (final OAStorkAttribute sepp : config.getOAAttributes()) {
+ if (sepp.getName() != null && sepp.getName().equals(current.getName())) {
+ tmp = new AttributeHelper(sepp);
+ }
}
- }
- }
-
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general, AuthenticatedUser authUser,
- HttpServletRequest request) {
- return new OASTORKConfigValidation().validate(this, request);
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
- AuthComponentOA authoa = dbOA.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dbOA.setAuthComponentOA(authoa);
+ }
+
+ if (null == tmp) {
+ tmp = new AttributeHelper(current);
+ }
+
+ attributes.add(tmp);
+ }
+
+ } catch (final NullPointerException ex) {
+
+ }
+
+ // fetch vidp config
+ if (config.isVidpEnabled() != null) {
+ setVidpEnabled(config.isVidpEnabled());
+ } else {
+ setVidpEnabled(false);
+ }
+
+ if (config.isRequireConsent() != null) {
+ setRequireConsent(config.isRequireConsent());
+ } else {
+ setRequireConsent(false);
+ }
+
+ attributeProviderPlugins = config.getAttributeProviders();
+ // - if no attribute providers are configured, add a dummy
+ // TODO this is a dirty hack since we have to have one entry to
+ // clone from in the web form. Happens when time is short.
+ // Sorry.
+ if (attributeProviderPlugins == null || attributeProviderPlugins.isEmpty()) {
+ attributeProviderPlugins.add(new AttributeProviderPlugin());
+ }
+ } catch (final NullPointerException ex) {
+ log.error("Nullpointerexception encountered in Configurationinterface", ex);
}
-
- // 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);
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ return new OASTORKConfigValidation().validate(this, request);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
+
+ // 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(isStorkLogonEnabled());
+ stork.seteIDAS_LOA(getQaa());
+ stork.setOAAttributes(getAttributes());
+ stork.setVidpEnabled(isVidpEnabled());
+ stork.setRequireConsent(isRequireConsent());
+ stork.setAttributeProviders(getAttributeProviderPlugins());
+ stork.setCPEPS(getEnabledCPEPS());
+
+ return null;
+
+ }
+
+ public boolean isStorkLogonEnabled() {
+ return isStorkLogonEnabled;
+ }
+
+ public void setStorkLogonEnabled(boolean enabled) {
+ this.isStorkLogonEnabled = enabled;
+ }
+
+ public String getQaa() {
+ return qaa;
+ }
+
+ public void setQaa(String qaa) {
+ this.qaa = qaa;
+ }
+
+ public List<OAStorkAttribute> getAttributes() {
+ final List<OAStorkAttribute> result = new ArrayList<>();
+
+ if (null == getHelperAttributes()) {
+ return result;
+ }
+
+ for (final AttributeHelper current : getHelperAttributes()) {
+ List<StorkAttribute> generalConfStorkAttr = null;
+ try {
+ generalConfStorkAttr = dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK()
+ .getAttributes();
+
+ } catch (final NullPointerException e) {
+ log.trace("No STORK attributes in 'General Configuration'");
+
+ }
+
+ if (generalConfStorkAttr != null) {
+ for (final StorkAttribute currentAttribute : generalConfStorkAttr) {
+ if (MiscUtil.isNotEmpty(currentAttribute.getName()) &&
+ currentAttribute.getName().equals(current.getName())) {
+ if (current.isUsed() || currentAttribute.isMandatory()) {
+ final OAStorkAttribute tmp = new OAStorkAttribute();
+ tmp.setName(current.getName());
+ tmp.setMandatory(current.isMandatory());
+ result.add(tmp);
+
+ }
+ break;
+ }
}
- // transfer the incoming data to the database model
- stork.setStorkLogonEnabled(isStorkLogonEnabled());
- stork.seteIDAS_LOA(getQaa());
- stork.setOAAttributes(getAttributes());
- stork.setVidpEnabled(isVidpEnabled());
- stork.setRequireConsent(isRequireConsent());
- stork.setAttributeProviders(getAttributeProviderPlugins());
- stork.setCPEPS(getEnabledCPEPS());
-
- return null;
-
- }
-
- public boolean isStorkLogonEnabled() {
- return isStorkLogonEnabled;
- }
-
- public void setStorkLogonEnabled(boolean enabled) {
- this.isStorkLogonEnabled = enabled;
- }
-
- public String getQaa() {
- return qaa;
- }
-
- public void setQaa(String qaa) {
- this.qaa = qaa;
- }
-
- public List<OAStorkAttribute> getAttributes() {
- List<OAStorkAttribute> result = new ArrayList<OAStorkAttribute>();
-
- if(null == getHelperAttributes())
- return result;
-
- for(AttributeHelper current : getHelperAttributes()) {
- List<StorkAttribute> generalConfStorkAttr = null;
- try {
- generalConfStorkAttr = dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes();
-
- } catch (NullPointerException e) {
- log.trace("No STORK attributes in 'General Configuration'");
-
- }
-
- if (generalConfStorkAttr != null) {
- for(StorkAttribute currentAttribute : generalConfStorkAttr)
- if(MiscUtil.isNotEmpty(currentAttribute.getName()) &&
- currentAttribute.getName().equals(current.getName())) {
- if(current.isUsed() || currentAttribute.isMandatory()) {
- OAStorkAttribute tmp = new OAStorkAttribute();
- tmp.setName(current.getName());
- tmp.setMandatory(current.isMandatory());
- result.add(tmp);
-
- }
- break;
- }
- }
- }
-
- return result;
- }
-
- public List<AttributeHelper> getHelperAttributes() {
- return attributes;
- }
-
- public void setHelperAttributes(List<AttributeHelper> attributes) {
- this.attributes = attributes;
- }
-
- public List<String> getAvailableCitizenCountries() {
- return citizenCountries;
- }
-
-
- public List<String> getAllowedLoALevels() {
- return MOAIDConstants.ALLOWED_eIDAS_LOA;
- }
-
- public List<String> getEnabledCitizenCountries() {
- return enabledCitizenCountries;
- }
-
- public void setEnabledCitizenCountries(List<String> update) {
- enabledCitizenCountries = update;
- }
-
- public List<CPEPS> getEnabledCPEPS() {
- if (enabledCitizenCountries != null) {
- List<CPEPS> result = new ArrayList<CPEPS>();
-
- try {
- for(CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) {
- if(enabledCitizenCountries.contains(current.getCountryCode()))
- result.add(current);
- }
-
- } catch (NullPointerException e){
-
- }
- return result;
- }
-
- return null;
-
- }
-
- public List<String> getAvailableAttributeProviderPlugins() {
- //TODO: remove in final version
-
- return new ArrayList<String>();
- //return AttributeProviderFactory.getAvailablePlugins();
- }
-
- public List<AttributeProviderPlugin> getAttributeProviderPlugins() {
- return attributeProviderPlugins;
- }
-
- public void setAttributeProviderPlugins(List<AttributeProviderPlugin> update) {
- attributeProviderPlugins = update;
- }
-
- public boolean isVidpEnabled() {
- return vidpEnabled;
- }
-
- public void setVidpEnabled(boolean update) {
- vidpEnabled = update;
- }
-
- public boolean isRequireConsent() {
- return requireConsent;
- }
-
- public void setRequireConsent(boolean update) {
- requireConsent = update;
- }
+ }
+ }
+
+ return result;
+ }
+
+ public List<AttributeHelper> getHelperAttributes() {
+ return attributes;
+ }
+
+ public void setHelperAttributes(List<AttributeHelper> attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<String> getAvailableCitizenCountries() {
+ return citizenCountries;
+ }
+
+ public List<String> getAllowedLoALevels() {
+ return MOAIDConstants.ALLOWED_eIDAS_LOA;
+ }
+
+ public List<String> getEnabledCitizenCountries() {
+ return enabledCitizenCountries;
+ }
+
+ public void setEnabledCitizenCountries(List<String> update) {
+ enabledCitizenCountries = update;
+ }
+
+ public List<CPEPS> getEnabledCPEPS() {
+ if (enabledCitizenCountries != null) {
+ final List<CPEPS> result = new ArrayList<>();
+
+ try {
+ for (final CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK()
+ .getCPEPS()) {
+ if (enabledCitizenCountries.contains(current.getCountryCode())) {
+ result.add(current);
+ }
+ }
+
+ } catch (final NullPointerException e) {
+
+ }
+ return result;
+ }
+
+ return null;
+
+ }
+
+ public List<String> getAvailableAttributeProviderPlugins() {
+ // TODO: remove in final version
+
+ return new ArrayList<>();
+ // return AttributeProviderFactory.getAvailablePlugins();
+ }
+
+ public List<AttributeProviderPlugin> getAttributeProviderPlugins() {
+ return attributeProviderPlugins;
+ }
+
+ public void setAttributeProviderPlugins(List<AttributeProviderPlugin> update) {
+ attributeProviderPlugins = update;
+ }
+
+ public boolean isVidpEnabled() {
+ return vidpEnabled;
+ }
+
+ public void setVidpEnabled(boolean update) {
+ vidpEnabled = update;
+ }
+
+ public boolean isRequireConsent() {
+ return requireConsent;
+ }
+
+ public void setRequireConsent(boolean update) {
+ requireConsent = update;
+ }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java
index 84516c73f..be1b937f0 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OATargetConfiguration.java
@@ -43,464 +43,473 @@ import at.gv.egovernment.moa.util.MiscUtil;
*/
public class OATargetConfiguration implements IOnlineApplicationData {
- 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;
-
- private String foreignbPKTargets = null;
- private String additionalbPKTargets = null;
- private boolean eidDemoActive = 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;
+
+ private String foreignbPKTargets = null;
+ private String additionalbPKTargets = null;
+ private boolean eidDemoActive = false;
private boolean eidProxyActive = false;
-
- public OATargetConfiguration() {
- targetList = TargetValidator.getListOfTargets();
- target = "";
-
- identificationTypeList = Arrays.asList(
- Constants.IDENIFICATIONTYPE_FN,
- Constants.IDENIFICATIONTYPE_ZVR,
- Constants.IDENIFICATIONTYPE_ERSB,
- Constants.IDENIFICATIONTYPE_STORK,
- Constants.IDENIFICATIONTYPE_EIDAS);
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "OATargetConfig";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA,
- AuthenticatedUser authUser, HttpServletRequest request) {
- String target_full = dbOA.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];
- subTargetSet = true;
- }
-
- } else {
- target = "";
- target_subsector = null;
- target_admin = target_full;
- isAdminTarget = true;
- }
- }
- targetFriendlyName = dbOA.getTargetFriendlyName();
- }
-
- AuthComponentOA oaauth = dbOA.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_EIDAS.startsWith(split[0]) && split.length >= 2) {
- //identificationType = split[1]; // setting at as iden category ?
- identificationType = Constants.IDENIFICATIONTYPE_EIDAS;
- identificationNumber = split[1] + "+" + split[2]; // setting sp country as ident type -> sp ident
-
- } 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();
-
- identificationType = authUser.getBusinessServiceType();
- identificationNumber = authUser.getBusinessServiceNumber();
-
- }
-
- }
- }
-
-
- //parse foreign bPK sector list
- if (dbOA.getForeignbPKTargetList() != null) {
- if (KeyValueUtils.isCSVValueString(dbOA.getForeignbPKTargetList()))
- foreignbPKTargets = KeyValueUtils.normalizeCSVValueString(dbOA.getForeignbPKTargetList());
-
- else {
- if (dbOA.getForeignbPKTargetList().contains(KeyValueUtils.CSV_DELIMITER)) {
- //remove trailing comma if exist
- foreignbPKTargets = dbOA.getForeignbPKTargetList().substring(0,
- dbOA.getForeignbPKTargetList().indexOf(KeyValueUtils.CSV_DELIMITER));
-
- } else
- foreignbPKTargets = dbOA.getForeignbPKTargetList();
-
- }
- }
-
- //parse additional bPK sector list
- if (dbOA.getAdditionalbPKTargetList() != null) {
- if (KeyValueUtils.isCSVValueString(dbOA.getAdditionalbPKTargetList()))
- additionalbPKTargets = KeyValueUtils.normalizeCSVValueString(dbOA.getAdditionalbPKTargetList());
-
- else {
- if (dbOA.getAdditionalbPKTargetList().contains(KeyValueUtils.CSV_DELIMITER)) {
- //remove trailing comma if exist
- additionalbPKTargets = dbOA.getAdditionalbPKTargetList().substring(0,
- dbOA.getAdditionalbPKTargetList().indexOf(KeyValueUtils.CSV_DELIMITER));
-
- } else
- additionalbPKTargets = dbOA.getAdditionalbPKTargetList();
-
- }
- }
-
- //parse 'Austrian eID mode' flag
- eidDemoActive = dbOA.getIseIDDemoModeActive();
- eidProxyActive = dbOA.getIseIDProxyModeActive();
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
-
- AuthComponentOA authoa = dbOA.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dbOA.setAuthComponentOA(authoa);
+
+ public OATargetConfiguration() {
+ targetList = TargetValidator.getListOfTargets();
+ target = "";
+
+ identificationTypeList = Arrays.asList(
+ Constants.IDENIFICATIONTYPE_FN,
+ Constants.IDENIFICATIONTYPE_ZVR,
+ Constants.IDENIFICATIONTYPE_ERSB,
+ Constants.IDENIFICATIONTYPE_STORK,
+ Constants.IDENIFICATIONTYPE_EIDAS);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "OATargetConfig";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ final String target_full = dbOA.getTarget();
+ if (MiscUtil.isNotEmpty(target_full)) {
+ if (TargetValidator.isValidTarget(target_full)) {
+ target = target_full;
+
+ } else {
+ final 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];
+ subTargetSet = true;
+ }
+
+ } else {
+ target = "";
+ target_subsector = null;
+ target_admin = target_full;
+ isAdminTarget = true;
+ }
+ }
+ targetFriendlyName = dbOA.getTargetFriendlyName();
+ }
+
+ final AuthComponentOA oaauth = dbOA.getAuthComponentOA();
+ if (oaauth != null) {
+
+ final IdentificationNumber idnumber = oaauth.getIdentificationNumber();
+ if (idnumber != null) {
+ final String number = idnumber.getValue();
+ if (MiscUtil.isNotEmpty(number)) {
+ final String[] split = number.split("\\+");
+
+ if (Constants.PREFIX_WPBK.startsWith(split[0]) && split.length >= 2) {
+ identificationType = split[1];
+ identificationNumber = split[2];
+
+ } else if (Constants.PREFIX_EIDAS.startsWith(split[0]) && split.length >= 2) {
+ // identificationType = split[1]; // setting at as iden category ?
+ identificationType = Constants.IDENIFICATIONTYPE_EIDAS;
+ identificationNumber = split[1] + "+" + split[2]; // setting sp country as ident type -> sp ident
+
+ } 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 (isBusinessService(dbOA) || authUser.isOnlyBusinessService()) {
-
- dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
-
- String num = null;
- if (authUser.isOnlyBusinessService()) {
- deaktivededBusinessService = 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);
-
- /*Fixme:
- * Company numbers had to be padded with '0' on left site
- * But this bugfix can not be activated, because this would
- * change all bPKs for company numbers.
- *
- * Change this in case of new bPK generation algorithms
- */
- // 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 = authoa.getIdentificationNumber();
- if (idnumber == null)
- idnumber = new IdentificationNumber();
-
- if (getIdentificationType().equals(Constants.IDENIFICATIONTYPE_EIDAS)) {
- idnumber.setValue(Constants.PREFIX_EIDAS + num);
- idnumber.setType(Constants.BUSINESSSERVICENAMES.get(getIdentificationType()));
-
- } else 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);
+
+ if (authUser.isOnlyBusinessService()) {
+ deaktivededBusinessService = authUser.isOnlyBusinessService();
+
+ identificationType = authUser.getBusinessServiceType();
+ identificationNumber = authUser.getBusinessServiceNumber();
+
+ }
+
+ }
+ }
+
+ // parse foreign bPK sector list
+ if (dbOA.getForeignbPKTargetList() != null) {
+ if (KeyValueUtils.isCSVValueString(dbOA.getForeignbPKTargetList())) {
+ foreignbPKTargets = KeyValueUtils.normalizeCSVValueString(dbOA.getForeignbPKTargetList());
+ } else {
+ if (dbOA.getForeignbPKTargetList().contains(KeyValueUtils.CSV_DELIMITER)) {
+ // remove trailing comma if exist
+ foreignbPKTargets = dbOA.getForeignbPKTargetList().substring(0,
+ dbOA.getForeignbPKTargetList().indexOf(KeyValueUtils.CSV_DELIMITER));
} else {
- dbOA.setType(null);
+ foreignbPKTargets = dbOA.getForeignbPKTargetList();
+ }
+
+ }
+ }
- if (authUser.isAdmin()) {
- if (MiscUtil.isNotEmpty(getTarget_admin()) && isAdminTarget()) {
- dbOA.setTarget(getTarget_admin());
- dbOA.setTargetFriendlyName(getTargetFriendlyName());
+ // parse additional bPK sector list
+ if (dbOA.getAdditionalbPKTargetList() != null) {
+ if (KeyValueUtils.isCSVValueString(dbOA.getAdditionalbPKTargetList())) {
+ additionalbPKTargets = KeyValueUtils.normalizeCSVValueString(dbOA.getAdditionalbPKTargetList());
+ } else {
+ if (dbOA.getAdditionalbPKTargetList().contains(KeyValueUtils.CSV_DELIMITER)) {
+ // remove trailing comma if exist
+ additionalbPKTargets = dbOA.getAdditionalbPKTargetList().substring(0,
+ dbOA.getAdditionalbPKTargetList().indexOf(KeyValueUtils.CSV_DELIMITER));
- } else {
+ } else {
+ additionalbPKTargets = dbOA.getAdditionalbPKTargetList();
+ }
- String target = getTarget();
+ }
+ }
- if (MiscUtil.isNotEmpty(getTarget_subsector()) && subTargetSet)
- dbOA.setTarget(target + "-" + getTarget_subsector());
- else
- dbOA.setTarget(target);
+ // parse 'Austrian eID mode' flag
+ eidDemoActive = dbOA.getIseIDDemoModeActive();
+ eidProxyActive = dbOA.getIseIDProxyModeActive();
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dbOA.setTargetFriendlyName(targetname);
+ if (isBusinessService(dbOA) || authUser.isOnlyBusinessService()) {
- }
+ dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
- } else {
+ String num = null;
+ if (authUser.isOnlyBusinessService()) {
+ deaktivededBusinessService = authUser.isOnlyBusinessService();
+ num = authUser.getBusinessServiceType() + authUser.getBusinessServiceNumber();
- if (MiscUtil.isNotEmpty(getTarget())) {
+ } else {
- String target = getTarget();
+ num = getIdentificationNumber().replaceAll(" ", "");
+ if (num.startsWith(Constants.IDENIFICATIONTYPE_FN)) {
+ num = num.substring(Constants.IDENIFICATIONTYPE_FN.length());
- if (MiscUtil.isNotEmpty(getTarget_subsector()) && subTargetSet)
- dbOA.setTarget(target + "-" + getTarget_subsector());
+ num = at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(num);
- else
- dbOA.setTarget(target);
+ /*
+ * Fixme: Company numbers had to be padded with '0' on left site But this bugfix
+ * can not be activated, because this would change all bPKs for company numbers.
+ *
+ * Change this in case of new bPK generation algorithms
+ */
+ // num = StringUtils.leftPad(num, 7, '0');
+ }
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dbOA.setTargetFriendlyName(targetname);
+ 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());
}
-
- dbOA.setForeignbPKTargetList(getForeignbPKTargets());
- dbOA.setAdditionalbPKTargetList(getAdditionalbPKTargets());
- dbOA.setIseIDDemoModeActive(isEidDemoActive());
- dbOA.setIseIDProxyModeActive(isEidProxyActive());
-
- return null;
- }
-
- /**
- * @return
- */
- private boolean isBusinessService(OnlineApplication dbOA) {
- if (dbOA.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE))
- return true;
- else
- return false;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
- return new OATargetConfigValidation().validate(this, authUser.isAdmin(), general, request);
- }
-
- 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;
- }
-
- /**
- * @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;
- }
+ }
+ IdentificationNumber idnumber = authoa.getIdentificationNumber();
+ if (idnumber == null) {
+ idnumber = new IdentificationNumber();
+ }
- /**
- * @param deaktivededBusinessService the deaktivededBusinessService to set
- */
- public void setDeaktivededBusinessService(boolean deaktivededBusinessService) {
- this.deaktivededBusinessService = deaktivededBusinessService;
- }
+ if (getIdentificationType().equals(Constants.IDENIFICATIONTYPE_EIDAS)) {
+ idnumber.setValue(Constants.PREFIX_EIDAS + num);
+ idnumber.setType(Constants.BUSINESSSERVICENAMES.get(getIdentificationType()));
+ } else 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()));
+ }
- /**
- * @return the subTargetSet
- */
- public boolean isSubTargetSet() {
- return subTargetSet;
- }
+ authoa.setIdentificationNumber(idnumber);
+ } else {
+ dbOA.setType(null);
- /**
- * @param subTargetSet the subTargetSet to set
- */
- public void setSubTargetSet(boolean subTargetSet) {
- this.subTargetSet = subTargetSet;
- }
+ if (authUser.isAdmin()) {
+ if (MiscUtil.isNotEmpty(getTarget_admin()) && isAdminTarget()) {
+ dbOA.setTarget(getTarget_admin());
+ dbOA.setTargetFriendlyName(getTargetFriendlyName());
+ } else {
- public String getForeignbPKTargets() {
- return foreignbPKTargets;
- }
+ final String target = getTarget();
+ if (MiscUtil.isNotEmpty(getTarget_subsector()) && subTargetSet) {
+ dbOA.setTarget(target + "-" + getTarget_subsector());
+ } else {
+ dbOA.setTarget(target);
+ }
- public void setForeignbPKTargets(String foreignbPKTargets) {
- if (MiscUtil.isNotEmpty(foreignbPKTargets))
- this.foreignbPKTargets =
- KeyValueUtils.removeAllNewlineFromString(foreignbPKTargets);
- else
- this.foreignbPKTargets = foreignbPKTargets;
- }
+ final String targetname = TargetValidator.getTargetFriendlyName(target);
+ if (MiscUtil.isNotEmpty(targetname)) {
+ dbOA.setTargetFriendlyName(targetname);
+ }
+ }
+
+ } else {
+
+ if (MiscUtil.isNotEmpty(getTarget())) {
- public String getAdditionalbPKTargets() {
- return additionalbPKTargets;
- }
+ final String target = getTarget();
+ if (MiscUtil.isNotEmpty(getTarget_subsector()) && subTargetSet) {
+ dbOA.setTarget(target + "-" + getTarget_subsector());
+ } else {
+ dbOA.setTarget(target);
+ }
- public void setAdditionalbPKTargets(String additionalbPKTargets) {
- if (MiscUtil.isNotEmpty(additionalbPKTargets))
- this.additionalbPKTargets =
- KeyValueUtils.removeAllNewlineFromString(additionalbPKTargets);
- else
- this.additionalbPKTargets = additionalbPKTargets;
+ final String targetname = TargetValidator.getTargetFriendlyName(target);
+ if (MiscUtil.isNotEmpty(targetname)) {
+ dbOA.setTargetFriendlyName(targetname);
+ }
- }
+ }
+ }
+ }
+
+ dbOA.setForeignbPKTargetList(getForeignbPKTargets());
+ dbOA.setAdditionalbPKTargetList(getAdditionalbPKTargets());
+ dbOA.setIseIDDemoModeActive(isEidDemoActive());
+ dbOA.setIseIDProxyModeActive(isEidProxyActive());
+
+ return null;
+ }
+
+ /**
+ * @return
+ */
+ private boolean isBusinessService(OnlineApplication dbOA) {
+ if (dbOA.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+ return new OATargetConfigValidation().validate(this, authUser.isAdmin(), general, request);
+ }
+
+ 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;
+ }
+
+ /**
+ * @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;
+ }
+
+ /**
+ * @return the subTargetSet
+ */
+ public boolean isSubTargetSet() {
+ return subTargetSet;
+ }
+
+ /**
+ * @param subTargetSet the subTargetSet to set
+ */
+ public void setSubTargetSet(boolean subTargetSet) {
+ this.subTargetSet = subTargetSet;
+ }
+
+ public String getForeignbPKTargets() {
+ return foreignbPKTargets;
+ }
+
+ public void setForeignbPKTargets(String foreignbPKTargets) {
+ if (MiscUtil.isNotEmpty(foreignbPKTargets)) {
+ this.foreignbPKTargets =
+ KeyValueUtils.removeAllNewlineFromString(foreignbPKTargets);
+ } else {
+ this.foreignbPKTargets = foreignbPKTargets;
+ }
+ }
+
+ public String getAdditionalbPKTargets() {
+ return additionalbPKTargets;
+ }
+
+ public void setAdditionalbPKTargets(String additionalbPKTargets) {
+ if (MiscUtil.isNotEmpty(additionalbPKTargets)) {
+ this.additionalbPKTargets =
+ KeyValueUtils.removeAllNewlineFromString(additionalbPKTargets);
+ } else {
+ this.additionalbPKTargets = additionalbPKTargets;
+ }
+ }
- public boolean isEidDemoActive() {
- return eidDemoActive;
- }
+ public boolean isEidDemoActive() {
+ return eidDemoActive;
+ }
+ public void setEidDemoActive(boolean eidDemoActive) {
+ this.eidDemoActive = eidDemoActive;
+ }
- public void setEidDemoActive(boolean eidDemoActive) {
- this.eidDemoActive = eidDemoActive;
- }
-
- public boolean isEidProxyActive() {
- return eidProxyActive;
- }
+ public boolean isEidProxyActive() {
+ return eidProxyActive;
+ }
+ public void setEidProxyActive(boolean eidProxyActive) {
+ this.eidProxyActive = eidProxyActive;
+ }
- public void setEidProxyActive(boolean eidProxyActive) {
- this.eidProxyActive = eidProxyActive;
- }
-
-
-
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java
index e27c55c90..29598a679 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java
@@ -27,110 +27,128 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.InterfederationGatewayType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.InterfederationIDPType;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
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.helper.LanguageHelper;
import at.gv.egovernment.moa.util.MiscUtil;
+import lombok.extern.slf4j.Slf4j;
/**
* @author tlenz
*
*/
+@Slf4j
public class PVPGatewayInterfederationConfig implements IOnlineApplicationData {
- private static final Logger log = Logger.getLogger(PVPGatewayInterfederationConfig.class);
-
- private String entityID = null;
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
- */
- @Override
- public String getName() {
- return "PVPGatewayInterfederation";
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> parse(OnlineApplication dbOA,
- AuthenticatedUser authUser, HttpServletRequest request) {
-
- InterfederationGatewayType gateway = dbOA.getInterfederationGateway();
- if (gateway != null) {
- this.entityID = gateway.getForwardIDPIdentifier();
-
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
- HttpServletRequest request) {
-
- if (authUser.isAdmin()) {
- dbOA.setIsInterfederationGateway(true);
-
- InterfederationGatewayType gateway = dbOA.getInterfederationGateway();
- if (gateway == null) {
- gateway = new InterfederationGatewayType();
- dbOA.setInterfederationGateway(gateway);
- }
-
- gateway.setForwardIDPIdentifier(entityID);
- }
-
- dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest)
- */
- @Override
- public List<String> validate(OAGeneralConfig general,
- AuthenticatedUser authUser, HttpServletRequest request) {
-
- List<String> errors = new ArrayList<String>();
-
- if (MiscUtil.isNotEmpty(entityID)) {
- if (!ValidationHelper.validateURL(entityID)) {
- log.info("PVP gateway EntityID is not valid");
- errors.add(LanguageHelper.getErrorString("validation.interfederation.gateway.entityID.valid", request));
-
- }
-
- } else
- errors.add(LanguageHelper.getErrorString("validation.interfederation.gateway.entityID.empty", request));
-
- return errors;
- }
-
- /**
- * @return the entityID
- */
- public String getEntityID() {
- return entityID;
- }
-
- /**
- * @param entityID the entityID to set
- */
- public void setEntityID(String entityID) {
- this.entityID = entityID;
- }
-
-
-
+ private String entityID = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName
+ * ()
+ */
+ @Override
+ public String getName() {
+ return "PVPGatewayInterfederation";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> parse(OnlineApplication dbOA,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+
+ final InterfederationGatewayType gateway = dbOA.getInterfederationGateway();
+ if (gateway != null) {
+ this.entityID = gateway.getForwardIDPIdentifier();
+
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(
+ * at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public String store(OnlineApplication dbOA, AuthenticatedUser authUser,
+ HttpServletRequest request) {
+
+ if (authUser.isAdmin()) {
+ dbOA.setIsInterfederationGateway(true);
+
+ InterfederationGatewayType gateway = dbOA.getInterfederationGateway();
+ if (gateway == null) {
+ gateway = new InterfederationGatewayType();
+ dbOA.setInterfederationGateway(gateway);
+ }
+
+ gateway.setForwardIDPIdentifier(entityID);
+ }
+
+ dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#
+ * validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig,
+ * at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public List<String> validate(OAGeneralConfig general,
+ AuthenticatedUser authUser, HttpServletRequest request) {
+
+ final List<String> errors = new ArrayList<>();
+
+ if (MiscUtil.isNotEmpty(entityID)) {
+ if (!ValidationHelper.validateURL(entityID)) {
+ log.info("PVP gateway EntityID is not valid");
+ errors.add(LanguageHelper.getErrorString("validation.interfederation.gateway.entityID.valid",
+ request));
+
+ }
+
+ } else {
+ errors.add(LanguageHelper.getErrorString("validation.interfederation.gateway.entityID.empty", request));
+ }
+
+ return errors;
+ }
+
+ /**
+ * @return the entityID
+ */
+ public String getEntityID() {
+ return entityID;
+ }
+
+ /**
+ * @param entityID the entityID to set
+ */
+ public void setEntityID(String entityID) {
+ this.entityID = entityID;
+ }
+
}