Where is authentication-services-context.xml ? How to set the session timeout policy ?

cancel
Showing results for 
Search instead for 
Did you mean: 
mikefr38
Member II

Where is authentication-services-context.xml ? How to set the session timeout policy ?

Hi,

I want to change the session timeout, and maybe change also the mode (I have seen in other subject that the timeout mode could be AFTER_INACTIVITY, AFTER_FIXED_TIME, or DO_NOT_EXPIRE).

Several subjects here refer to authentication-services-context.xml.

But I cannot find this file in my installation. There is no "authentication-services-context.xml.sample" either.

The version is 5.1.0 (alfresco) and 5.1.f (share).

I am lost.

Also, some other subject suggest to change the tomcat session timeout (in web.xml) but this is not a good solution since web.xml is part of the application and will be overwritten when I update the war. Moreover some users say that it doesn't work.

What should I do ?

Thanks

2 Replies
cesarista
Customer

Re: Where is authentication-services-context.xml ? How to set the session timeout policy ?

Hi:

In Alfresco 5 you may find this context file and many other default config files (such subsystem configuration files) inside a jar file. In my case, inside: 

$TOMCAT/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.2.e.jar

As you commented, under $TOMCAT/webapps/alfresco/WEB-INF/web.xml you have:

<session-config>
<session-timeout>60</session-timeout>
</session-config>

You may change the war too, even do an AMP package if you want. Regarding alfresco tickets, in alfresco-global.properties you can set:

# If authentication.ticket.ticketsExpire is true and
# authentication.ticket.expiryMode is AFTER_FIXED_TIME or AFTER_INACTIVITY,
# this controls the minimum period for which tickets are valid.
# The default is PT1H for one hour.
authentication.ticket.validDuration=PT4H

Regards.

--C.

malcolmc
Active Member

Re: Where is authentication-services-context.xml ? How to set the session timeout policy ?

A few things you need to do to change the session timeout for users:

1. create your authentication bean timeout xml file in tomcat/shared/classes/alfresco/extension/authentication-services-context.xml (or what ever other name you would like), shown in other posts

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <!-- The ticket component, Used for reauthentication                   -->
    <bean id="ticketComponent" class="org.alfresco.repo.security.authentication.InMemoryTicketComponentImpl">
        <property name="ticketsCache">
            <ref bean="ticketsCache"/>
        </property>
        <!-- The period for which tickets are valid in XML duration format, default P1H is 1 Hour -->
        <property name="validDuration">
            <value>PT17H</value>
        </property>
        <!-- Do tickets expire or live for ever? -->
        <property name="ticketsExpire">
            <value>true</value>
        </property>
        <!-- Are tickets only valid for a single use? -->
        <property name="oneOff">
            <value>false</value>
        </property>
        <!-- If ticketsEpire is true then how they should expire -->
        <!-- AFTER_INACTIVITY, AFTER_FIXED_TIME, DO_NOT_EXPIRE  -->
        <!-- The default is AFTER_FIXED_TIME -->
        <property name="expiryMode">
            <value>AFTER_INACTIVITY</value>
        </property>
    </bean>
</beans>


2. modify tomcat/webapps/alfresco/WEB-INF/web.xml and tomcat/webapps/share/WEB-INF/web.xml such that <session-timeout>960</session-timeout> is less than the timeout specified in your bean (e.g 16 hours)
You are right, with respect to these web.xml files being part of the war files. My method to replace these at the moment is to place my changes in two seperate .amp files which are placed in the amps and amps_share folder which then over write the system files when ever amps are applied (use bin/apply_amps.sh -force).

Alfresco Amp structure:

Alfresco/src/main
Alfresco/src/main/amp
Alfresco/src/main/amp/web
Alfresco/src/main/amp/web/WEB-INF
Alfresco/src/main/amp/web/WEB-INF/web.xml
Alfresco/src/main/amp/module.properties
Alfresco/src/main/amp/file-mapping.properties
Alfresco/pom.xml

pom.xml:

Share amp structure:

Share/src
Share/src/main
Share/src/main/amp
Share/src/main/amp/web
Share/src/main/amp/web/WEB-INF
Share/src/main/amp/web/WEB-INF/web.xml
Share/src/main/amp/module.properties
Share/src/main/amp/file-mapping.properties
Share/pom.xml

Important Note, if your timeout in the bean expires before the timeout specified in the web.xml files you will hit an ugly bug in the Upload New Version action where by it looks like you have successfully uploaded a document but it has in fact failed. You can show this behavour if you set the bean timeout to 1 minute.

I have attached the two pom.xml files.

hope this helps.