17 oct 2016

Part II: Change JSESSIONID of WebCenter Content with a deploy-plan

As mentioned on my previous post, I was trying to modify the cookie with a deploy plan of weblogic to avoid file-system modification.

Finally after a few hours of test I found the good XPath syntax.

This is de plan.xml file


<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
  <application-name>cs.ear</application-name>
  <variable-definition>
    <variable>
      <name>ucmParamValue</name>
      <value>UCMJSESSIONID</value>
    </variable>
 <variable>
      <name>ucmParamName</name>
      <value>IdcSessionKey</value>
    </variable>
  </variable-definition>
  <module-override>
    <module-name>cs.ear</module-name>
    <module-type>ear</module-type>
    <module-descriptor external="false">
      <root-element>weblogic-application</root-element>
      <uri>META-INF/weblogic-application.xml</uri>
    </module-descriptor>
    <module-descriptor external="false">
      <root-element>application</root-element>
      <uri>META-INF/application.xml</uri>
    </module-descriptor>
    <module-descriptor external="true">
      <root-element>wldf-resource</root-element>
      <uri>META-INF/weblogic-diagnostics.xml</uri>
    </module-descriptor>
  </module-override>
  <module-override>
    <module-name>cs.war</module-name>
    <module-type>war</module-type>
    <module-descriptor external="false">
      <root-element>weblogic-web-app</root-element>
      <uri>WEB-INF/weblogic.xml</uri>
   <variable-assignment>
  <name>ucmParamValue</name>
  <xpath>/weblogic-web-app/session-descriptor/cookie-name</xpath>
  <operation>add</operation>
   </variable-assignment>
    </module-descriptor>
    <module-descriptor external="false">
      <root-element>web-app</root-element>
      <uri>WEB-INF/web.xml</uri>
   <variable-assignment>
  <name>ucmParamName</name>
  <xpath>/web-app/filter/[filter-name="JpsFilter"]/init-param/param-name</xpath>
  <operation>add</operation>
   </variable-assignment>
   <variable-assignment>
  <name>ucmParamValue</name>
  <xpath>/web-app/filter/[filter-name="JpsFilter"]/init-param/[param-name="IdcSessionKey"]/param-value</xpath>
  <operation>add</operation>
   </variable-assignment>
   <variable-assignment>
  <name>ucmParamName</name>
  <xpath>/web-app/filter/[filter-name="IdcFilter"]/init-param/param-name</xpath>
  <operation>add</operation>
   </variable-assignment>
   <variable-assignment>
  <name>ucmParamValue</name>
  <xpath>/web-app/filter/[filter-name="IdcFilter"]/init-param/[param-name="IdcSessionKey"]/param-value</xpath>
  <operation>add</operation>
   </variable-assignment>
   <variable-assignment>
  <name>ucmParamName</name>
  <xpath>/web-app/servlet/[servlet-name="adfAuthentication"]/init-param/param-name</xpath>
  <operation>add</operation>
   </variable-assignment>
   <variable-assignment>
  <name>ucmParamValue</name>
  <xpath>/web-app/servlet/[servlet-name="adfAuthentication"]/init-param/[param-name="IdcSessionKey"]/param-value</xpath>
  <operation>add</operation>
   </variable-assignment>
    </module-descriptor>
  </module-override>
  <module-override>
    <module-name>dav.war</module-name>
    <module-type>war</module-type>
    <module-descriptor external="false">
      <root-element>weblogic-web-app</root-element>
      <uri>WEB-INF/weblogic.xml</uri>
    </module-descriptor>
    <module-descriptor external="false">
      <root-element>web-app</root-element>
      <uri>WEB-INF/web.xml</uri>
    </module-descriptor>
  </module-override>
  <config-root>/home/oracle/</config-root>
</deployment-plan>