summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_pvp2_sp/src/main
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-02-20 09:43:03 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-02-20 09:43:03 +0100
commita57a2ed851b818456421f3ce082dc6813da6b736 (patch)
treeb4c9c4c9f7c317ff3f0686d7427366203bdd9347 /eaaf_modules/eaaf_module_pvp2_sp/src/main
parent9e26dd0833cd3a6bfb6f15cc11727cdc8e14d260 (diff)
downloadEAAF-Components-a57a2ed851b818456421f3ce082dc6813da6b736.tar.gz
EAAF-Components-a57a2ed851b818456421f3ce082dc6813da6b736.tar.bz2
EAAF-Components-a57a2ed851b818456421f3ce082dc6813da6b736.zip
add two jUnit test and CodeStyle modifications
Diffstat (limited to 'eaaf_modules/eaaf_module_pvp2_sp/src/main')
-rw-r--r--eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/utils/AssertionAttributeExtractor.java31
1 files changed, 28 insertions, 3 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/utils/AssertionAttributeExtractor.java b/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/utils/AssertionAttributeExtractor.java
index 53d9d9e8..b12a5913 100644
--- a/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/utils/AssertionAttributeExtractor.java
+++ b/eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/utils/AssertionAttributeExtractor.java
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;
import at.gv.egiz.eaaf.modules.pvp2.PvpConstants;
import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AssertionAttributeExtractorExeption;
@@ -52,14 +53,19 @@ public class AssertionAttributeExtractor {
private final Map<String, List<String>> attributs = new HashMap<>();
// private PersonalAttributeList storkAttributes = new PersonalAttributeList();
+ @Deprecated
private final List<String> minimalMdsAttributeNamesList =
Arrays.asList(PvpConstants.PRINCIPAL_NAME_NAME, PvpConstants.GIVEN_NAME_NAME,
PvpConstants.BIRTHDATE_NAME, PvpConstants.BPK_NAME);
+ @Deprecated
private final List<String> minimalIdlAttributeNamesList =
Arrays.asList(PvpConstants.EID_IDENTITY_LINK_NAME, PvpConstants.EID_SOURCE_PIN_NAME,
PvpConstants.EID_SOURCE_PIN_TYPE_NAME);
+ private final List<String> minimalEidAttributeNamesList =
+ Arrays.asList(ExtendedPvpAttributeDefinitions.EID_EIDBIND_NAME);
+
/**
* Parse the SAML2 Response element and extracts included information. <br>
* <br>
@@ -128,8 +134,9 @@ public class AssertionAttributeExtractor {
* @return
*/
public boolean containsAllRequiredAttributes() {
- return containsAllRequiredAttributes(minimalMdsAttributeNamesList)
- || containsAllRequiredAttributes(minimalIdlAttributeNamesList);
+ return containsAllRequiredAttributes(minimalEidAttributeNamesList)
+ || containsAllRequiredAttributes(minimalIdlAttributeNamesList)
+ || containsAllRequiredAttributes(minimalMdsAttributeNamesList);
}
@@ -300,6 +307,25 @@ public class AssertionAttributeExtractor {
}
/**
+ * Get the Assertion issuing date.
+ *
+ * <p>
+ * This method returns value of SAML 'Conditions' element.
+ * </p>
+ *
+ * @return Date, when the SAML2 assertion was issued, otherwise null
+ */
+ public Date getAssertionIssuingDate() {
+ try {
+ return getFullAssertion().getIssueInstant().toDate();
+
+ } catch (final NullPointerException e) {
+ return null;
+
+ }
+ }
+
+ /**
* Get the Assertion validFrom period.
*
* <p>
@@ -316,7 +342,6 @@ public class AssertionAttributeExtractor {
return null;
}
-
}
private AuthnStatement getAuthnStatement() throws AssertionAttributeExtractorExeption {