aboutsummaryrefslogtreecommitdiffstats
path: root/src/account
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2020-08-11 19:14:42 +0000
committerAdam Hassick <ahassick@iol.unh.edu>2020-12-04 14:20:41 -0500
commitaa4c5be520939d1e5f45015033a03981477b966a (patch)
tree1742c571ce002ed160c84a7584ef3c048f41e9e4 /src/account
parent6e7d8af810619e7ea3d14a612c735892c5ff1a84 (diff)
Revert "Revert "Enable OpenID""
This reverts commit 57d1635845df4a8b045805b66e8fbec5010ce97f. Reason for revert: <INSERT REASONING HERE> Change-Id: I18b59409bc5b89ac5b82f767e7af52c43ae668b8 Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/account')
-rw-r--r--src/account/views.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/account/views.py b/src/account/views.py
index d11a199..d0cfb22 100644
--- a/src/account/views.py
+++ b/src/account/views.py
@@ -28,6 +28,7 @@ from django.views.generic import RedirectView, TemplateView, UpdateView
from django.shortcuts import render
from jira import JIRA
from rest_framework.authtoken.models import Token
+from mozilla_django_oidc.auth import OIDCAuthenticationBackend
from account.forms import AccountSettingsForm
@@ -58,6 +59,20 @@ class AccountSettingsView(UpdateView):
return context
+class MyOIDCAB(OIDCAuthenticationBackend):
+ def filter_users_by_claims(self, claims):
+ email = claims.get(email=email)
+ if not email:
+ return self.UserModel.objects.none()
+
+ try:
+ profile = Profile.objects.get(email=email)
+ return profile.user
+
+ except Profile.DoesNotExist:
+ return self.UserModel.objects.none()
+
+
class JiraLoginView(RedirectView):
def get_redirect_url(self, *args, **kwargs):
consumer = oauth.Consumer(settings.OAUTH_CONSUMER_KEY, settings.OAUTH_CONSUMER_SECRET)