Implement client side logic for handling expiration of sessions.

XXX this requires logic also in the backend to return a proper data structure
to support expiration.