This also expands type-hints to the SSO and registration code. Refactors the CAS code to more closely match OIDC/SAML.