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: Chad La Joie <>
  • To: Shibboleth Development <>
  • Subject: Re: [Shib-Dev] How enable a DataConnector to get all attribute definitions
  • Date: Mon, 20 Apr 2009 06:46:03 -0400
  • Openpgp:
  • Organization: SWITCH

Have you defined the attribute definitions and data connectors upon
which yours depends as actual dependencies?

Markus Ludwig Grandpre wrote:
> Another trial:
>
> public Map<String, BaseAttribute> resolve(
> ShibbolethResolutionContext resolutionContext)
> throws AttributeResolutionException
> {
> ...
>
> Set <Entry<String, ResolutionPlugIn>> s = r.entrySet();
>
> for (Entry<String, ResolutionPlugIn> e : s)
> {
> log.debug("Key: " + e.getKey());
> log.debug("Value: " + e.getValue());
> }
> ...
> }
>
> with same results:
>
> DEBUG MyShibbolethDataConnector.java(85): Key: eduPersonPrincipalName
> DEBUG MyShibbolethDataConnector.java(86): Value:
> edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attrib
>
> uteDefinition.ContextualAttributeDefinition@31db04
> DEBUG MyShibbolethDataConnector.java(85): Key: myShibboleth
> DEBUG MyShibbolethDataConnector.java(86): Value:
> edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataCo
>
> nnector.ContextualDataConnector@1220fd1
>
> One DataConnector object and only ONE AttributeDefiniton object (instead
> of expected THREE objects according to attribute-filter.xml).
>
> Any help is highly appreciated,
> Markus
>
>
>
> Markus Ludwig Grandpre wrote:
>> 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

--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Net Services
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
,
http://www.switch.ch




Archive powered by MHonArc 2.6.16.

Top of Page