Skip to content

Commit e0e5ae3

Browse files
committed
Remove legacy code related to base64 encoded secret.
1 parent fcd9f53 commit e0e5ae3

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

docs/settings.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ of ``mozilla-django-oidc``.
4848

4949
OpenID Connect client secret provided by your OP
5050

51-
.. py:attribute:: OIDC_RP_CLIENT_SECRET_ENCODED
52-
53-
:default: ``False``
54-
55-
Controls whether your client secret requires base64 decoding for verification
56-
5751
.. py:attribute:: OIDC_VERIFY_JWT
5852
5953
:default: ``True``

mozilla_django_oidc/auth.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ def verify_token(self, token, **kwargs):
8080
"""Validate the token signature."""
8181
nonce = kwargs.get('nonce')
8282

83-
secret = self.OIDC_RP_CLIENT_SECRET
84-
if import_from_settings('OIDC_RP_CLIENT_SECRET_ENCODED', False):
85-
secret = base64.urlsafe_b64decode(self.OIDC_RP_CLIENT_SECRET)
8683
# Verify the token
87-
verified_token = jws.verify(token, secret, algorithms=['HS256'])
84+
verified_token = jws.verify(
85+
token,
86+
self.OIDC_RP_CLIENT_SECRET,
87+
algorithms=['HS256']
88+
)
8889
# The 'verified_token' will always be a byte string since it's
8990
# the result of base64.urlsafe_b64decode().
9091
# The payload is always the result of base64.urlsafe_b64decode().

tests/test_auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ def test_jwt_decode_params_verify_false(self, request_mock, jws_mock):
288288
jws_mock.assert_has_calls(calls)
289289

290290
@override_settings(OIDC_USE_NONCE=True)
291-
@override_settings(OIDC_RP_CLIENT_SECRET_ENCODED=False)
292291
@patch('mozilla_django_oidc.auth.jws')
293292
def test_jwt_failed_nonce(self, jwt_mock):
294293
"""Test Nonce verification."""

0 commit comments

Comments
 (0)