Parsing custom metadata extensions in the IdP

Etienne Dysli-Metref etienne.dysli-metref at switch.ch
Fri Nov 3 08:44:29 EDT 2017


Hello,

I'd like to parse our (SWITCH) custom metadata extensions in the IdP so
that I get something non-generic (i.e. not XSAny instances) out of
org.opensaml.saml.saml2.metadata.EntityDescriptor.getExtensions().getUnknownXMLObjects().
From what I could find out in the documentation [1] and in the code [2],
I think I need to:

1. Implement org.opensaml.core.config.Initializer.
2. Put the implementing class's name in
/META-INF/services/org.opensaml.core.config.Initializer of my JAR.
3. Write a xmltooling configuration file like this (from
opensaml-saml-impl/src/main/resources/saml2-metadata-rpi-config.xml):
    <ObjectProvider qualifiedName="mdrpi:Publication">
      <BuilderClass
className="org.opensaml.saml.ext.saml2mdrpi.impl.PublicationBuilder" />
      <MarshallingClass
className="org.opensaml.saml.ext.saml2mdrpi.impl.PublicationMarshaller" />
      <UnmarshallingClass
className="org.opensaml.saml.ext.saml2mdrpi.impl.PublicationUnmarshaller" />
    </ObjectProvider>
4. Implement the three referenced classes: -Builder, -Marshaller and
-Unmarshaller for each element to parse.
5. Also create an interface to represent each element with a
corresponding implementation class (why this can't just be one class is
unclear...).
6. Pack all of this in one JAR in the IdP's WAR and it should load
automatically.
7. And above all: do not mess up XML names and namespaces... ;)

Am I on the right track?

For a bit more context, below is an example of the metadata extension
elements I'm interested in (IntendedAudience). The XML schema is at [3].

<mdext:SWITCHaaiExtensions xmlns:mdext="https://rr.aai.switch.ch/"
  eduIDPrivateIdentityEnabled="true"
  federation="urn:mace:switch.ch:SWITCHaai"
  homeOrganization="switch.ch">
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">university</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">uas</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">hospital</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">library</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">tertiaryb</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">uppersecondary</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">vho</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="exclude"
    type="homeOrganizationType">others</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="include"
    type="homeOrganization">vho-switchaai.ch</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="include"
    type="homeOrganization">switch.ch</mdext:IntendedAudience>
  <mdext:IntendedAudience audiencePolicy="include"
    type="homeOrganization">eduid.ch</mdext:IntendedAudience>
</mdext:SWITCHaaiExtensions>

Cheers,
   Etienne

[1]
https://wiki.shibboleth.net/confluence/display/OS30/Initialization+and+Configuration
[2]
https://git.shibboleth.net/view/?p=java-opensaml.git;a=blob;f=opensaml-saml-impl/src/main/java/org/opensaml/saml/config/impl/XMLObjectProviderInitializer.java;h=f83810a0c50fb1fe50db7021980de6e14fa46e97;hb=HEAD
[3] https://rr.aai.switch.ch/resources/saml-metadata-switchaai-extension.xsd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://shibboleth.net/pipermail/dev/attachments/20171103/bbd10f2b/attachment.sig>


More information about the dev mailing list