mace-opensaml-users - An implementation to SAMLAttributeStatement and a problem in XML.ParserPool
Subject: OpenSAML user discussion
List archive
- From: Joncheng Kuo <>
- To:
- Cc:
- Subject: An implementation to SAMLAttributeStatement and a problem in XML.ParserPool
- Date: Thu, 24 Oct 2002 14:02:00 -0400
- Organization: Syracuse University
Hi,
Attached is my implementation of the constructor of SAMLAttributeStatement that takes an DOM Element. It wasn't implemented in the resouce code that I retrieved from the CVS repository this week. I implemented it in a way similar to SAMLAuthenticationStatement, but
this implementation uses two utility methods, getFirstChildElement() and getNextSiblingElement() to increase the readability.
Besides, I found that XML.ParserPool.resolveEntity() does not work in one of my Linux machines (Mandrake 8.2). What happen is that I found systemId can be either
file:/home/user/cs-sstc-schema-assertion-01.xsd
or
file:cs-sstc-schema-assertion-01.xsd.
In the second case, the current implementation does not work.
Cheers,
Joncheng Kuo
public SAMLAttributeStatement(Element e)
throws SAMLException
{
if (e==null || !XML.SAML_NS.equals(e.getNamespaceURI()) ||
!"AttributeStatement".equals(e.getLocalName()))
{
QName q=QName.getQNameAttribute(e,XML.XSI_NS,"type");
if (!XML.SAML_NS.equals(e.getNamespaceURI()) ||
!"Statement".equals(e.getLocalName()) || q==null ||
!XML.SAML_NS.equals(q.getNamespaceURI()) ||
!"AttributeStatementType".equals(q.getLocalName()))
throw new InvalidAssertionException(SAMLException.RESPONDER,
"SAMLAttributeStatement() requires saml:AttributeStatement at root");
}
root = e;
// Extract subject.
Node n = getFirstChildElement(e);
subject = new SAMLSubject((Element)n);
// Extract attributes.
java.util.Vector v = new java.util.Vector();
n = getNextSiblingElement(n);
while (n != null)
{
if (XML.SAML_NS.equals(n.getNamespaceURI()) &&
"Attribute".equals(n.getLocalName()))
v.add(new SAMLAttribute((Element)n));
n = getNextSiblingElement(n);
}
if (v.size() > 0)
v.toArray(attrs=new SAMLAttribute[v.size()]);
}
public static Node getFirstChildElement(Element e)
{
Node n = e.getFirstChild();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getNextSibling();
return n;
}
public static Node getNextSiblingElement(Node n)
{
n = n.getNextSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getNextSibling();
return n;
}
- An implementation to SAMLAttributeStatement and a problem in XML.ParserPool, Joncheng Kuo, 10/24/2002
- RE: An implementation to SAMLAttributeStatement and a problem in XML.ParserPool, Scott Cantor, 10/24/2002
- A problem in validating the signature in an Assertion, Joncheng Kuo, 10/30/2002
- RE: A problem in validating the signature in an Assertion, Scott Cantor, 10/31/2002
- A problem in validating the signature in an Assertion, Joncheng Kuo, 10/30/2002
- RE: An implementation to SAMLAttributeStatement and a problem in XML.ParserPool, Scott Cantor, 10/24/2002
Archive powered by MHonArc 2.6.16.