Fixes #2460 - session expiration fix for SSO

We set new expiration interval when user logs in successfully using any
kind of SSO. Also this patch moves logout path out of thread variable
and stores it into a session. This is more secure storage for threaded
servers.