From 3e338d52d766aef9d0752c018c01df6ed8eeec7e Mon Sep 17 00:00:00 2001 From: Johan Seto K <51926076+johanseto@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:05:13 -0500 Subject: [PATCH 1/2] refactor: inherit from social auth exception * refactor: inherit from social auth exception This change the heritance of the eox-tenant-auth-exception. This with the purpose of the exception to be handled by the social tpa middleware exception process. You can see here that the new class is also based in value error exception. https://github.com/python-social-auth/social-core/blob/29cbbd22b98d81d569a886b1cc0bd9a316cd124f/social_core/exceptions.py#L1 But the change is related with this PR: https://github.com/eduNEXT/eox-core/pull/171 So now as the exception is family of the SocialAuthBaseException. The the tpa middleware could managed it. https://github.com/python-social-auth/social-app-django/blob/5.4.0/social_django/middleware.py#L35 Keep in mind that this middleware is parent of edx-platform middleware. https://github.com/openedx/edx-platform/blob/ebcbe1cd9208191c0589d7fe538c6ac13470abe6/common/djangoapps/third_party_auth/middleware.py#L18 * refactor: social-auth-core pkg inclusion (cherry picked from commit c542749eceab893ec351cfd7a056f679de760d26) chore: run make upgrade --- eox_tenant/pipeline.py | 3 +- requirements/base.in | 1 + requirements/base.txt | 40 +++++++++++++++++++-- requirements/django32.txt | 2 +- requirements/django42.txt | 2 +- requirements/pip-tools.txt | 8 +++-- requirements/test.txt | 73 +++++++++++++++++++++++++++++++++----- requirements/tox.txt | 6 ++-- 8 files changed, 115 insertions(+), 20 deletions(-) diff --git a/eox_tenant/pipeline.py b/eox_tenant/pipeline.py index 5efc3214..6c9554f1 100644 --- a/eox_tenant/pipeline.py +++ b/eox_tenant/pipeline.py @@ -1,9 +1,10 @@ """ The pipeline module defines functions that are used in the third party authentication flow """ +from social_core.exceptions import AuthFailed -class EoxTenantAuthException(ValueError): +class EoxTenantAuthException(AuthFailed): """Auth process exception.""" def __init__(self, backend, *args, **kwargs): diff --git a/requirements/base.in b/requirements/base.in index 33396059..5e06a789 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -9,3 +9,4 @@ django-mysql jsonfield edx-opaque-keys[django] openedx_filters +social-auth-core diff --git a/requirements/base.txt b/requirements/base.txt index 458b9bf4..66e335b2 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -8,7 +8,19 @@ asgiref==3.7.2 # via django backports-zoneinfo==0.2.1 # via django -django==4.2.10 +certifi==2024.2.2 + # via requests +cffi==1.16.0 + # via cryptography +charset-normalizer==3.3.2 + # via requests +cryptography==42.0.5 + # via social-auth-core +defusedxml==0.8.0rc2 + # via + # python3-openid + # social-auth-core +django==4.2.11 # via # -c requirements/constraints.txt # -r requirements/base.in @@ -25,23 +37,45 @@ djangorestframework==3.14.0 # via -r requirements/base.in edx-opaque-keys[django]==2.5.1 # via -r requirements/base.in +idna==3.6 + # via requests jsonfield==3.1.0 # via -r requirements/base.in +oauthlib==3.2.2 + # via + # requests-oauthlib + # social-auth-core openedx-filters==1.6.0 # via -r requirements/base.in pbr==6.0.0 # via stevedore +pycparser==2.21 + # via cffi +pyjwt==2.8.0 + # via social-auth-core pymongo==3.13.0 # via edx-opaque-keys +python3-openid==3.2.0 + # via social-auth-core pytz==2024.1 # via djangorestframework +requests==2.31.0 + # via + # requests-oauthlib + # social-auth-core +requests-oauthlib==1.3.1 + # via social-auth-core six==1.16.0 # via -r requirements/base.in +social-auth-core==4.5.3 + # via -r requirements/base.in sqlparse==0.4.4 # via django -stevedore==5.1.0 +stevedore==5.2.0 # via edx-opaque-keys -typing-extensions==4.9.0 +typing-extensions==4.10.0 # via # asgiref # edx-opaque-keys +urllib3==2.2.1 + # via requests diff --git a/requirements/django32.txt b/requirements/django32.txt index d296127a..7eec28f9 100644 --- a/requirements/django32.txt +++ b/requirements/django32.txt @@ -1 +1 @@ -django==3.2.23 +django==3.2.24 diff --git a/requirements/django42.txt b/requirements/django42.txt index 1facfe28..db03776f 100644 --- a/requirements/django42.txt +++ b/requirements/django42.txt @@ -1 +1 @@ -django==4.2.10 +django==4.2.11 diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 0e882265..8528adba 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -4,7 +4,7 @@ # # make upgrade # -build==1.0.3 +build==1.1.1 # via pip-tools click==8.1.7 # via pip-tools @@ -12,10 +12,12 @@ importlib-metadata==7.0.1 # via build packaging==23.2 # via build -pip-tools==7.3.0 +pip-tools==7.4.0 # via -r requirements/pip-tools.in pyproject-hooks==1.0.0 - # via build + # via + # build + # pip-tools tomli==2.0.1 # via # build diff --git a/requirements/test.txt b/requirements/test.txt index 794de185..595529c6 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -8,16 +8,37 @@ asgiref==3.7.2 # via # -r requirements/base.txt # django -astroid==3.0.3 +astroid==3.1.0 # via pylint backports-zoneinfo==0.2.1 # via # -r requirements/base.txt # django -coverage==7.4.1 +certifi==2024.2.2 + # via + # -r requirements/base.txt + # requests +cffi==1.16.0 + # via + # -r requirements/base.txt + # cryptography +charset-normalizer==3.3.2 + # via + # -r requirements/base.txt + # requests +coverage==7.4.3 # via -r requirements/test.in -ddt==1.7.1 +cryptography==42.0.5 + # via + # -r requirements/base.txt + # social-auth-core +ddt==1.7.2 # via -r requirements/test.in +defusedxml==0.8.0rc2 + # via + # -r requirements/base.txt + # python3-openid + # social-auth-core dill==0.3.8 # via pylint # via @@ -40,6 +61,10 @@ edx-opaque-keys[django]==2.5.1 # via # -r requirements/base.txt # edx-opaque-keys +idna==3.6 + # via + # -r requirements/base.txt + # requests isort==5.13.2 # via pylint jsonfield==3.1.0 @@ -48,6 +73,11 @@ mccabe==0.7.0 # via pylint mock==5.1.0 # via -r requirements/test.in +oauthlib==3.2.2 + # via + # -r requirements/base.txt + # requests-oauthlib + # social-auth-core openedx-filters==1.6.0 # via -r requirements/base.txt path==16.10.0 @@ -62,36 +92,63 @@ platformdirs==4.2.0 # via pylint pycodestyle==2.11.1 # via -r requirements/test.in -pylint==3.0.3 +pycparser==2.21 + # via + # -r requirements/base.txt + # cffi +pyjwt==2.8.0 + # via + # -r requirements/base.txt + # social-auth-core +pylint==3.1.0 # via -r requirements/test.in pymongo==3.13.0 # via # -r requirements/base.txt # edx-opaque-keys +python3-openid==3.2.0 + # via + # -r requirements/base.txt + # social-auth-core pytz==2024.1 # via # -r requirements/base.txt # djangorestframework +requests==2.31.0 + # via + # -r requirements/base.txt + # requests-oauthlib + # social-auth-core +requests-oauthlib==1.3.1 + # via + # -r requirements/base.txt + # social-auth-core six==1.16.0 # via -r requirements/base.txt +social-auth-core==4.5.3 + # via -r requirements/base.txt sqlparse==0.4.4 # via # -r requirements/base.txt # django -stevedore==5.1.0 +stevedore==5.2.0 # via # -r requirements/base.txt # edx-opaque-keys -testfixtures==7.2.2 +testfixtures==8.1.0 # via -r requirements/test.in tomli==2.0.1 # via pylint -tomlkit==0.12.3 +tomlkit==0.12.4 # via pylint -typing-extensions==4.9.0 +typing-extensions==4.10.0 # via # -r requirements/base.txt # asgiref # astroid # edx-opaque-keys # pylint +urllib3==2.2.1 + # via + # -r requirements/base.txt + # requests diff --git a/requirements/tox.txt b/requirements/tox.txt index 28261f31..e9a64909 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -4,7 +4,7 @@ # # make upgrade # -cachetools==5.3.2 +cachetools==5.3.3 # via tox chardet==5.2.0 # via tox @@ -32,7 +32,7 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.12.1 +tox==4.13.0 # via -r requirements/tox.in -virtualenv==20.25.0 +virtualenv==20.25.1 # via tox From b6301d9b75ee93fc5d991d23516c03882e0cc8fc Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Fri, 9 Feb 2024 16:38:55 -0500 Subject: [PATCH 2/2] fix: pylint update change way to load config add use-yield-from (R1737) due pylint update to 3.1.0 --- setup.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index fd89265c..5224cfa9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ tag = False [coverage:run] data_file = .coverage -omit = +omit = venv/* eox_tenant/edxapp_wrapper/backends/* @@ -21,10 +21,11 @@ statistics = True ignore = migrations,CVS generated-members = objects max-line-length = 120 -disable = +disable = too-few-public-methods, too-many-ancestors, duplicate-code, + use-yield-from, [isort] default_section = THIRDPARTY