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! --- .../data/SimpleIdentityLinkAssertionParser.java | 92 ++++++++++------------ 1 file changed, 40 insertions(+), 52 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java index 220469d3..acb877c2 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java @@ -1,22 +1,5 @@ -/******************************************************************************* - * Copyright 2014 Federal Chancellery Austria MOA-ID has been developed in a cooperation between - * BRZ, the Federal Chancellery Austria - ICT staff unit, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European - * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in - * compliance with the Licence. You may obtain a copy of the Licence at: http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software distributed under the Licence - * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the Licence for the specific language governing permissions and limitations under - * the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text file for details on the - * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative - * works that you distribute must include a readable copy of the "NOTICE" text file. - ******************************************************************************/ /* - * Copyright 2003 Federal Chancellery Austria MOA-ID has been developed in a cooperation between + * Copyright 2014 Federal Chancellery Austria MOA-ID has been developed in a cooperation between * BRZ, the Federal Chancellery Austria - ICT staff unit, and Graz University of Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European @@ -31,7 +14,7 @@ * This product combines work with different licenses. See the "NOTICE" text file for details on the * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative * works that you distribute must include a readable copy of the "NOTICE" text file. - */ +*/ package at.gv.egiz.eaaf.core.impl.idp.auth.data; @@ -40,17 +23,19 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import at.gv.egiz.eaaf.core.api.data.XMLNamespaceConstants; + +import org.springframework.util.Base64Utils; +import org.w3c.dom.Element; +import org.w3c.dom.traversal.NodeIterator; + +import at.gv.egiz.eaaf.core.api.data.XmlNamespaceConstants; import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; import at.gv.egiz.eaaf.core.exceptions.EaafParserException; import at.gv.egiz.eaaf.core.impl.utils.DomUtils; import at.gv.egiz.eaaf.core.impl.utils.XPathUtils; -import org.springframework.util.Base64Utils; -import org.w3c.dom.Element; -import org.w3c.dom.traversal.NodeIterator; /** - * Parses MDS from an identity link <saml:Assertion>
+ * Parses MDS from an identity link. <saml:Assertion>
* This IDL parser extract NO key information! * */ @@ -60,56 +45,59 @@ public class SimpleIdentityLinkAssertionParser { // XPath namespace prefix shortcuts // - /** Xpath prefix for reaching PersonData Namespaces */ - private static final String PDATA = XMLNamespaceConstants.PD_PREFIX + ":"; - /** Xpath prefix for reaching SAML Namespaces */ - private static final String SAML = XMLNamespaceConstants.SAML_PREFIX + ":"; - /** Xpath prefix for reaching XML-DSIG Namespaces */ - private static final String DSIG = XMLNamespaceConstants.DSIG_PREFIX + ":"; - /** Xpath expression to the root element */ + /** Xpath prefix for reaching PersonData Namespaces. */ + private static final String PDATA = XmlNamespaceConstants.PD_PREFIX + ":"; + /** Xpath prefix for reaching SAML Namespaces. */ + private static final String SAML = XmlNamespaceConstants.SAML_PREFIX + ":"; + /** Xpath prefix for reaching XML-DSIG Namespaces. */ + private static final String DSIG = XmlNamespaceConstants.DSIG_PREFIX + ":"; + /** Xpath expression to the root element. */ private static final String ROOT = ""; - /** Xpath expression to the SAMLSubjectConfirmationData element */ + /** Xpath expression to the SAMLSubjectConfirmationData element. */ private static final String SAML_SUBJECT_CONFIRMATION_DATA_XPATH = ROOT + SAML + "AttributeStatement/" + SAML + "Subject/" + SAML + "SubjectConfirmation/" + SAML + "SubjectConfirmationData"; - /** Xpath expression to the PersonData element */ + /** Xpath expression to the PersonData element. */ public static final String PERSON_XPATH = SAML_SUBJECT_CONFIRMATION_DATA_XPATH + "/" + PDATA + "Person"; - /** Xpath expression to the PersonData GivenName element */ + /** Xpath expression to the PersonData GivenName element. */ public static final String PERSON_GIVEN_NAME_XPATH = PERSON_XPATH + "/" + PDATA + "Name/" + PDATA + "GivenName"; - /** Xpath expression to the PersonData FamilyName element */ + /** Xpath expression to the PersonData FamilyName element. */ public static final String PERSON_FAMILY_NAME_XPATH = PERSON_XPATH + "/" + PDATA + "Name/" + PDATA + "FamilyName"; - /** Xpath expression to the PersonData DateOfBirth element */ + /** Xpath expression to the PersonData DateOfBirth element. */ public static final String PERSON_DATE_OF_BIRTH_XPATH = PERSON_XPATH + "/" + PDATA + "DateOfBirth"; - /** Xpath expression to the Identification Value element */ + /** Xpath expression to the Identification Value element. */ public static final String PERSON_IDENT_VALUE_XPATH = PERSON_XPATH + "/" + PDATA + "Identification/" + PDATA + "Value"; - /** Xpath expression to the Identification Value element */ + /** Xpath expression to the Identification Value element. */ public static final String PERSON_IDENT_TYPE_XPATH = PERSON_XPATH + "/" + PDATA + "Identification/" + PDATA + "Type"; - /** Xpath expression to the DSIG X509Certificate element */ + /** Xpath expression to the DSIG X509Certificate element. */ private static final String DSIG_CERTIFICATES_XPATH = ROOT + DSIG + "Signature/" + DSIG + "KeyInfo/" + DSIG + "X509Data/" + DSIG + "X509Certificate"; - /** Xpath expression to the DSIG Transforms element */ + /** Xpath expression to the DSIG Transforms element. */ private static final String DSIG_REFERENCE_TRANSFORMATION_XPATH = ROOT + DSIG + "Signature/" + DSIG + "SignedInfo/" + DSIG + "Reference/" + DSIG + "Transforms"; - /** The IssueInstant attribute of the SAML assertion */ + /** The IssueInstant attribute of the SAML assertion. */ private static final String ISSUE_INSTANT_ATTR = "IssueInstant"; public static final String ASSERTIONID = "AssertionID"; - /** This is the root element of the XML-Document provided by the Security Layer Card */ + /** + * This is the root element of the XML-Document provided by the Security Layer + * Card. + */ private Element assertionElem; /** - * Constructor for IdentityLinkAssertionParser. A DOM-representation of the incoming - * String will be created + * Constructor for IdentityLinkAssertionParser. A + * DOM-representation of the incoming String will be created * * @param xmlAssertion <saml:Assertion> as String * @throws EaafParserException on any parsing error @@ -120,7 +108,7 @@ public class SimpleIdentityLinkAssertionParser { assertionElem = DomUtils.parseXmlValidating(s); } catch (final Throwable t) { - throw new EaafParserException("parser.01", new Object[] {t.toString()}, t); + throw new EaafParserException("parser.01", new Object[] { t.toString() }, t); } } @@ -136,8 +124,8 @@ public class SimpleIdentityLinkAssertionParser { } /** - * Constructor for IdentityLinkAssertionParser. A DOM-representation of the incoming - * Inputstream will be created + * Constructor for IdentityLinkAssertionParser. A + * DOM-representation of the incoming Inputstream will be created * * @param xmlAssertion <saml:Assertion> as InputStream * @throws EaafParserException on any parsing error @@ -148,13 +136,13 @@ public class SimpleIdentityLinkAssertionParser { assertionElem = DomUtils.parseXmlValidating(xmlAssertion); } catch (final Throwable t) { - throw new EaafParserException("parser.01", new Object[] {t.toString()}, t); + throw new EaafParserException("parser.01", new Object[] { t.toString() }, t); } } /** - * Parses the identity link from the <saml:Assertion> + * Parses the identity link from the <saml:Assertion>. * * @return Identity link * @throws EaafParserException on any parsing error @@ -199,7 +187,7 @@ public class SimpleIdentityLinkAssertionParser { // identityLink.setPublicKey(getPublicKeys()); } catch (final Throwable t) { - throw new EaafParserException("parser.01", new Object[] {t.toString()}, t); + throw new EaafParserException("parser.01", new Object[] { t.toString() }, t); } return identityLink; @@ -207,10 +195,10 @@ public class SimpleIdentityLinkAssertionParser { /** * Parses a string array of decoded base64 certificates from the - * <InfoboxReadResponse> found in the dsig-signature + * <InfoboxReadResponse> found in the dsig-signature. * * @return String[] with raw-certificates from the dsig-signature keyinfo - * @throws Exception + * @throws Exception In case of an error */ public String[] getCertificates() throws Exception { final List certs = new ArrayList(); -- cgit v1.2.3