Skip to Content.
Sympa Menu

mace-opensaml-users - Re: SAML 2.0 metadata

Subject: OpenSAML user discussion

List archive

Re: SAML 2.0 metadata


Chronological Thread 
  • From: Manuela Stanica <>
  • To: Chad La Joie <>
  • Cc:
  • Subject: Re: SAML 2.0 metadata
  • Date: Wed, 24 May 2006 15:41:16 +0200

Chad La Joie schrieb:
Okay, I have verified that the current code compiles cleanly now.

Great. All the unmarshalling seems to be working over here too now. Today I could test the marshalling part as well which I've been integrating in my project lately. Also working well, except when I came to marhshalling an <Extensions> element (details below).
Other than the code itself being flux, have you been finding the APIs relatively straightforward and easy to use?  Are there  features or suggestions you have?
I found the APIs pretty easy to use in general. At times I needed to explore through the code in order to understand how something works or how to use it, so I think a little more detailed documentation (especially for the particular cases) could be of use. I will get back to you if /when any suggestions or comments occur to me.

So now I seem to be having difficulties marshalling Extensions for the Organization element inside an EntityDescriptor, and haven't yet managed to understand what's happening. Hope you can help.
The code I wrote:

        QName extQName = new QName(SAMLConstants.SAML20MD_NS, Extensions.LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
        ExtensionsBuilder extBuilder = (ExtensionsBuilder)builderFactory.getBuilder(extQName);
        Extensions extensions = extBuilder.buildObject();
        ..............................

Yet even though I specified the saml2 metadata namespace, "Extensions" appears associated with the "urn:oasis:names:tc:SAML:2.0:assertion" namespace.... Then a registered marshaller for this element can't be found so the ElementProxyMarshaller is used, and somewhere along the line I get a ClassCastException: org.opensaml.saml2.common.impl.ExtensionsImpl.
Here's an excerpt of the debug log, in case this makes it more clear:

2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallChildElements:274] Marshalling child elements for XMLObject {urn:oasis:names:tc:SAML:2.0:metadata}Organization
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallChildElements:285] Getting marshaller for child XMLObject {urn:oasis:names:tc:SAML:2.0:assertion}Extensions
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallChildElements:299] No marshaller was registered for {urn:oasis:names:tc:SAML:2.0:assertion}Extensions, child of {urn:oasis:names:tc:SAML:2.0:metadata}Organization but the default marshaller org.opensaml.xml.ElementProxyMarshaller was available, using it.
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallChildElements:307] Marshalling {urn:oasis:names:tc:SAML:2.0:assertion}Extensions and adding it to DOM
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshall:145] Starting to marshall {urn:oasis:names:tc:SAML:2.0:assertion}Extensions as child of {urn:oasis:names:tc:SAML:2.0:metadata}Organization
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#checkXMLObjectIsTarget:231] Targeted QName checking is not available for this marshaller, XMLObject {urn:oasis:names:tc:SAML:2.0:assertion}Extensions was not verified
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshall:156] Creating Element to marshall {urn:oasis:names:tc:SAML:2.0:assertion}Extensions into
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshall:162] Appending newly created element to given parent element
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallInto:200] Setting namespace prefix for saml for XMLObject {urn:oasis:names:tc:SAML:2.0:assertion}Extensions
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallNamespaces:372] Marshalling namespace attributes for XMLObject {urn:oasis:names:tc:SAML:2.0:assertion}Extensions
2006-05-24 14:55:42,187 DEBUG [AbstractXMLObjectMarshaller#marshallNamespaces:384] Adding namespace decleration xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" to {urn:oasis:names:tc:SAML:2.0:assertion}Extensions
Exception in thread "main" java.lang.ClassCastException: org.opensaml.saml2.common.impl.ExtensionsImpl
    at org.opensaml.xml.ElementProxyMarshaller.marshallAttributes(ElementProxyMarshaller.java:38)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:209)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:167)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:309)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:211)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:167)
    at org.opensaml.xml.io.AbstractDOMCachingXMLObjectMarshaller.marshall(AbstractDOMCachingXMLObjectMarshaller.java:142)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallChildElements(AbstractXMLObjectMarshaller.java:309)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshallInto(AbstractXMLObjectMarshaller.java:211)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:135)
    at org.opensaml.xml.io.AbstractDOMCachingXMLObjectMarshaller.marshall(AbstractDOMCachingXMLObjectMarshaller.java:97)
    at org.opensaml.xml.io.AbstractXMLObjectMarshaller.marshall(AbstractXMLObjectMarshaller.java:103)
    at net.geant.edugain.meta.publish.MetaDataMarshaller.marshallMetaData(MetaDataMarshaller.java:71)
    at test.MarshallingTest.main(MarshallingTest.java:37)

Would it be possible to have an example of how to use/marshall Extensions, I saw that the correpsonding classes are a bit different and not included in the metadata package as the others.

Thanks and sorry for the long message,

Manuela

-- 
Manuela Stanica
				
DFN-Verein - The German Education & Research Network
Stresemannstrasse 78, D-10963 Berlin
			
	Tel. +49 30 88429929
www.dfn.de	 Fax  +49 30 88429970



Archive powered by MHonArc 2.6.16.

Top of Page