Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Validity/Expiry of AFCS.Session


Level 2

There are these calls in the External Authentication sample

AFCS.AccountManager am = new AFCS.AccountManager(accountURL);

am.login(roomLoginId, roomPassword);

AFCS.Session authSession = am.getSession(roomName);

I just want to know for long does the AFCS.Session remains valid or what causes the session to expire. If I avoid the constructor and login call, I shall be able to save 3-4 http requests to hosted service per call to my application.  

1 Reply



exactly! The Session methods don't need to go to the server.

An authentication session is valid until the room completely shutdown. After that the shared secret is discarded and the session becomes invalid.

Also, you should be able to "cache" the AccountManager object instead of creating one and doing a login every time you need.

The account session expires after a little over 10 minutes so as long as you do a request (not counting getAuthentiicationToken, that doesn't access the server) every 10 minutes the account session will stay alive.

In the latest SDK I have added a "keepalive" method that you can call every 10 minutes to keep the AccountManager alive.