Skip to content

Commit

Permalink
squash! fix quality issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mumarkhan999 committed Aug 13, 2024
1 parent c243cba commit 815c5df
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
30 changes: 15 additions & 15 deletions lti_consumer/lti_1p3/key_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ def validate_and_decode(self, token):
for i in range(len(key_set)):
try:
message = jwt.decode(
token,
key=key_set[i],
algorithms=['RS256', 'RS512',],
options={'verify_signature': True}
)
token,
key=key_set[i],
algorithms=['RS256', 'RS512',],
options={'verify_signature': True}
)
return message
except Exception:
if i == len(key_set) - 1:
Expand Down Expand Up @@ -201,16 +201,16 @@ def validate_and_decode(self, token, iss=None, aud=None):
raise exceptions.RsaKeyNotSet()
try:
message = jwt.decode(
token,
key=self.key.public_key(),
audience=aud,
issuer=iss,
algorithms=['RS256', 'RS512'],
options={
'verify_signature': True,
'verify_aud': True if aud else False
}
)
token,
key=self.key.public_key(),
audience=aud,
issuer=iss,
algorithms=['RS256', 'RS512'],
options={
'verify_signature': True,
'verify_aud': True if aud else False
}
)
return message

except Exception as token_error:
Expand Down
16 changes: 8 additions & 8 deletions lti_consumer/lti_1p3/tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ def _decode_token(self, token):
for i in range(len(keyset)):
try:
message = jwt.decode(
token,
key=keyset[i].key,
algorithms=['RS256', 'RS512'],
options={
'verify_signature': True,
'verify_aud': False
}
)
token,
key=keyset[i].key,
algorithms=['RS256', 'RS512'],
options={
'verify_signature': True,
'verify_aud': False
}
)
return message
except Exception as token_error:
if i < len(keyset) - 1:
Expand Down
1 change: 0 additions & 1 deletion lti_consumer/tests/unit/test_lti_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,6 @@ def setUp(self):
self.key = algo_obj.prepare_key(pem)
self.public_key = rsa_key.public_key().export_key('PEM')


self.xblock_attributes = {
'lti_version': 'lti_1p3',
'lti_1p3_launch_url': 'http://tool.example/launch',
Expand Down

0 comments on commit 815c5df

Please sign in to comment.