Format and constraints of rules
A Certificate User Mapping Rule must be defined as an XSL template in an XSL stylesheet. The rule must be written in a valid XSL template rule format. It must return a text document that contains one of the string identifiers shown in User mapping rules evaluator.
The identifiers must be the only text in the output document, although they can be surrounded by white space. If a value other than the defined values or an empty document is returned, the user mapping fails and an error code is returned to the CDAS to indicate that the rule is not compliant.
The result of the XSL transformation performed by an XSL Certificate User Mapping Rule must be a text output document that contains only one of the supported string identifiers.
stsuuser:STSUniversalUser.
The condition that the rule evaluates is expressed as follows:
<?xml version="1.0" encoding='UTF-8'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:stsuuser=
"urn:ibm:names:ITFIM:1.0:stsuuser" version="1.0">
<!-- Required to constrain output of rule evaluation -->
<xsl:output method="text" omit-xml-declaration="yes" encoding='UTF=8' indent=
"no"/>
<!-- Need this to ensure default text node printing is off -->
<xsl:template match="text()"></xsl:template>
<!-- Let's make it easier by matching the constant part of our XML name -->
<xsl:template match="/XMLUMI/stsuuser:STSUniversalUser/stsuuser:AttributeList">
<!-- If this certificate was issued by our CA, just use the subject dn -->
<xsl:when test='stsuuser:Attribute[@name="IssuerDN"]/stsuuser:Value =
"cn=ca,o=ibm,c=au"'>
!<xsl:value-of select="stsuuser:Attribute[@name='SubjectDN']/
stsuuser:Value"/>!
</xsl:when>
<!-- If this certificate was issued by the tivoli CA, search for the
certificate serial number -->
<xsl:when test='stsuuser:Attribute[@name="IssuerDN"]/stsuuser:Value =
"cn=ca,o=tivoli,c=au"'>
!userreg base='o=ibm,c=us' attr='cn'!secCertSerialNumber=<xsl:
value-of select="stsuuser:Attribute[@name='SerialNumber']/
stsuuser:Value"/>!
</xsl:when>
<!-- Otherwise we don't have a matching rule.'no-matching-rule' is a
special string. -->
<xsl:otherwise>
!no-matching-rule!
</xsl:otherwise>
</xsl:template>
</xsl:stylesheet>
To reference any data item
in the document, the XPath to each node
must include the XMLUMI node. When a rule is built,
the
rule writer must understand what the correct XPath is from the current
point in the tree, in order to access the XML data nodes and subnodes.
The current point in the tree is selected by using the template match
statement. The template match statement allows an XSL programmer to
shorten the XPath to each data element by specifying that the XPath
processing must occur further down the XML document tree.
The <xsl:template
match="/XMLUMI/stsuuser:STSUniversalUser/stsuuser:AttributeList"> statement
tells the XSL processor that all relative XPaths within the bounds
of the template statement should be assumed to be relative to the
node "/XMLUMI/stsuuser:STSUniversalUser/stsuuser:AttributeList".
For example, "/XMLUMI/stsuuser:STSUniversalUser/stsuuser:AttributeList/stsuuser:Attribute[@name='IssuerDN']/stsuuser:Value" can
be referred to as simply "stsuuser:Attribute[@name='IssuerDN']/stsuuser:Value".