diff options
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS')
4 files changed, 54 insertions, 6 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 3996ad59c..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 @@ -170,6 +170,7 @@ public class EIDASProtocol extends AbstractController implements IModulInfo { //switch to session authentication protAuthService.performAuthentication(req, resp, pendingReq); + } /* @@ -375,6 +376,7 @@ public class EIDASProtocol extends AbstractController implements IModulInfo { } 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 AbstractController implements IModulInfo { } 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 AbstractController implements IModulInfo { } 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/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"); } diff --git a/id/server/modules/moa-id-module-eIDAS/src/test/java/test/at/gv/egovernment/moa/id/modules/eidas/eid4u/AttributeScopeMapperTest.java b/id/server/modules/moa-id-module-eIDAS/src/test/java/test/at/gv/egovernment/moa/id/modules/eidas/eid4u/AttributeScopeMapperTest.java index 0daa90b40..1df15cf24 100644 --- a/id/server/modules/moa-id-module-eIDAS/src/test/java/test/at/gv/egovernment/moa/id/modules/eidas/eid4u/AttributeScopeMapperTest.java +++ b/id/server/modules/moa-id-module-eIDAS/src/test/java/test/at/gv/egovernment/moa/id/modules/eidas/eid4u/AttributeScopeMapperTest.java @@ -37,8 +37,8 @@ public class AttributeScopeMapperTest { Assert.assertTrue("eID4u attribte-table is EMPTY after mapping", !result.isEmpty()); - Assert.assertTrue(result.containsKey(Definitions.COUNTRYOFBIRTH_NAME)); - Assert.assertEquals("", result.get(Definitions.COUNTRYOFBIRTH_NAME)); + Assert.assertFalse(result.containsKey(Definitions.COUNTRYOFBIRTH_NAME)); + //Assert.assertEquals("", result.get(Definitions.COUNTRYOFBIRTH_NAME)); Assert.assertTrue(result.containsKey(Definitions.CURRENTDEGREE_NAME)); Assert.assertEquals("Dr.techn.", result.get(Definitions.CURRENTDEGREE_NAME)); |