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

Change unsupported jwt library #557

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Loading