Added optional setting for redirection on error: CAS_REDIRECT_ON_ERROR