Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sso): 500 on admin login (#5334) #5363

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions dependencies/pip/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ amqp==5.2.0
asgiref==3.8.1
# via
# django
# django-allauth
# django-cors-headers
asttokens==2.4.1
# via stack-data
Expand Down Expand Up @@ -109,7 +110,6 @@ cryptography==42.0.5
# azure-storage-blob
# jwcrypto
# paramiko
# pyjwt
# pyopenssl
cssselect==1.2.0
# via pyquery
Expand All @@ -131,7 +131,6 @@ defusedxml==0.7.1
# via
# -r dependencies/pip/requirements.in
# djangorestframework-xml
# python3-openid
# pyxform
deprecated==1.2.14
# via fabric
Expand Down Expand Up @@ -171,7 +170,7 @@ django==4.2.15
# djangorestframework
# jsonfield
# model-bakery
django-allauth==0.61.1
django-allauth==65.1.0
# via -r dependencies/pip/requirements.in
django-amazon-ses==4.0.1
# via -r dependencies/pip/requirements.in
Expand Down Expand Up @@ -488,10 +487,8 @@ pygments==2.17.2
# via
# -r dependencies/pip/requirements.in
# ipython
pyjwt[crypto]==2.8.0
# via
# django-allauth
# twilio
pyjwt==2.8.0
# via twilio
pymongo==4.6.3
# via -r dependencies/pip/requirements.in
pynacl==1.5.0
Expand Down Expand Up @@ -531,8 +528,6 @@ python-dateutil==2.9.0.post0
# freezegun
# pandas
# python-crontab
python3-openid==3.2.0
# via django-allauth
pytz==2024.1
# via
# flower
Expand All @@ -559,19 +554,15 @@ requests==2.31.0
# -r dependencies/pip/requirements.in
# azure-core
# coveralls
# django-allauth
# django-oauth-toolkit
# google-api-core
# google-cloud-storage
# httmock
# requests-oauthlib
# responses
# smsapi-client
# stripe
# twilio
# yubico-client
requests-oauthlib==2.0.0
# via django-allauth
responses==0.25.0
# via -r dependencies/pip/requirements.in
rpds-py==0.18.0
Expand Down
17 changes: 4 additions & 13 deletions dependencies/pip/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ amqp==5.2.0
asgiref==3.8.1
# via
# django
# django-allauth
# django-cors-headers
async-timeout==4.0.3
# via
Expand Down Expand Up @@ -92,7 +93,6 @@ cryptography==42.0.5
# via
# azure-storage-blob
# jwcrypto
# pyjwt
# pyopenssl
cssselect==1.2.0
# via pyquery
Expand All @@ -102,7 +102,6 @@ defusedxml==0.7.1
# via
# -r dependencies/pip/requirements.in
# djangorestframework-xml
# python3-openid
# pyxform
dict2xml==1.7.5
# via -r dependencies/pip/requirements.in
Expand Down Expand Up @@ -139,7 +138,7 @@ django==4.2.15
# django-timezone-field
# djangorestframework
# jsonfield
django-allauth==0.61.1
django-allauth==65.1.0
# via -r dependencies/pip/requirements.in
django-amazon-ses==4.0.1
# via -r dependencies/pip/requirements.in
Expand Down Expand Up @@ -381,10 +380,8 @@ pycparser==2.22
# via cffi
pygments==2.17.2
# via -r dependencies/pip/requirements.in
pyjwt[crypto]==2.8.0
# via
# django-allauth
# twilio
pyjwt==2.8.0
# via twilio
pymongo==4.6.3
# via -r dependencies/pip/requirements.in
pyopenssl==24.1.0
Expand All @@ -406,8 +403,6 @@ python-dateutil==2.9.0.post0
# celery
# pandas
# python-crontab
python3-openid==3.2.0
# via django-allauth
pytz==2024.1
# via
# flower
Expand All @@ -433,18 +428,14 @@ requests==2.31.0
# via
# -r dependencies/pip/requirements.in
# azure-core
# django-allauth
# django-oauth-toolkit
# google-api-core
# google-cloud-storage
# requests-oauthlib
# responses
# smsapi-client
# stripe
# twilio
# yubico-client
requests-oauthlib==2.0.0
# via django-allauth
responses==0.25.0
# via -r dependencies/pip/requirements.in
rpds-py==0.18.0
Expand Down
8 changes: 4 additions & 4 deletions kobo/apps/accounts/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def setUp(self):

@override_settings(SOCIALACCOUNT_PROVIDERS=SOCIALACCOUNT_PROVIDERS)
@responses.activate
@patch('allauth.socialaccount.models.SocialLogin.verify_and_unstash_state')
def test_keep_django_auth_backend_with_sso(self, mock_verify_and_unstash_state):
mock_verify_and_unstash_state.return_value = {'process': 'login'}
@patch('allauth.socialaccount.providers.oauth2.views.statekit.unstash_state')
def test_keep_django_auth_backend_with_sso(self, mock_unstash_state):
mock_unstash_state.return_value = {'process': 'login'}

# Mock `requests` responses to fool django-allauth
responses.add(
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_keep_django_auth_backend_with_sso(self, mock_verify_and_unstash_state):
)

# Simulate GET request to SSO provider
mock_sso_response = {'code': 'foobar'}
mock_sso_response = {'code': 'foobar', 'state': '12345'}
response = self.client.get(sso_login_url, data=mock_sso_response)

# Ensure user is logged in
Expand Down
Loading