GenerateHashCode

From Plex-XML

Jump to: navigation, search

See Secured Fields for the usage of hash codes in web requests.

1. Extend your stylesheet header:

 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:sec="http://xml.apache.org/xalan/java/de.bodow.web.SecurityIDGenerator" 
  exclude-result-prefixes="sec">

2. Get variables with Session-Id and Request-Name:

 <xsl:variable name="sessionID"><xsl:value-of select="/responses/session-attribute[@name='SessionID']/@value"/></xsl:variable>
 <xsl:variable name="request" select="ancestor-or-self::response/@request-name"/>

3. Get an hash code generator instance:

 <xsl:variable name="sgen" select="sec:new($sessionID,$request)"/>

4. Extend the code field by field:

 <xsl:for-each select="UpdateKey/returnvalue">
  <xsl:value-of  select="sec:add($sgen,@name,@unformatted)"/>
 </xsl:for-each>

5. Get the hash code:

 <xsl:variable name="hashcode"  select="sec:finish($sgen)"/>


6. Append the hash code to the field list:

 <field name="h" type="hidden">
  <xsl:value-of select="$hashcode"/>
 </field>
Personal tools