Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
DirXML 1.1 introduced a new feature that allows an event on the publisher channel to trigger a password modification on a user in eDirectory. Typically, this would be used to synchronize the eDirectory password with an application password. The application passes the password to DirXML in clear text and DirXML will generate the eDirectory password based on the clear-text value passed to it. To use this functionality a stylesheet must be written to detect the clear-text value coming into the publisher channel and then use that value to set the password accordingly. In addition to stylesheet changes, a number of other changes must be made to allow the clear-text value to be passed.
The Stylesheet
There are many ways to accomplish this transformation. We've chosen to do it using the Command Transformation rule for a few reasons, the primary being the Command Transformation Rule's ability to act on Merge events.
There are two templates in our stylesheet that detect events on the "Description" attribute. One detects every time a user is added with a description attribute. When this is detected the value is taken from the Description attribute and inserted into a <password> element. The template looks like this:
<xsl:template match="add[@class-name='User']/add-attr[@attr-name='Description']">
<password><xsl:value-of select="value"/></password>
</xsl:template>
The second template detects every time the description attribute is modified on an existing user. When this action is detected, the value is taken from the Description attribute and inserted into a <modify-password> element. The <modify-password> element is then sent to eDirectory using the Channel Write-Back feature of DirXML. The template looks like this:
<xsl:template match="modify[@class-name='User']/modify-attr[@attr-name='Description']">
<!-- First we generate the XDS fragment with the password Change -->
<xsl:variable name="cmd-change-pw">
<modify-password class-name="User" dest-dn="{../@dest-dn}">
<password><xsl:value-of select="add-value/value"/></password>
</modify-password>
</xsl:variable>
<!-- Now we send the XDS fragment generated above to the dest Directory -->
<xsl:variable name="results" select="cmd:execute($destCommandProcessor, $cmd-change-pw)"/>
</xsl:template>
The entire stylesheet looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="cmd"
xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"
xmlns:cmd="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsCommandProcessor">
<!--These are the two parameters that are needed for Channel Write-Back -->
<xsl:param name="srcCommandProcessor"/>
<xsl:param name="destCommandProcessor"/>
<!-- This is the identity template that copies otherwise unmatched items to the result -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="modify[@class-name='User']/modify-attr[@attr-name='Description']">
<!-- First we generate the XDS fragment with the password Change -->
<xsl:variable name="cmd-change-pw">
<modify-password class-name="User" dest-dn="{../@dest-dn}">
<password><xsl:value-of select="add-value/value"/></password>
</modify-password>
</xsl:variable>
<!-- Now we send the XDS fragment generated above to the dest Directory -->
<xsl:variable name="results" select="cmd:execute($destCommandProcessor, $cmd-change-pw)"/>
</xsl:template>
<xsl:template match="add[@class-name='User']/add-attr[@attr-name='Description']">
<password><xsl:value-of select="value"/></password>
</xsl:template>
</xsl:stylesheet>