From 817adc299f321868591f20486a6e1d97a74ff6cb Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Fri, 12 Mar 2021 20:15:37 +0500 Subject: [PATCH] Add custom attribute for SSO auth_entry. Added custom for SSO auth entries to monitor which auth entries are still in use. --- common/djangoapps/third_party_auth/pipeline.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/djangoapps/third_party_auth/pipeline.py b/common/djangoapps/third_party_auth/pipeline.py index a07cb6716b..930b3c2c14 100644 --- a/common/djangoapps/third_party_auth/pipeline.py +++ b/common/djangoapps/third_party_auth/pipeline.py @@ -76,6 +76,7 @@ from django.core.mail.message import EmailMessage from django.http import HttpResponseBadRequest from django.shortcuts import redirect from django.urls import reverse +from edx_django_utils.monitoring import set_custom_attribute from social_core.exceptions import AuthException from social_core.pipeline import partial from social_core.pipeline.social_auth import associate_by_email @@ -484,6 +485,9 @@ def parse_query_params(strategy, response, *args, **kwargs): auth_entry = strategy.request.session.get(AUTH_ENTRY_KEY, AUTH_ENTRY_LOGIN) if auth_entry not in _AUTH_ENTRY_CHOICES: raise AuthEntryError(strategy.request.backend, 'auth_entry invalid') + + # Enable monitoring of the third-party-auth auth_entry value. + set_custom_attribute('tpa_pipeline.auth_entry', auth_entry) return {'auth_entry': auth_entry} @@ -733,6 +737,8 @@ def associate_by_email_if_login_api(auth_entry, backend, details, user, current_ This association is done ONLY if the user entered the pipeline through a LOGIN API. """ if auth_entry == AUTH_ENTRY_LOGIN_API: + # Temporary custom attribute to help ensure there is no usage. + set_custom_attribute('deprecated_auth_entry_login_api', True) association_response = associate_by_email(backend, details, user, *args, **kwargs) if ( association_response and