kumidc/authentication/cas.py
Kumi da49ddabcc
Add Django CAS authentication support
Introduce support for Central Authentication Service (CAS) alongside existing OIDC and SAML by integrating a new CAS server app and custom CAS authentication user model. Streamline sign-in infrastructure with updated URL patterns. As part of the update, refactor user model `username` resolution to leverage the email field directly. Includes necessary Django migrations to support new authentication features and removes a deprecated OIDC provider dependency.
2023-12-24 09:16:55 +01:00

12 lines
380 B
Python

from cas_server.auth import DjangoAuthUser
from django.contrib.auth import get_user_model
class KumiDCAuthUser(DjangoAuthUser):
def __init__(self, username):
User = get_user_model()
try:
self.user = User.objects.get_by_natural_key(username)
except User.DoesNotExist:
pass
super(DjangoAuthUser, self).__init__(username)