Changing the Destination of the Logout Link

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

The information in this page relates to customizations in Confluence. Consequently, Atlassian Support cannot guarantee to provide any support for the steps described on this page as customizations are not covered under Atlassian Support Offerings. Please be aware that this material is provided for your information only and that you use it at your own risk.

Also, please be aware that customizations done by directly modifying files are not included in the upgrade process. These modifications will need to be reapplied manually on the upgraded instance.

For more details on editing JAR files, refer to: How to edit files in Confluence JAR files

This page describes how to customise the destination of the logout page, for integration with a Single Sign On framework.

To configure a new logout, redirect by changing the way Confluence handles the logout action:

  1. Shutdown Confluence
  2. un-jar the confluence-x.y.z.jar (or com.atlassian.confluence_confluence-x.y.z.jar) file in $confluence-install/confluence/WEB-INF/lib, to another location. You can use a standard zip application or the java -jar command 
    Alternative to un-jar-ing, edit the xwork.xml/struts.xml directly in the jar file
  3. Locate xwork.xml
    1. (info) For Confluence 8.0.0+, locate the file struts.xml 
  4. Change the behavior of logout.action by altering these lines:

    <!-- <result name="success" type="velocity">/logout.vm</result> -->
    <!-- CAS:START - CAS Logout Redirect -->
    <result name="success" type="redirect">https://cas.institution.edu/cas/logout</result>
    <!-- CAS:END -->
    

    Newer versions will need to be changed as such:

    From
            <action name="logout" class="com.atlassian.confluence.user.actions.LogoutAction">
                <interceptor-ref name="defaultStack"/>
                <result name="error" type="velocity">/logout.vm</result>
                <result name="success" type="redirect">${logoutUrl}</result>
            </action>
    TO
             <action name="logout" class="com.atlassian.confluence.user.actions.LogoutAction">
                <interceptor-ref name="defaultStack"/>
                <result name="error" type="velocity">/logout.vm</result>
                <result name="success" type="redirect">https://your.new.logout.url</result>
            </action>
  5. Re-jar the files if you extracted them in Step 1
  6. Start Confluence
tip/resting Created with Sketch.

This example is taken from a CAS customization. What was done here was to comment out the regular success action: /logout.vm, and instead replace it with a redirect to the your custom logout page.



























Last modified on Oct 17, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.