From 62f820c249a093ad4ae5ff82392be88563b94fca Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 2 Sep 2005 16:03:53 +0000 Subject: *** empty log message *** git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@491 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../moa/id/auth/validator/IdentityLinkValidator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'id.server/src/at/gv/egovernment') diff --git a/id.server/src/at/gv/egovernment/moa/id/auth/validator/IdentityLinkValidator.java b/id.server/src/at/gv/egovernment/moa/id/auth/validator/IdentityLinkValidator.java index 24029120e..b19b40830 100644 --- a/id.server/src/at/gv/egovernment/moa/id/auth/validator/IdentityLinkValidator.java +++ b/id.server/src/at/gv/egovernment/moa/id/auth/validator/IdentityLinkValidator.java @@ -31,7 +31,7 @@ public class IdentityLinkValidator implements Constants { /** Xpath prefix for reaching ECDSA Namespaces */ private static final String ECDSA = ECDSA_PREFIX + ":"; /** Xpath expression to the root element */ - private static final String ROOT = "/" + SAML + "Assertion/"; + private static final String ROOT = ""; /** Xpath expression to the SAML:SubjectConfirmationData element */ private static final String SAML_SUBJECT_CONFIRMATION_DATA_XPATH = ROOT @@ -92,8 +92,9 @@ public class IdentityLinkValidator implements Constants { */ public void validate(IdentityLink identityLink) throws ValidateException { + Element samlAssertion = identityLink.getSamlAssertion(); //Search the SAML:ASSERTION Object (A2.054) - if (identityLink.getSamlAssertion() == null) + if (samlAssertion == null) throw new ValidateException("validator.00", null); // Check how many saml:Assertion/saml:AttributeStatement/ @@ -101,7 +102,7 @@ public class IdentityLinkValidator implements Constants { // saml:SubjectConfirmationData/pr:Person of type // PhysicalPersonType exist (A2.056) NodeList nl = - XPathUtils.selectNodeList(identityLink.getSamlAssertion(), PERSON_XPATH); + XPathUtils.selectNodeList(samlAssertion, PERSON_XPATH); // If we have just one Person-Element we don't need to check the attributes int counterPhysicalPersonType = 0; if (nl.getLength() > 1) @@ -121,7 +122,7 @@ public class IdentityLinkValidator implements Constants { throw new ValidateException("validator.01", null); //Check the SAML:ATTRIBUTES - nl = XPathUtils.selectNodeList(identityLink.getSamlAssertion(), ATTRIBUTE_XPATH); + nl = XPathUtils.selectNodeList(samlAssertion, ATTRIBUTE_XPATH); for (int i = 0; i < nl.getLength(); i++) { String attributeName = XPathUtils.getAttributeValue( @@ -154,7 +155,7 @@ public class IdentityLinkValidator implements Constants { } //Check if dsig:Signature exists - Element dsigSignature = (Element) XPathUtils.selectSingleNode(identityLink.getSamlAssertion(),ROOT + DSIG + "Signature"); + Element dsigSignature = (Element) XPathUtils.selectSingleNode(samlAssertion,ROOT + DSIG + "Signature"); if (dsigSignature==null) throw new ValidateException("validator.05", null); } -- cgit v1.2.3