KAA-42: Add handling of client session expiration with optional redirection to login page.

Use code formatting, please.