initCookie.xts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2011
  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. <!-- $Header: //cpscrn/main/templates/cps4/portlets/nav/portlet-impl/initCookie.xts#1 $ -->
  13. <!-- $DateTime: 2008/10/22 11:12:04 $ -->
  14. <!-- $Change: 25109 $ -->
  15. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  16. <xts:block id="login" type="exec" mode="interpret" processor="XSLT">
  17. <xts:logicsheet path="/cps4/producer/logicsheets/cps-portlet.xslt"/>
  18. <xsl:stylesheet version="1.0"
  19. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20. xmlns:portlet="http://developer.cognos.com/schemas/cps/logic/portlet/1/"
  21. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  22. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  23. <xsl:template match="/">
  24. <xts:sequence>
  25. <xts:append>
  26. <xsl:variable name="navService">interface://crn</xsl:variable>
  27. <login>
  28. <xts:request protocol="NAV" target="{ $navService }" soapAction="cps.run" responseEnvelope="true">
  29. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  30. <xsl:copy-of select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header"/>
  31. <SOAP-ENV:Body>
  32. <nav:login xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/">
  33. <nav:method>sso</nav:method>
  34. </nav:login>
  35. </SOAP-ENV:Body>
  36. </SOAP-ENV:Envelope>
  37. </xts:request>
  38. </login>
  39. </xts:append>
  40. </xts:sequence>
  41. </xsl:template>
  42. </xsl:stylesheet>
  43. </xts:block>
  44. <xts:block id="response" dependency="login" type="exec" mode="interpret" processor="XSLT">
  45. <xts:logicsheet path="/cps4/producer/logicsheets/cps-portlet.xslt"/>
  46. <xsl:stylesheet version="1.0"
  47. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  48. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  49. xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
  50. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  51. xmlns:portlet="http://developer.cognos.com/schemas/cps/logic/portlet/1/">
  52. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  53. <xsl:template match="/">
  54. <xts:sequence>
  55. <xts:append select="/root/output/*[local-name()='protocolHeader']">
  56. <xsl:variable name="op" select="/root/login/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
  57. <xsl:for-each select="$op/nav:credential">
  58. <!-- the userCapabilities cookie is already being generated and it has a signature -->
  59. <xsl:if test="@name != 'userCapabilities'">
  60. <xos:param name="Set-Cookie">
  61. <xsl:value-of select="@name"/>
  62. <xsl:text>=</xsl:text>
  63. <xsl:value-of select="."/>
  64. </xos:param>
  65. </xsl:if>
  66. </xsl:for-each>
  67. <!-- SAP-HACK-START -->
  68. <xsl:variable name="userCategory" select="/root/cookies/cookie[@name = 'userCategory']"/>
  69. <xsl:if test="$userCategory">
  70. <xos:param name="Set-Cookie">
  71. <xsl:text>userCategory=</xsl:text>
  72. <xsl:value-of select="$userCategory"/>
  73. </xos:param>
  74. </xsl:if>
  75. <!-- SAP-HACK-END -->
  76. </xts:append>
  77. </xts:sequence>
  78. <portlet:soap-response>
  79. <portlet:response/>
  80. </portlet:soap-response>
  81. </xsl:template>
  82. </xsl:stylesheet>
  83. </xts:block>
  84. </xts:morphlet>