Scenario 6: Adding a credential attribute value to the response

This scenario illustrates how a HTTPResponseChange document can be used to add a credential attribute value to the response.

Input documents

The following sample input document is used for this scenario:

XSLT Rules

Note: These rules must be stored in an XSL document that is defined as a response resource with an associated POP. See Configuration.
<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        version="1.0"> 

  <xsl:strip-space elements="*" /> 

  <xsl:template match="/"> 
    <HTTPResponseChange> 
      <xsl:apply-templates /> 
    </HTTPResponseChange> 
  </xsl:template> 

  <xsl:template match="//HTTPResponse/ResponseLine/StatusCode"/> 
  <xsl:template match="//HTTPResponse/ResponseLine/Reason"/> 
  <xsl:template match="//HTTPResponse/ResponseLine/Version"/> 

  <xsl:template match="//HTTPResponse/Credential/Attributes/Attribute"> 
    <xsl:choose> 
      <xsl:when test="contains(@name, 'AZN_CRED_PRINCIPAL_NAME')"> 
        <Header action="add" name="hdr-2"><xsl:value-of select="node()"/></Header> 
      </xsl:when> 
    </xsl:choose> 
  </xsl:template> 

</xsl:stylesheet> 

Output XML document

In this scenario, the following XML document is output from the XSL transformation. This document defines the response that WebSEAL provides to the original HTTP request.

<?xml version="1.0" encoding="UTF-8"?>
<HTTPResponseChange action="replace">
	<Version>HTTP/1.1</Version>
	<StatusCode>503</StatusCode>
	<Reason>Not Implemented<Reason>
	<Header name="principal-name" action="add">testuser</Header>
</HTTPResponseChange>