aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols')
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java10
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentDegreeAttrBuilder.java18
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentLevelOfStudyAttrBuilder.java29
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/FieldOfStudyAttrBuilder.java23
4 files changed, 71 insertions, 9 deletions
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java
index 7c9e66ba0..3ba7664a8 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java
@@ -48,7 +48,7 @@ import at.gv.egiz.eaaf.core.api.idp.IModulInfo;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.EAAFException;
import at.gv.egiz.eaaf.core.impl.gui.velocity.VelocityProvider;
-import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractAuthProtocolModulController;
+import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractController;
import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.advancedlogging.MOAIDEventConstants;
import at.gv.egovernment.moa.id.auth.modules.eidas.Constants;
@@ -82,7 +82,7 @@ import eu.eidas.engine.exceptions.EIDASSAMLEngineException;
* @author tlenz
*/
@Controller
-public class EIDASProtocol extends AbstractAuthProtocolModulController implements IModulInfo {
+public class EIDASProtocol extends AbstractController implements IModulInfo {
public static final String eIDAS_GENERIC_REQ_DATA_LEVELOFASSURENCE = "eIDAS_GENERIC_REQ_DATA_LEVELOFASSURENCE";
@@ -169,7 +169,8 @@ public class EIDASProtocol extends AbstractAuthProtocolModulController implement
pendingReq.setAction(eIDASAuthenticationRequest.class.getName());
//switch to session authentication
- performAuthentication(req, resp, pendingReq);
+ protAuthService.performAuthentication(req, resp, pendingReq);
+
}
/*
@@ -375,6 +376,7 @@ public class EIDASProtocol extends AbstractAuthProtocolModulController implement
} catch (MOAIDException e) {
Logger.info("eIDAS AuthnRequest preProcessing FAILED. Msg:" + e.getMessage());
+ Logger.debug("eIDAS AuthnReq: " + base64SamlToken);
//write revision log entries
if (pendingReq != null)
@@ -384,6 +386,7 @@ public class EIDASProtocol extends AbstractAuthProtocolModulController implement
} catch (EIDASSAMLEngineException e) {
Logger.info("eIDAS AuthnRequest preProcessing FAILED. Msg:" + e.getMessage());
+ Logger.debug("eIDAS AuthnReq: " + base64SamlToken);
//write revision log entries
if (pendingReq != null)
@@ -393,6 +396,7 @@ public class EIDASProtocol extends AbstractAuthProtocolModulController implement
} catch(Exception e) {
Logger.warn("eIDAS AuthnRequest preProcessing FAILED. Msg:" + e.getMessage(), e);
+ Logger.debug("eIDAS AuthnReq: " + base64SamlToken);
//write revision log entries
if (pendingReq != null)
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentDegreeAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentDegreeAttrBuilder.java
index 7b4c16a5a..cc4026253 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentDegreeAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentDegreeAttrBuilder.java
@@ -9,17 +9,31 @@ import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
+import at.gv.egovernment.moa.logging.Logger;
@eIDASMetadata
public class CurrentDegreeAttrBuilder implements IeIDASAttribute {
+ private static final String DELIMITER = ";";
+
@Override
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.CURRENTDEGREE_FRIENDLYNAME, getName(), idType);
+ if (StringUtils.isNotEmpty(idType)) {
+ String[] split = idType.split(DELIMITER);
+ if (split.length > 1) {
+ Logger.debug("Find more than one attribute values: " + idType + " Using first one ... ");
+ return g.buildStringAttribute(Definitions.CURRENTDEGREE_FRIENDLYNAME, getName(), split[0]);
+
+ } else {
+ return g.buildStringAttribute(Definitions.CURRENTDEGREE_FRIENDLYNAME, getName(), idType);
+
+ }
+
+
+ }
else
throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentLevelOfStudyAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentLevelOfStudyAttrBuilder.java
index 5210676c2..a0a7ff95e 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentLevelOfStudyAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentLevelOfStudyAttrBuilder.java
@@ -9,19 +9,44 @@ import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
+import at.gv.egovernment.moa.logging.Logger;
@eIDASMetadata
public class CurrentLevelOfStudyAttrBuilder implements IeIDASAttribute {
+ private static final String DELIMITER = ";";
+
@Override
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
+ if (StringUtils.isNotEmpty(idType)) {
+ String[] split = idType.split(DELIMITER);
+ if (split.length > 1) {
+ //select the highest level
+ int currentValue = -1;
+ for (String el : split) {
+ int elInt;
+ try {
+ elInt = Integer.valueOf(el);
+ if (currentValue < elInt)
+ currentValue = elInt;
+
+ } catch (NumberFormatException e) {
+ Logger.warn("Can NOT convert CurrentLevelOfStudy: " + el, e);
+
+ }
+
+ }
+
+ idType = String.valueOf(currentValue);
+
+ }
+
return g.buildStringAttribute(Definitions.CURRENTLEVELOFSTUDY_FRIENDLYNAME, getName(), idType);
- else
+ } else
throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/FieldOfStudyAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/FieldOfStudyAttrBuilder.java
index ba486079e..28023a219 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/FieldOfStudyAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/FieldOfStudyAttrBuilder.java
@@ -13,15 +13,34 @@ import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata
@eIDASMetadata
public class FieldOfStudyAttrBuilder implements IeIDASAttribute {
+ private static final String DELIMITER = ";";
+ private static final String UNDEFINED_CODE = "9999";
+
@Override
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
+ if (StringUtils.isNotEmpty(idType)) {
+ String[] split = idType.split(DELIMITER);
+ if (split.length > 1) {
+ String currentSelected = UNDEFINED_CODE;
+ for (String el : split) {
+ if (!el.equals(currentSelected)) {
+ //select first that is not undefined code
+ currentSelected = el;
+ break;
+ }
+
+ }
+
+ idType = currentSelected;
+ }
+
+
return g.buildStringAttribute(Definitions.FIELDOFSTUDY_FRIENDLYNAME, getName(), idType);
- else
+ } else
throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}