From 3fada6cef21c9b16467177d866df778203b51b4d Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 5 Dec 2019 09:52:48 +0100 Subject: some code code-style modifications active code-quality checks! --- .../sp/impl/utils/AssertionAttributeExtractor.java | 44 +++++++++------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'eaaf_modules/eaaf_module_pvp2_sp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/sp/impl/utils/AssertionAttributeExtractor.java') 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 42d1c85e..fa2b9312 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 @@ -27,8 +27,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import at.gv.egiz.eaaf.modules.pvp2.PvpConstants; -import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AssertionAttributeExtractorExeption; + import org.apache.commons.lang3.StringUtils; import org.opensaml.saml2.core.Assertion; import org.opensaml.saml2.core.Attribute; @@ -42,6 +41,9 @@ import org.opensaml.xml.XMLObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.gv.egiz.eaaf.modules.pvp2.PvpConstants; +import at.gv.egiz.eaaf.modules.pvp2.sp.exception.AssertionAttributeExtractorExeption; + public class AssertionAttributeExtractor { private static final Logger log = LoggerFactory.getLogger(AssertionAttributeExtractor.class); @@ -61,7 +63,8 @@ public class AssertionAttributeExtractor { /** * Parse the SAML2 Response element and extracts included information.
*
- * INFO: Actually, only the first SAML2 Assertion of the SAML2 Response is used! + * INFO: Actually, only the first SAML2 Assertion of the SAML2 Response + * is used! * * @param samlResponse SAML2 Response * @throws AssertionAttributeExtractorExeption In case of an error @@ -131,7 +134,8 @@ public class AssertionAttributeExtractor { } /** - * check attributes from assertion with attributeNameList bPK or enc_bPK are always needed. + * check attributes from assertion with attributeNameList bPK or enc_bPK are + * always needed. * * @param attributeNameList List of attributes which are required * @@ -269,14 +273,14 @@ public class AssertionAttributeExtractor { return assertion; } - /** * Get the Assertion validTo period. * - *

- * Primarily, the 'SessionNotOnOrAfter' attribute in the SAML2 'AuthnStatment' element is used. If - * this is empty, this method returns value of SAML 'Conditions' element. - *

+ *

+ * Primarily, the 'SessionNotOnOrAfter' attribute in the SAML2 'AuthnStatment' + * element is used. If this is empty, this method returns value of SAML + * 'Conditions' element. + *

* * @return Date, until this SAML2 assertion is valid */ @@ -298,9 +302,9 @@ public class AssertionAttributeExtractor { /** * Get the Assertion validFrom period. * - *

+ *

* This method returns value of SAML 'Conditions' element. - *

+ *

* * @return Date, after this SAML2 assertion is valid, otherwise null */ @@ -331,21 +335,9 @@ public class AssertionAttributeExtractor { && assertion.getAttributeStatements().size() > 0) { final AttributeStatement attrStat = assertion.getAttributeStatements().get(0); for (final Attribute attr : attrStat.getAttributes()) { -// if (attr.getName().startsWith(PvpConstants.STORK_ATTRIBUTE_PREFIX)) { -// final List storkAttrValues = new ArrayList<>(); -// for (final XMLObject el : attr.getAttributeValues()) { -// storkAttrValues.add(el.getDOM().getTextContent()); -// } - // PersonalAttribute storkAttr = new PersonalAttribute(attr.getName(), - // false, storkAttrValues , "Available"); - // storkAttributes.put(attr.getName(), storkAttr ); - -// } else { - final List attrList = new ArrayList<>(); - for (final XMLObject el : attr.getAttributeValues()) { - attrList.add(el.getDOM().getTextContent()); - // } - + final List attrList = new ArrayList<>(); + for (final XMLObject el : attr.getAttributeValues()) { + attrList.add(el.getDOM().getTextContent()); attributs.put(attr.getName(), attrList); } -- cgit v1.2.3