userSessionExpirationTimeoutSec and redirect to login page in Portal module

Hi there,

In …\portal\src\ this setting seems to be working (middleware stops responding to client anymore after expiration) :

cuba.userSessionExpirationTimeoutSec = 1800

How can I redirect to login page after timeout? Any code snippet/project that uses this feature would be much helpful.


It should work automatically. Please check your portal-dispatcher-spring.xml. There you will find this code:

<!-- Default exception handlers from CUBA -->
<bean class="com.haulmont.cuba.portal.sys.exceptions.PortalExceptionResolver">
    <property name="noUserSessionUrl" value="/login"/>
    <property name="noMiddlewareConnectionUrl" value="/maintain"/>

PortalExceptionResolver redirects to /login if NoUserSessionException occurred from middle ware.
Please note that cuba.userSessionExpirationTimeoutSec should be set for core module, not for portal.