123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2015
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="env-param" match="/root/env/param" use="@name"/>
-
- <xsl:variable name="portal.protectSessionCookies" select="string(/root/configProps/param[@name='cc']/property[@name='portal.protectSessionCookies']) = 'true'"/>
-
- <xsl:template match="/root">
- <xts:sequence>
-
- <!-- In a "pure" SOAP request to XTS the setCookieVars element may not exist. If not, we will need to create one. -->
- <xsl:if test="not(/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']/*[local-name() = 'Header']/*[local-name() = 'biBusHeader']/*[local-name() = 'hdrSession']/*[local-name() = 'setCookieVars'])">
- <xts:append select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']/*[local-name() = 'Header']/*[local-name() = 'biBusHeader']/*[local-name() = 'hdrSession']">
- <bus:setCookieVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:setCookieVar[]"/>
- </xts:append>
- </xsl:if>
-
- <xts:append select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']/*[local-name() = 'Header']/*[local-name() = 'biBusHeader']/*[local-name() = 'hdrSession']/*[local-name() = 'setCookieVars']">
- <item xsi:type="bus:setCookieVar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <name xsi:type="xsd:string">cc_session</name>
- <value xsi:type="xsd:string">
- <xsl:variable name="d1" select="system/param[@name = 'delimiters']/@d1"/>
- <xsl:variable name="d2" select="system/param[@name = 'delimiters']/@d2"/>
- <xsl:variable name="cc_session_cookie">
- <xsl:variable name="cc_session_value">
- <xsl:for-each select="/root/session/*[ not( @name='ssshsh' or starts-with(@name,'b_') or @name = 'edit' or @name = 'debug' or @name = 'us' or @type='CRN' or @type='NOPATH') ]">
- <xsl:if test="position() != 1">
- <xsl:value-of select="$d1"/>
- </xsl:if>
- <xsl:value-of select="@name"/><xsl:value-of select="$d2"/>
- <xsl:choose>
- <!-- Encode these values since they may contain none-ascii chars. -->
- <xsl:when test="starts-with(@name, 'e_')">
- <xsl:value-of select="xtsext:encodeCCSessionValue(string(.))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$portal.protectSessionCookies">
-
- <!-- Note: Will switch to xtsext:protectCCSessionCookie() call in main -->
-
- <xsl:variable name="signed" select="string(xtsext:validator('prepare','cc_session',$cc_session_value))"/>
- <xsl:variable name="hash" select="substring-before(string($signed),'|')"/>
- <xsl:variable name="hash_ccSessionEncoded" select="xtsext:encodeCCSessionValue(string($hash))"/>
-
- <xsl:value-of select="'ssshsh'"/>
- <xsl:value-of select="$d2"/>
- <xsl:value-of select="$hash_ccSessionEncoded"/>
- <xsl:value-of select="'|'"/>
- <xsl:value-of select="$cc_session_value"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$cc_session_value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="$cc_session_cookie"/>
- </value>
- <maxAge xsi:type="xsd:int">0</maxAge>
- </item>
-
- <!-- MVC -->
- <!-- Build a server-independent cookie to indicate mvc is enabled. This is used to in authentication, goHome, etc... functionalities -->
- <xsl:for-each select="/root/session/*[@type='NOPATH']">
- <item xsi:type="bus:setCookieVar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <name xsi:type="xsd:string"><xsl:value-of select="@name"/></name>
- <value xsi:type="xsd:string"></value>
- <path xsi:type="xsd:string">/</path>
- <maxAge xsi:type="xsd:int">0</maxAge>
- </item>
- </xsl:for-each>
-
- <!-- Delete any cookie(s) if requested -->
- <xsl:for-each select="/root/deleteCookies/cookies/cookie">
- <item xsi:type="bus:setCookieVar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <name xsi:type="xsd:string"><xsl:value-of select="@name"/></name>
- <value xsi:type="xsd:string"></value>
- <maxAge xsi:type="xsd:int">-1</maxAge>
- </item>
- </xsl:for-each>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
|