Skip to content

Commit

Permalink
Merge pull request #63 from okta/0.2.6
Browse files Browse the repository at this point in the history
Update version number and use poetry
  • Loading branch information
bretterer authored Aug 1, 2024
2 parents 20bf0ff + 12fce43 commit 084aab9
Show file tree
Hide file tree
Showing 6 changed files with 936 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.12']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion okta_jwt_verifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Allow to verify JWT locally
"""
__version__ = '0.2.5'
__version__ = '0.2.6'

from .jwt_verifier import BaseJWTVerifier, JWTVerifier, AccessTokenVerifier, IDTokenVerifier # noqa
from .jwt_utils import JWTUtils # noqa
879 changes: 879 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.poetry]
name = "okta-jwt-verifier"
version = "0.2.6"
description = "A Python library for OKTA JWT tokens validation"
authors = ["Okta"]
license = "Apache-2.0"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.12"
requests = "2.31.0"
PyJWT = "2.8.0"
acachecontrol = "0.3.5"
retry2 = "^0.9.5"
aiohttp = "3.9.2"
certifi = "2023.7.22"
urllib3 = "1.26.18"
setuptools = "65.5.1"
cryptography = "^43.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.2"
pytest-mock = "^3.14.0"
pytest-asyncio = "^0.23.8"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ retry2
aiohttp>=3.9.2
certifi>=2023.7.22
urllib3>=1.26.18
setuptools>=65.5.1
setuptools>=65.5.1
cryptography>=43.0.0
31 changes: 25 additions & 6 deletions tests/unit/test_jwt_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from okta_jwt_verifier.exceptions import JWKException, JWTValidationException
from okta_jwt_verifier.request_executor import RequestExecutor

from cryptography.hazmat.primitives.asymmetric import rsa


class MockRequestExecutor(RequestExecutor):

Expand Down Expand Up @@ -105,14 +107,31 @@ def test_verify_signature(mocker):
mock_sign_verifier)

token = 'test_token'
jwk = 'test_jwk'
jwk = {
"kty": "RSA",
"e": "AQAB",
"n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx...",
"kid": "test_kid"
}
jwt_verifier = BaseJWTVerifier('https://test_issuer.com', 'test_client_id')
jwt_verifier.verify_signature(token, jwk)
mock_sign_verifier.assert_called_with(signing_input=signing_input,
header=headers,
signature=signature,
key=jwk,
algorithms=['RS256'])

mock_sign_verifier.assert_called_once() # Check if called once
args, kwargs = mock_sign_verifier.call_args # Get the arguments

assert kwargs['signing_input'] == signing_input
assert kwargs['header'] == headers
assert kwargs['signature'] == signature
assert kwargs['algorithms'] == ['RS256']

assert isinstance(kwargs['key'], rsa.RSAPublicKey)


# mock_sign_verifier.assert_called_with(signing_input=signing_input,
# header=headers,
# signature=signature,
# key=jwk,
# algorithms=['RS256'])


def test_verify_client_id():
Expand Down

0 comments on commit 084aab9

Please sign in to comment.