logoff.xts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2016
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  13. <!--
  14. ===============================================================================================
  15. Seassion Cleanup
  16. ===============================================================================================
  17. -->
  18. <xts:block id="logoff" type="exec" mode="interpret" processor="XSLT">
  19. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  20. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  21. <xsl:template match="/root">
  22. <xts:sequence>
  23. <!-- Fetch configuration information required for performing logoff -->
  24. <!-- Delete session cookies -->
  25. <!-- Make a list of all the cookies to delete -->
  26. <xsl:variable name="deleteCookies">
  27. <cookies>
  28. <xsl:if test="/root/cookies/cookie[@name='cc_session']">
  29. <cookie name="cc_session"/>
  30. </xsl:if>
  31. <xsl:if test="/root/cookies/cookie[@name='viewer_session']">
  32. <cookie name="viewer_session"/>
  33. </xsl:if>
  34. <xsl:if test="/root/cookies/cookie[@name='CRN']">
  35. <cookie name="CRN"/>
  36. </xsl:if>
  37. </cookies>
  38. </xsl:variable>
  39. <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']">
  40. <xsl:for-each select="$deleteCookies/cookies/cookie">
  41. <item xsi:type="bus:setCookieVar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  42. <name xsi:type="xsd:string"><xsl:value-of select="@name"/></name>
  43. <value xsi:type="xsd:string"></value>
  44. <maxAge xsi:type="xsd:int">-1</maxAge>
  45. </item>
  46. </xsl:for-each>
  47. </xts:append>
  48. </xts:sequence>
  49. </xsl:template>
  50. </xsl:stylesheet>
  51. </xts:block>
  52. <xts:block id="response" type="exec" mode="interpret" processor="XSLT" dependency="logoff">
  53. <xsl:stylesheet version="1.0"
  54. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  55. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  56. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  57. exclude-result-prefixes="xos">
  58. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  59. <xsl:template match="/">
  60. <xsl:variable name="isCustomLogoffEnabled" select="/root/system/param[@name='custom-auth']/logoff[@enabled='true']"/>
  61. <xsl:variable name="customURL" select="normalize-space(/root/system/param[@name='custom-auth']/logoff/redirect-url)"/>
  62. <xsl:variable name="loggoffURL">
  63. <xsl:choose>
  64. <xsl:when test="($isCustomLogoffEnabled) and (xtsext:cafaction('issafeurl_null', $customURL) = 'true' and $customURL != '')">
  65. <xsl:value-of select="$customURL"/>
  66. </xsl:when>
  67. <xsl:otherwise>../</xsl:otherwise>
  68. </xsl:choose>
  69. </xsl:variable>
  70. <xts:sequence>
  71. <xts:append select="/root/output">
  72. <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
  73. <xos:entityHeader>
  74. <xos:param name="Content-Type">text/html</xos:param>
  75. </xos:entityHeader>
  76. <xos:entityBody>
  77. <html>
  78. <head>
  79. <meta http-equiv="refresh" content="0; URL={$loggoffURL}"/>
  80. <title>Logout Redirect</title>
  81. </head>
  82. <body bgcolor="#ffffff"/>
  83. </html>
  84. </xos:entityBody>
  85. </xos:part>
  86. </xts:append>
  87. </xts:sequence>
  88. </xsl:template>
  89. </xsl:stylesheet>
  90. </xts:block>
  91. <!-- Debug -->
  92. <!-- ============================================================================= -->
  93. <xts:block id="debug" dependency="response" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html" condition=".[/root/env/param[@name='d'] = '1' or /root/session/param[@name='debug'] = '1']">
  94. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  95. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
  96. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  97. <dbg:templates/>
  98. <xsl:template match="/">
  99. <dbg:dumpxml select="/root"/>
  100. </xsl:template>
  101. </xsl:stylesheet>
  102. </xts:block>
  103. </xts:morphlet>