Skip to Content.
Sympa Menu

mace-opensaml-users - org.opensaml.MalformedException: Subject is invalid, requires either NameIdentifier or at least one ConfirmationMethod

Subject: OpenSAML user discussion

List archive

org.opensaml.MalformedException: Subject is invalid, requires either NameIdentifier or at least one ConfirmationMethod


Chronological Thread 
  • From:
  • To:
  • Subject: org.opensaml.MalformedException: Subject is invalid, requires either NameIdentifier or at least one ConfirmationMethod
  • Date: Thu, 30 Nov 2006 14:02:35 -0500 (EST)

Hi,

I am getting the following error

org.opensaml.MalformedException: Subject is invalid, requires either
NameIdentifier or at least one ConfirmationMethod
at org.opensaml.SAMLSubject.checkValidity(Unknown Source)
at org.opensaml.SAMLSubject.fromDOM(Unknown Source)
at org.opensaml.SAMLSubject.<init>(Unknown Source)
at org.opensaml.SAMLSubjectStatement.fromDOM(Unknown Source)
at org.opensaml.SAMLAttributeStatement.fromDOM(Unknown Source)
at org.opensaml.SAMLAttributeStatement.<init>(Unknown Source)
at
org.opensaml.SAMLAttributeTest.getAttributeDetails(SAMLAttributeTest.java:31)
at org.opensaml.SAMLAttributeTest.main(SAMLAttributeTest.java:44)

This is my code

package org.opensaml;


import java.io.ByteArrayInputStream;
import java.io.FileInputStream;


import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;


public class SAMLAttributeTest {

private String xmlpath = "C:/SSO/data/output.xml";

public void getAttributeDetails()
throws Exception{

SAMLAssertion a = new SAMLAssertion(new
FileInputStream(xmlpath));
String dump=a.toString();
XML.ParserPool _XMLParserPool = new XML.ParserPool();
ByteArrayInputStream _ByteArrayInputStream = new
ByteArrayInputStream(dump.getBytes());

Document _Document = _XMLParserPool.parse(_ByteArrayInputStream);
Element _Element = _Document.getDocumentElement();
Node _Node = _Element.getChildNodes().item(2);
String sAttributeName = _Node.getLocalName();


SAMLAttributeStatement _SAMLAttributeStatement = new
SAMLAttributeStatement(_Element);
SAMLSubject _SAMLSubject =
_SAMLAttributeStatement.getSubject();
SAMLNameIdentifier _SAMLNIdentifier =
_SAMLSubject.getNameIdentifier();
System.out.println(_SAMLNIdentifier.getName());


}
/**
* @param args
*/
public static void main(String[] args) throws Exception{

SAMLAttributeTest _SAMAttributeTest = new SAMLAttributeTest();
_SAMAttributeTest.getAttributeDetails();

}

}

This is my input

<saml:Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#";
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
AssertionID="cT_S_T-vKMwidT8_Pzkke8UkC68."
IssueInstant="2004-02-25T16:31:03Z" Issuer="http://aaremote.entegrity.com";
MajorVersion="1" MinorVersion="1"><saml:Conditions
NotBefore="2004-02-25T16:26:03Z"
NotOnOrAfter="2004-02-25T16:36:03Z"></saml:Conditions><saml:AuthenticationStatement
AuthenticationInstant="2004-02-25T16:30:58Z"
AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password"><saml:Subject><saml:NameIdentifier
Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName"
NameQualifier="http://www.entegrity.com";>uid=charlie,ou=People,dc=entegrity,dc=com</saml:NameIdentifier><saml:SubjectConfirmation><saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm

:bearer</saml:ConfirmationMethod></saml:SubjectConfirmation></saml:Subject><saml:SubjectLocality

IPAddress="192.168.4.1"></saml:SubjectLocality></saml:AuthenticationStatement><saml:AttributeStatement><saml:Subject><saml:NameIdentifier
Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName"
NameQualifier="http://www.entegrity.com";>uid=charlie,ou=People,dc=entegrity,dc=com</saml:NameIdentifier><saml:SubjectConfirmation><saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod></saml:SubjectConfirmation></saml:Subject><saml:Attribute
AttributeName="AssuranceLevel"
AttributeNamespace="http://www.oasis-open.org/RSA2004/attributes";><saml:AttributeValue>1</saml:AttributeValue></saml:Attribute><saml:Attribute
AttributeName="E-mail"
AttributeNamespace="http://www.oasis-open.org/RSA2004/attributes";><saml:AttributeValue></saml:AttributeValue></saml:Attribute><saml:Attribute
AttributeName="MemberLevel" AttributeNamespace="http://w

ww.oasis-open.org/RSA2004/attributes"><saml:AttributeValue>gold</saml:AttributeValue></saml:Attribute><saml:Attribute
AttributeName="commonName"
AttributeNamespace="http://www.oasis-open.org/RSA2004/attributes";><saml:AttributeValue>Charles

Connors</saml:AttributeValue></saml:Attribute></saml:AttributeStatement><ds:Signature>
<ds:SignedInfo>
<ds:CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#";></ds:CanonicalizationMethod>
<ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1";></ds:SignatureMethod>
<ds:Reference URI="#cT_S_T-vKMwidT8_Pzkke8UkC68.">
<ds:Transforms>
<ds:Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature";></ds:Transform>
<ds:Transform
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#";><ec:InclusiveNamespaces
xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"; PrefixList="code ds kind
rw saml samlp typens #default xsd
xsi"></ec:InclusiveNamespaces></ds:Transform>
</ds:Transforms>
<ds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1";></ds:DigestMethod>
<ds:DigestValue>+Yev+PwE9q5E9niQqM/+YpXxL6E=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
dZRJ2Fj9ImD41n2wisFwNrDK+uVjEExKlhTe2oCVmv/QNOsWQI4P9S0DdKwPa0rkrz3ksdlV7oxa
UOU3BPOmxQljyuX40vBO5/KLlrw6Wu3NC8/7gWJUkZW3Cb5c7gdPLS6ic8BXVEclxLbW8U9/3M1C
HHK8MpArNsQC07n/MUhgSicXCH6KREpyKOd4E0FWvt5H2K58Nf62CDlEqUY3P3C6drOlwjVBfMbv
1Nhll1VmATUa7tAA9s6tFeExwJtJdBSoO/5nJk3HkBkGzE9XvX7AprfLtidw6fC2dP61Y2x5A0gg
gzNjv4Dl9hWNcTkGLZH+SRdpCnjDQXGCuBQNRQ==
</ds:SignatureValue>
</ds:Signature></saml:Assertion>

Can someone help me in this.

Thanks in advance.



Archive powered by MHonArc 2.6.16.

Top of Page