Skip to Content.
Sympa Menu

shibboleth-dev - Re: [Shib-Dev] How enable a DataConnector to get all attribute definitions

Subject: Shibboleth Developers

List archive

Re: [Shib-Dev] How enable a DataConnector to get all attribute definitions


Chronological Thread 
  • From: Markus Ludwig Grandpre <>
  • To:
  • Subject: Re: [Shib-Dev] How enable a DataConnector to get all attribute definitions
  • Date: Mon, 20 Apr 2009 11:14:57 +0200

Hello,

meanwhile I've changed the Java code that I've presented within my last mail. Now I'm trying to retrieve all attribute definitions from attribute-resolver.xml by the use of resolution plugin objects:

public Map<String, BaseAttribute> resolve(
ShibbolethResolutionContext resolutionContext)
throws AttributeResolutionException
{
...

Map <String, ResolutionPlugIn> r = resolutionContext.getResolvedPlugins();
Collection<ResolutionPlugIn> values = r.values();

for (Iterator i = values.iterator(); i.hasNext(); )
{
ResolutionPlugIn plugin = (ResolutionPlugIn) i.next();

if (plugin instanceof DataConnector)
{
log.debug("Found DataConnector: " + plugin.getId());
}

if (plugin instanceof AttributeDefinition)
{
log.debug("Found AttributeDefinition: " + plugin.getId());
}
}
...
}

Result:

DEBUG MyShibbolethDataConnector.java(75): Found AttributeDefinition: eduPersonPrincipalName
DEBUG MyShibbolethDataConnector.java(70): Found DataConnector: myShibboleth

As you can see, there is one DataConnector object but only ONE AttributeDefinition object found, although I've defined THREE attribute definitions in attribute-resolver.xml. Maybe there is a configuration error when my BaseDataConnector implementation is initialized or called? This is the corresponding xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="urn:mace:unikn:shibboleth:resolver"
xmlns="http://www.w3.org/2001/XMLSchema";
xmlns:resolver="urn:mace:shibboleth:2.0:resolver"
elementFormDefault="qualified">

<import namespace="urn:mace:shibboleth:2.0:resolver"

schemaLocation="classpath:/schema/shibboleth-2.0-attribute-resolver.xsd" />

<complexType name="MyShibbolethDataConnector">
<annotation>
<documentation>
Description of your data connector.
</documentation>
</annotation>
<complexContent>
<extension base="resolver:BaseDataConnectorType">
<attribute name="attr1" type="string" use="optional"/>
</extension>
</complexContent>
</complexType>
</schema>

When I was programming corresponding FactoryBean and NamespaceHandler classes, I've followed the example at:

https://spaces.internet2.edu/display/SHIB2/IdPDevExtDataCtr

How can I enable my BaseDataConnector implementation to get all attribute definitions?

Best regards,
Markus




wrote:
Hello,

I'm currently implementing an DataConnector for Shibboleth IdP 2.1. Within my attribute-resolver.xml config file I've defined three attributes
to be resolved:

<resolver:AttributeDefinition
id="eduPersonEntitlement"
xsi:type="Simple"
xmlns="urn:mace:shibboleth:2.0:resolver:ad"
sourceAttributeID="eduPersonEntitlement">
<resolver:Dependency ref="myShibboleth" />
<resolver:AttributeEncoder
...
</resolver:AttributeDefinition>

<resolver:AttributeDefinition
id="eduPersonPrincipalName"
xsi:type="Simple"
xmlns="urn:mace:shibboleth:2.0:resolver:ad"
sourceAttributeID="cn">
<resolver:Dependency ref="myShibboleth" />
<resolver:AttributeEncoder
...
</resolver:AttributeDefinition>

<resolver:AttributeDefinition
id="eduPersonScopedAffiliation"
xsi:type="Scoped"
xmlns="urn:mace:shibboleth:2.0:resolver:ad"
scope="uni-konstanz.de"
sourceAttributeID="eduPersonAffiliation">
<resolver:Dependency ref="myShibboleth" />
...
</resolver:AttributeDefinition>

and the corresponding DataConnector:

<resolver:DataConnector
id="myShibboleth"
xsi:type="MyShibbolethDataConnector"
xmlns="urn:mace:unikn:shibboleth:resolver" attr="test"/>

The following BaseDataConnector implementation:

public class MyShibbolethDataConnector extends BaseDataConnector
{
...

public Map<String, BaseAttribute> resolve(
ShibbolethResolutionContext resolutionContext)
throws AttributeResolutionException
{
...

Map<String, AttributeDefinition> map = resolutionContext.
getResolvedAttributeDefinitions();

if (map == null || map.isEmpty())
{
log.error("no attribute defnitions found for " + getId());
}
else
{
for (Iterator<String> it = map.keySet().iterator(); it.hasNext(); )
{
log.debug(it.next());
}
}
...
}
...
}

returns only one attribute definition:
DEBUG MyShibbolethDataConnector.java(71): eduPersonPrincipalName

How do I get all attribute definitions that reference the corresponding DataConnector object?

Please help,
Markus



Archive powered by MHonArc 2.6.16.

Top of Page