Módosítások

Attribute Conversion for eduGAIN

238 bájt hozzáadva, 2008. szeptember 3., 14:47
Attribute conversion rule types
Basic Rule can create static attributes. You can archieve this by omitting the Condition node. The replaceValues parameter is true by default, so if you want to append values to (probably) existing attributes, you must declare it using replaceValues="false". Also note you can use multiple AttributeValue nodes.
<source lang="xml">
<BasicRule>
<Description>Create static attribute (or append to existing if attribute with this name already exists)</Description>
</Attribute>
</BasicRule>
</source>
The next rule is using remote provider matching to determine whether the remote side has an identifier of 'urn:geant:edugain:be:' and any hungarian domain appended to it.
<source lang="xml">
<BasicRule>
<Description>Create static attribute for some remote providers</Description>
</Attribute>
</BasicRule>
</source>
This example shows how to rename an attribute without converting its values. Note that you must use AttributeMatch without regular expressions to archieve this.
<source lang="xml">
<BasicRule>
<Description>Rename attribute uid to edupersonPrincipalName</Description>
<AttributeValue>${uid}</AttributeValue>
</Attribute>
</BasicRule>
</source>
The next example demonstrates the use of regular expression matching groups.
<source lang="xml">
<BasicRule>
<Decription>Transform o=org,c=country style OrgDN to dns-based homeOrganization</Decription>
<AttributeValue>${regex[1]}.${regex[2]}</AttributeValue>
</Attribute>
</BasicRule>
</source>
This latter needs some more explanation. When you want to reference the regular expression matching groups (enclosed by parentheses), you must define the reference name with the 'id' parameter of AttributeMatch. Then, use ${id[0]} to refer to the whole regular expression match (ie. the whole attribute value), and ${id[N]} to refer to the Nth. matching group of the regular expression. You cannot reference other rule's regular expressions.
This example shows how to combine two attribute values:
<source lang="xml">
<MergeRule>
<Description>Merges the uid and homeOrganization to edupersonPrincipalName</Description>
</Attribute>
</MergeRule>
</source>
You can also use regular expressions, as with BasicRule.
The SplitRule is very similar to the MergeRule, the only difference is that the SplitRule containes one InputAttribute and more Attribute nodes.
<source lang="xml">
<SplitRule>
<Description>Split the edupersonScopedEntitlement to edupersonEntitlement and homeOrganization</Description>
</Attribute>
</SplitRule>
</source>
=== CustomRule ===
When you need to programatically create new attributes (eg. appending generated identifiers), you can use the CustomRule type.
<source lang="xml">
<CustomRule className="org.test.MyCustomRuleImpl">
<Configuration>
</Configuration>
</CustomRule>
</source>
CustomRule class must implement the net.geant.edugain.attributes.rules.Rule interface, configuration can be read with the DOM API. Please refer to the Attribute Converter JavaDOC, and see the test package as it containes a sample implementation.
565
szerkesztés

Navigációs menü