Giter Club home page Giter Club logo

eppsessiontimeredirect's Introduction

How to redirect a user to certain page on HTTP session timeout.
------------------------------------------------------------------------------------------
This is based on another plugin named "exo.portal.redirectplugin"
https://community.jboss.org/wiki/RedirectAUserToPageOnLoginlogoutBasedOnRole

How to build and deploy the application:

1) Plugin can be compiled simply by command:

mvn clean install

2) File target/exo.portal.session.timeout.redirectplugin-3.2.0-SNAPSHOT.jar  needs to be added to GateIn portal into ../deploy/gatein.ear/lib/
This JAR contains needed java classes, especially LoginRedirectFilter and LoginRedirectService.

3) Another step is to configure HTTP filter in portal web.xml . This can be done by adding Filter definition and Filter mapping into particular sections of file $GATEIN_HOME/server/default/deploy/gatein.ear/02portal.war/WEB-INF/web.xml
Assumption is that "filter" is inserted after all other filter definitions: 

   <filter>
      <filter-name>LoginRedirectFilter</filter-name>
      <filter-class>org.exoplatform.web.timeout.redirect.LoginRedirectFilter</filter-class>
   </filter>

And another assumption is that "filter-mapping" is inserted after all other filter-mapping definitions: 

   <filter-mapping>
      <filter-name>LoginRedirectFilter</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>

4) LoginRedirectFilter is using LoginRedirectService to find the correct URL to redirect users. 
Update existing file under ../deploy/gatein.ear/02portal.war/WEB-INF/conf/common/common-configuration.xml.
Example configuration is below.
- defaultLogoutURL  - URL to redirect after session timeout is detected

So example of mapping is here:

  <!-- Component used by LoginRedirectFilter Filter -->
  <component>
        <key>org.exoplatform.web.timeout.redirect.LoginRedirectService</key>
        <type>org.exoplatform.web.timeout.redirect.LoginRedirectService</type>
        <init-params>
            <value-param>
                <name>defaultLogoutURL</name>
                <description>logout URL to redirect if group mapping can't be found for particular user</description>
                <value>/portal/timeout/jsp/SessionTimeout.jsp</value>
            </value-param>
        </init-params>
  </component>
  
5) So after update of mapping configuration in common-configuration.xml and filter configuration in web.xml, we can start the portal.
We can try predefined users and we will see that:

NOTE: This version is working with GateIn 3.2 or EPP 5.2.

eppsessiontimeredirect's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.