whitenoise!

This commit is contained in:
2024-05-18 01:22:29 +02:00
parent 41bdd859d5
commit f2528af95e
3 changed files with 5 additions and 4 deletions

View File

@@ -16,7 +16,6 @@ from mozilla_django_oidc.contrib.drf import OIDCAuthentication
class CustomOIDCBackend(OIDCAuthenticationBackend):
def get_username(self, claims):
if 'preferred_username' in claims and not User.objects.filter(username=claims['preferred_username']).exists():
print(claims['preferred_username'])
return claims['preferred_username']
return super().get_username(claims)
@@ -32,7 +31,6 @@ class CustomOIDCBackend(OIDCAuthenticationBackend):
def get_userinfo(self, access_token, id_token, payload):
userinfo = cache.get(f'userinfo-{access_token}')
if userinfo is None:
print("no cache found for userinfo-{access_token} yet.")
userinfo = super().get_userinfo(access_token, id_token, payload)
if userinfo:
cache.set(f'userinfo-{access_token}', userinfo, timeout=settings.OIDC_CACHE_USERINFO)