from urllib.parse import urlunparse

from cas import CASClient


def get_cas_client(request):
    """Return a CAS client configured for SPI's CAS."""
    return CASClient(
        version=3,
        service_url=urlunparse(
            (request.scheme, request.get_host(), request.path, "", "", "")
        ),
        server_url="https://cas.eleves.ens.fr/",
    )
