support for sso

This patch implements single sign on redirect for browsers, but uses the cas rest api for non browser clients.