Skip to content

Commit

Permalink
Merge pull request Kuadrant#557 from averevki/change-jwt-library
Browse files Browse the repository at this point in the history
Change unsupported jwt library
  • Loading branch information
jsmolar authored Oct 22, 2024
2 parents b14206c + db6ca16 commit 70973d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pytest-html = "*"
dynaconf = "*"
dnspython = "*"
python-keycloak = ">=3.6"
python-jose = "*"
PyJWT = "*"
lxml = "*"
cryptography = "*"
backoff = "*"
Expand All @@ -29,7 +29,6 @@ weakget = "*"
mypy = "*"
pylint = "*"
types-PyYAML = "*"
types-python-jose = "*"
black = {version = "*", extras = ["d"]}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
"""Test api authentication with wristband-token that was acquired after authentication on the edge layer"""

import pytest
from jose import jwt
import jwt

pytestmark = [pytest.mark.authorino, pytest.mark.standalone_only]


def test_wristband_token_claims(oidc_provider, auth, wristband_token, wristband_endpoint, certificates):
"""Verify acquired jwt token claims"""
wristband_decoded = jwt.decode(wristband_token, certificates["signing_ca"].certificate)
wristband_decoded = jwt.decode(wristband_token, certificates["signing_ca"].decoded.public_key(), algorithms="RS256")
assert wristband_decoded["exp"] - wristband_decoded["iat"] == 300
assert wristband_decoded["iss"] == wristband_endpoint
# check differences in claims between Keycloak token and acquired wristband token
access_token_decoded = jwt.decode(auth.token.access_token, oidc_provider.get_public_key(), audience="account")
access_token_decoded = jwt.decode(
auth.token.access_token, oidc_provider.get_public_key(), audience="account", algorithms="RS256"
)
for claim in ["preferred_username", "email", "realm_access", "resource_access"]:
assert claim in access_token_decoded
assert claim not in wristband_decoded
Expand Down

0 comments on commit 70973d6

Please sign in to comment.