SSO changes to fix several login and logout limitations by using cookie based flags.