Skip to Content.
Sympa Menu

mace-opensaml-users - Problem Validating an Assertion

Subject: OpenSAML user discussion

List archive

Problem Validating an Assertion


Chronological Thread 
  • From: Suneet Shah <>
  • To:
  • Subject: Problem Validating an Assertion
  • Date: Mon, 01 Mar 2010 00:19:53 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=w6pryvHtNoqXjsVcTBHxt0bmUxL1q1o7wlhO+MnKjPEcAmvy90oz9dvcMxCqKRO+Ip 88W+jRlB1dyz+AagMFMgtK8AKWBg+zAtZbE0zfRgur1Ohxx2wZiLjxwnkwdTgi2+mjIx cT4yJNltKAj1EyFlBdacrvejD6aASDNpaKKww=

Hello:

I am trying to validate an assertion, but am getting the following parsing exception. Any thoughts on what could be doing wrong?

I am using SOAPUI for my tests.

Thanks in advance for your help

-- Sample Assertion --

<?xml version="1.0" encoding="UTF-8"?>
<saml2:Assertion ID="acae8abb69174e258bd1e746aa2a8a45" IssueInstant="2010-03-01T05:03:23.113Z" Version="2.0" xmlns="openiam" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><saml2:Issuer>openiam</saml2:Issuer><saml2:Subject><saml2:NameID Format="NameIdentifierType" NameQualifier="openiam">3006</saml2:NameID></saml2:Subject><saml2:Conditions NotBefore="2010-03-01T05:03:23.113Z" NotOnOrAfter="2010-03-01T05:33:23.684Z"/><saml2:AuthnStatement AuthnInstant="2010-03-01T05:03:23.113Z"><saml2:AuthnContext><saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml2:AuthnContextClassRef></saml2:AuthnContext></saml2:AuthnStatement></saml2:Assertion>

-- Validation Code --

public boolean isTokenValid(String userId, String token) {
StringReader reader = new StringReader(token);
try {
BasicParserPool ppMgr = new BasicParserPool();
ppMgr.setNamespaceAware(true);
Document inCommonMDDoc = ppMgr.parse(reader);
Element metadataRoot = inCommonMDDoc.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataRoot);
Assertion samlAssertion = (Assertion)unmarshaller.unmarshall(metadataRoot);
samlAssertion.validate(true);
return true;
}catch(Exception e) {
log.error("Error during token validation: " + e);
return false;
}

}



Archive powered by MHonArc 2.6.16.

Top of Page