cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing the session timeout at build time

Changing the session timeout at build time

Especially during development, it can be useful to have your session in IdentityIQ timeout after more than the default 30 minutes. In order to extend the default session duration, the file WEB-INF/web.xml needs to be updated.

 

To manually make this change, look for the following code:

    <!--

    <session-config>

      <session-timeout>30</session-timeout>

    </session-config>

    -->

 

Remove the comment markers (<!-- and -->)and change the default value (30) to the desired amount of minutes, for example 480 for 8 hours:

    <session-config>

      <session-timeout>480</session-timeout>

    </session-config>

 

This change can be automated using the services standard build, by enabling custom modifications and adding an extra build script to the scripts folder. To enable custom modifications, edit the file build.properties and change the property runCustomScripts (default is false, change to true).

runCustomScripts=true

 

You may want to remove or disable some of the custom examples in the scripts folder:

  • build.custom.Example-Extend-idAttrs.xml
  • build.custom.Example-Modify-WEB-XML.xml
  • build.custom.tomcat6.xml

They can be disabled by post-fixing the names with e.g. ".disabled".

 

The following code, also attached as a downloadable file, can then be places into the scripts folder. It is possible to change the file, so you can set different timeouts for different environments. E.g. 480 minutes for development and 60 for production.

 

File: build.custom.modify-web_xml_timeout.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project name="services.standard.build.custom.web_xml_timeout.xml">



    <target name="web_xml_timeout" description="Change session timeout in web.xml">

        <!-- timeout set to 480 minutes /  8 hours -->

        <replaceregexp file="${build}/extract/WEB-INF/web.xml" match="&lt;!--\s*$\s*&lt;session-config&gt;" replace="&lt;session-config&gt;" flags="m" />

        <replaceregexp file="${build}/extract/WEB-INF/web.xml" match="&lt;/session-config&gt;\s*$\s*--&gt;" replace="&lt;/session-config&gt;" flags="m" />

        <replaceregexp file="${build}/extract/WEB-INF/web.xml" match="&lt;session-timeout&gt;\d+&lt;/session-timeout&gt;" replace="&lt;session-timeout&gt;480&lt;/session-timeout&gt;" />

    </target>



    <!-- The post expansion hook is called after war file is expanded to build/extract. -->

    <target name="post.expansion.hook">

        <antcall inheritall="true" target="web_xml_timeout" />

    </target>



    <target name="post.war.hook" />



    <target name="clean" />



</project>
Labels (1)
Attachments
Comments

If we increase the session timeout value, will it impact application or servers performance ? If so, how can we optimize the performance to have longer session timeout duration.

Version history
Revision #:
2 of 2
Last update:
‎Jul 26, 2023 05:59 PM
Updated by: