Skip to content

Commit

Permalink
refactor: inherit from social auth exception
Browse files Browse the repository at this point in the history
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:
eduNEXT/eox-core#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
  • Loading branch information
johanseto committed Jan 4, 2024
1 parent 2fdd2c8 commit 89b9203
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eox_tenant/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
The pipeline module defines functions that are used in the third party authentication flow
"""

try:
from social_core.exceptions import AuthFailed
except ImportError:
AuthFailed = ValueError

class EoxTenantAuthException(ValueError):

class EoxTenantAuthException(AuthFailed):
"""Auth process exception."""

def __init__(self, backend, *args, **kwargs):
Expand Down

0 comments on commit 89b9203

Please sign in to comment.