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:
- Create a class that extends
edu.internet2.middleware.shibboleth.aa.attrresolv.provider.BaseDataConnector
- Create a constructor that takes an
org.w3c.dom.Element
and be sure to callsuper(Element)
- Implement the logic to fetch attribtues in the
resolve(Principal, String, String, Dependencies)
method - 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
- Create a CustomDataConnector element, with its id attribute, and the following attribute:
- class - the fully qualified name of your custom connector class
- 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&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"}%