fix settings for CAS protocol
add support for CAS

also use the CASWithGateway middleware