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

CustomDataConnector

Writing a Custom Data Connector

If the current data connectors 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.BaseDataConnector
  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(Principal, String, String, Dependencies) method
  4. Deploy your new connector within the !IdP; the extension mechanism provides a simple means to do this

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

%INCLUDE{"DataConnectorBasics"}%

Configuring the Connector

  1. Create a CustomDataConnector 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 JDBC connector as if it were a custom connector to demonstrate using additional XML information to configure the connector.

< CustomDataConnector id="db2"
			class="edu.internet2.middleware.shibboleth.aa.attrresolv.provider.JDBCDataConnector"
			dbURL="jdbc:postgresql://test.example.edu/test?user=postgres&amp;password=test" 
			dbDriver="org.postgresql.Driver"
			maxActive="10" 
			maxIdle="5">
	 <DataConnectorDependency requires="echo"/>
	 <AttributeDependency requires="urn:mace:dir:attribute-def:eduPersonEntitlement"/>
	 <Query>select date from foo where principalName = ? and entitlement = ?</Query>
	 <StatementCreator class="edu.internet2.middleware.shibboleth.aa.attrresolv.provider.DependencyStatementCreator">
		  <Parameter type="String" attributeName="eduPersonPrincipalName" connectorId="echo" nullMissing="false" />
		  <Parameter type="String" attributeName="urn:mace:dir:attribute-def:eduPersonEntitlement" nullMissing="false" />
	 </StatementCreator>
</CustomDataConnector >

%INCLUDE{"DataConnectorDependencies"}%

%INCLUDE{"DataConnectorErrorAndCache"}%