Data Connector Extensions

This information is meant to be used in conjunction with the Creating Custom IdP Extensions - General Overview guide.

Classes, Schema Types, and Schema Files

Example Extension

Extension Class

public class MyDataConnector extends BaseDataConnector {

	private String lookupUrl; //This is an example custom field, yours may vary (if any)

	public MyDataConnector(String url) {
		this.lookupUrl = url;

	public Map<String, BaseAttribute> resolve(ShibbolethResolutionContext resolutionContext) 
				throws AttributeResolutionException {
		Map<String, BaseAttribute> result = new HashMap<String, BaseAttribute>();
		String username = resolutionContext.getAttributeRequestContext().getPrincipalName();
		// add BasicAttributes to the result here.
		return result;

Note that your extension class must return a non-null result, even if there are no attributes to return.

Extension Schema

Located in your JAR file as schema/myConnectors.xsd. (Note this name is not special in anyway, it must just match between the locations it is referenced)

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="" 

    <import namespace="urn:mace:shibboleth:2.0:resolver"
        schemaLocation="classpath:/schema/shibboleth-2.0-attribute-resolver.xsd" />

    <complexType name="UserLookup">
               Description of your data connector.
            <extension base="resolver:BaseDataConnectorType">
                <attribute name="lookupUrl" type="string" use="required">
                            This is an example of a custom attribute called "lookupUrl". 
                            Look in the shib-common.jar at schema/shibboleth-2.0-attribute-resolver-dc.xml 
                            for more examples of how to define custom attributes and elements.

Bean Definition Parser

public class MyDataConnectorBeanDefinitionParser  extends BaseDataConnectorBeanDefinitionParser {

    public static final QName SCHEMA_NAME = new QName(MyDataConnectorNamespaceHandler.NAMESPACE, "UserLookup");

    protected Class getBeanClass(Element element) {
        return MyDataConnectorFactoryBean.class;

    protected void doParse(Element element, BeanDefinitionBuilder builder) {
        super.doParse(element, builder);
        String lookupUrl = pluginConfig.getAttributeNS(null, "lookupUrl");
        builder.addPropertyValue("lookupUrl", lookupUrl);

Bean Factory

public class MyDataConnectorFactoryBean extends BaseDataConnectorFactoryBean {

    private String lookupUrl;

    public Class getObjectType() {
        return MyDataConnector.class;

    protected Object createInstance() throws Exception {
    	MyDataConnector connector = new MyDataConnector(getLookupUrl());
        return connector;

    public void setLookupUrl(String url) { this.lookupUrl = url; }
    public String getLookupUrl() { return this.lookupUrl; }


Namespace Handler

public class MyDataConnectorNamespaceHandler extends BaseSpringNamespaceHandler {

    public static String NAMESPACE = "";

    public void init() {
                                    new MyDataConnectorBeanDefinitionParser());

spring.schemas File

Located in your JAR file as META-INF/spring.schemas.

urn\\:shibboleth\:2.0\:resolver = schema/myConnectors.xsd

spring.handlers File

Located in your JAR file as META-INF/spring.handlers.

urn\\:shibboleth\:2.0\:resolver =  com.example.shibboleth.MyDataConnectorNamespaceHandler

attribute-resolver.xml File

Now you can make use of your DataConnector via atribute-resolver.xml.

Declare your name space, add your XML schema file to the documents schemaLocation and add your DataConnector:

<ProfileHandlerGroup xmlns="urn:mace:shibboleth:2.0:idp:profile-handler"
                     xsi:schemaLocation="urn:mace:shibboleth:2.0:idp:profile-handler classpath:/schema/shibboleth-2.0-idp-profile-handler.xsd
    <resolver:DataConnector id="userLookupAttributes" xsi:type="UserLookup" xmlns="" lookupUrl=""/>