Skip to Content.
Sympa Menu

mace-opensaml-users - RE: Adding new statements or queries

Subject: OpenSAML user discussion

List archive

RE: Adding new statements or queries


Chronological Thread 
  • From: Scott Cantor <>
  • To: 'Oscar Canovas Reverte' <>,
  • Subject: RE: Adding new statements or queries
  • Date: Tue, 23 Mar 2004 13:58:59 -0500
  • Organization: The Ohio State University

> Is there any guideline about how to create new Java classes for
> representing custom statements or queries? The main idea is to inherit
> from the base classes (SAMLSubjectStatement or SubjectQuery). I have
> been analyzing the source code but I get confused about the XML class in
> the org.opensaml package, since it makes reference to the files
> containing the SAML XSD, so I guess I have to incorporate the new
> schemas for our extensions in some way.

Yes, you need to register an EntityResolver interface along with your
schema's namespace so that the XML parser can load the schema properly when
it sees that namespace. You can do this in a variety of ways, the resolver
interface is part of JAXP and just requires that if you're asked for that
namespace you give it the stream.

Apart from that, you need to register your new class with the SAMLStatement
and SAMLQuery hashtables that match types/elements to classes. There are
factory registration and unregistration methods on those classes. You give
it the Qname of your new element and/or type and the name of your class.

> Any idea or suggestion? Could you send me an example of a Java class
> extending a SAML statement?

Look at the existing statements, they are just built-in extensions. The only
advantage they have is that the SAML init code registers the class name (one
line of code) and that the schemas are already resolved by my entity
resolver. That's the piece you have to do. One way is just to put the schema
file in your jar, and have your resolver load the file from the jar as a
Java resource.

I think Walter's done some work on the XML catalog stuff from jakarta, but I
haven't looked at integrating that in in place of the stuff I did.

-- Scott




Archive powered by MHonArc 2.6.16.

Top of Page