Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A template attribute definition uses the Velocity Template Language to construct values from its dependencies.

Warning

Note that at present, it is only safe/useful to use a DataConnector as a dependency to this plugin. Using an AttributeDefinition as a dependency (no matter the type) will produce very confusing results.

1. Define the Definition

The definition is defined with the element <resolver:AttributeDefinition xsi:type="Template" xmlns="urn:mace:shibboleth:2.0:resolver:ad"> with the following required attribute:

...

Code Block
xml
xml
titleBasic Template Attribute Definition

<resolver:AttributeDefinition xsi:type="Template" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
                              id="UNIQUE_ID">

     <!-- Remaining configuration from the next step go here -->

</resolver:AttributeDefinition>

...

Dependencies are expressed by the <resolver:Dependency> with a ref attribute whose value is the unique ID of the attribute definition or the data connector that this connector depends on.

Code Block
xml
xml
titleBasic Template Attribute Definition with Dependencies
<resolver:AttributeDefinition xsi:type="Template" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
                              id="UNIQUE_ID">

     <resolver:Dependency ref="DEFINITIONCONNECTOR_ID_1" />
     <resolver:Dependency ref="DEFINITION_ID_2" />
     <resolver:Dependency ref="CONNECTOR_ID_3" />
     <resolver:Dependency ref="CONNECTOR_ID_41" />

     <!-- Remaining configuration from the next step go here -->

</resolver:AttributeDefinition>

...

Template attribute definitions require one or more <SourceAttribute> elements to define which attributes from the definitionconnector's dependencies will be made available to the template engine. Note, every source attribute must have the same number of values.

The template is defined using a single <Template> element. If no template is defined, a default template is used which combines all source attributes into a space-delimited list.

...

Code Block
xml
xml
titleBasic Template Attribute Definition

<resolver:AttributeDefinition xsi:type="Template" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
                              id="eduCourseOffering">

     <resolver:Dependency ref="myDatabase" />

     <Template>
          <![CDATA[
               http://example.edu/courses/${academic_term}/${course_id}/${course_section}
          ]]>
     </Template>

     <SourceAttribute>academic_term</SourceAttribute>
     <SourceAttribute>course_id</SourceAttribute>
     <SourceAttribute>course_section</SourceAttribute>

</resolver:AttributeDefinition>