CustomAttributeDefinition

The Shibboleth V1 software has reached its End of Life and is no longer supported. This documentation is available for historical purposes only.

CustomAttributeDefinition

Writing a Custom Attribute Definition

If the current attribute definitions do not meet your needs you may write a custom one. This is a fairly simple process:

  1. Create a class that extends edu.internet2.middleware.shibboleth.aa.attrresolv.provider.BaseAttributeDefinition

  2. Create a constructor that takes an org.w3c.dom.Element and be sure to call super(Element)

  3. Implement the logic to fetch attribtues in the resolve(ResolverAttribute, Principal, String, String, Dependencies) method

  4. Deploy your new definition within the !IdP; the extension mechanism provides a simple means to do this

By extending the BaseAttributeDefinition and calling its constructor it will take care of processing id, cacheTime, propagateErrors, and sourceName attributes as well as any DataConnectorDependency and AttributeDependency elements within your connector's configuration.

Configuring the Definition

  1. Create a CustomAttributeDefinition element, with its id attribute, and the following attribute:

    • class - the fully qualified name of your custom connector class

  2. Define any additional XML attributes or elements required to configure your class

Example Configuration

This uses the Scriplet definition as if it were a custom definition to demonstrate using additional XML information to configure the connector.

< CustomAttributeDefinition id="urn:mace:dir:attribute-def:eduPersonAffiliation" class="edu.internet2.middleware.shibboleth.aa.attrresolv.provider.ScriptletAttributeDefinition"> <DataConnectorDependency requires="directory"/> <Scriptlet> <![CDATA[ Attributes attributes = dependencies.getConnectorResolution("directory"); Attribute affiliation = attributes.get("eduPersonAffiliation"); if (affiliation.size() > 0) { resolverAttribute.addValue("affiliate"); } ]]> </Scriptlet> </CustomAttributeDefinition >