aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java199
1 files changed, 186 insertions, 13 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
index 90d79a46d..946f0a9c4 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/data/AuthenticationSession.java
@@ -1,8 +1,13 @@
package at.gv.egovernment.moa.id.auth.data;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+import at.gv.egovernment.moa.id.auth.validator.InfoboxValidator;
+import at.gv.egovernment.moa.id.auth.validator.parep.ParepUtils;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.Constants;
@@ -15,6 +20,7 @@ import at.gv.egovernment.moa.util.Constants;
public class AuthenticationSession {
private static String TARGET_PREFIX_ = Constants.URN_PREFIX_CDID + "+";
+ private static String REGISTERANDORDNR_PREFIX_ = Constants.URN_PREFIX_WBPK + "+";
/**
* session ID
@@ -37,14 +43,14 @@ public class AuthenticationSession {
* URL of MOA ID authentication component
*/
private String authURL;
- /**
- * HTML template URL
- */
- private String templateURL;
- /**
- * URL of the BKU
- */
- private String bkuURL;
+ /**
+ * HTML template URL
+ */
+ private String templateURL;
+ /**
+ * URL of the BKU
+ */
+ private String bkuURL;
/**
* identity link read from smartcard
*/
@@ -61,11 +67,11 @@ public class AuthenticationSession {
* timestamp logging when identity link has been received
*/
private Date timestampIdentityLink;
- /**
- * Indicates whether the corresponding online application is a business
- * service or not
- */
- private boolean businessService;
+ /**
+ * Indicates whether the corresponding online application is a business
+ * service or not
+ */
+ private boolean businessService;
/**
* SAML attributes from an extended infobox validation to be appended
@@ -91,6 +97,33 @@ public class AuthenticationSession {
private String issueInstant;
/**
+ * If infobox validators are needed after signing, they can be stored in
+ * this list.
+ */
+ private List infoboxValidators;
+
+ /**
+ * The register and number in the register parameter in case of a business
+ * service application.
+ */
+ private String domainIdentifier;
+
+ /**
+ * This string contains all identifiers of infoboxes, the online application
+ * is configured to accept. The infobox identifiers are comma separated.
+ */
+ private String pushInfobox;
+
+ /**
+ * AppSpecificConfiguration entry of then mandates infobox-validator. Tells
+ * whether person data from the representative have to be exchanged by data
+ * from the mandate
+ */
+ private boolean mandateCompatibilityMode = false;
+
+
+
+ /**
* Constructor for AuthenticationSession.
*
* @param id Session ID
@@ -98,6 +131,7 @@ public class AuthenticationSession {
public AuthenticationSession(String id) {
sessionID = id;
setTimestampStart();
+ infoboxValidators = new ArrayList();
}
/**
@@ -380,4 +414,143 @@ public class AuthenticationSession {
this.issueInstant = issueInstant;
}
+ /**
+ * Returns the iterator to the stored infobox validators.
+ * @return Iterator
+ */
+ public Iterator getInfoboxValidatorIterator() {
+ if (infoboxValidators==null) return null;
+ return infoboxValidators.iterator();
+ }
+
+ /**
+ * Adds an infobox validator class to the stored infobox validators.
+ * @param infoboxIdentifier the identifier of the infobox the validator belongs to
+ * @param infoboxFriendlyName the friendly name of the infobox
+ * @param infoboxValidator the infobox validator to add
+ */
+ public Iterator addInfoboxValidator(String infoboxIdentifier, String infoboxFriendlyName, InfoboxValidator infoboxValidator) {
+ if (infoboxValidators==null) infoboxValidators = new ArrayList();
+ Vector v = new Vector(3);
+ v.add(infoboxIdentifier);
+ v.add(infoboxFriendlyName);
+ v.add(infoboxValidator);
+ infoboxValidators.add(v);
+ return infoboxValidators.iterator();
+ }
+
+ /**
+ * Tests for pending input events of the infobox validators.
+ * @return true if a validator has a form to show
+ */
+ public boolean isValidatorInputPending() {
+ boolean result = false;
+ Iterator iter = getInfoboxValidatorIterator();
+ if (iter != null) {
+ while (!result && iter.hasNext()) {
+ Vector infoboxValidatorVector = (Vector) iter.next();
+ InfoboxValidator infoboxvalidator = (InfoboxValidator) infoboxValidatorVector.get(2);
+ if (!ParepUtils.isEmpty(infoboxvalidator.getForm())) result=true;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the first pending infobox validator.
+ * @return the infobox validator class
+ */
+ public InfoboxValidator getFirstPendingValidator() {
+ Iterator iter = getInfoboxValidatorIterator();
+ if (iter != null) {
+ while (iter.hasNext()) {
+ Vector infoboxValidatorVector = (Vector) iter.next();
+ InfoboxValidator infoboxvalidator = (InfoboxValidator) infoboxValidatorVector.get(2);
+ String form = infoboxvalidator.getForm();
+ if (!ParepUtils.isEmpty(form)) return infoboxvalidator;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the input form of the first pending infobox validator input processor.
+ * @return the form to show
+ */
+ public String getFirstValidatorInputForm() {
+ Iterator iter = getInfoboxValidatorIterator();
+ if (iter != null) {
+ while (iter.hasNext()) {
+ Vector infoboxValidatorVector = (Vector) iter.next();
+ InfoboxValidator infoboxvalidator = (InfoboxValidator) infoboxValidatorVector.get(2);
+ String form = infoboxvalidator.getForm();
+ if (!ParepUtils.isEmpty(form)) return form;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the mandateCompatibilityMode
+ */
+ public boolean isMandateCompatibilityMode() {
+ return mandateCompatibilityMode;
+ }
+
+ /**
+ * @param mandateCompatibilityMode the mandateCompatibilityMode to set
+ */
+ public void setMandateCompatibilityMode(boolean mandateCompatibilityMode) {
+ this.mandateCompatibilityMode = mandateCompatibilityMode;
+ }
+
+ /**
+ * Returns domain identifier (the register and number in the register parameter).
+ * <code>null</code> in the case of not a business service.
+ *
+ * @return the domainIdentifier
+ */
+ public String getDomainIdentifier() {
+ return domainIdentifier;
+ }
+
+ /**
+ * Sets the register and number in the register parameter if the application
+ * is a business service.
+ * If the domain identifier includes the registerAndOrdNr prefix, the prefix
+ * will be stripped off.
+ *
+ * @param domainIdentifier the domain identifier to set
+ */
+ public void setDomainIdentifier(String domainIdentifier) {
+ if (domainIdentifier != null && domainIdentifier.startsWith(REGISTERANDORDNR_PREFIX_))
+ {
+ // If domainIdentifier starts with prefix "urn:publicid:gv.at:wbpk+"; remove this prefix
+ this.domainIdentifier = domainIdentifier.substring(REGISTERANDORDNR_PREFIX_.length());
+ Logger.debug("Register and ordernumber prefix stripped off; resulting register string: " + this.domainIdentifier);
+ }
+ else
+ {
+ this.domainIdentifier = domainIdentifier;
+ }
+ }
+
+ /**
+ * Gets all identifiers of infoboxes, the online application
+ * is configured to accept. The infobox identifiers are comma separated.
+ *
+ * @return the string containing infobox identifiers
+ */
+ public String getPushInfobox() {
+ if (pushInfobox==null) return "";
+ return pushInfobox;
+ }
+
+ /**
+ * @param pushInfobox the infobox identifiers to set (comma separated)
+ */
+ public void setPushInfobox(String pushInfobox) {
+ this.pushInfobox = pushInfobox;
+ }
+
}