diff --git a/.snyk b/.snyk index 3b39db80..785d93ea 100644 --- a/.snyk +++ b/.snyk @@ -9,4 +9,8 @@ ignore: SNYK-PYTHON-REQUESTS-40470: - '*': reason: 'patched in latest python versions: https://bugs.python.org/issue27568' + "snyk:lic:pip:certifi:MPL-2.0": + - '*': + reason: "Accepting certifi’s MPL-2.0 license for now" + expires: "2030-12-31T23:59:59Z" patch: {} diff --git a/auth0/authentication/back_channel_login.py b/auth0/authentication/back_channel_login.py index 6c841886..1dc7d69f 100644 --- a/auth0/authentication/back_channel_login.py +++ b/auth0/authentication/back_channel_login.py @@ -34,4 +34,5 @@ def back_channel_login( "scope": scope, **kwargs, }, + headers={"Content-Type": "application/x-www-form-urlencoded"}, ) diff --git a/auth0/test/authentication/test_back_channel_login.py b/auth0/test/authentication/test_back_channel_login.py index 70027446..18206b17 100644 --- a/auth0/test/authentication/test_back_channel_login.py +++ b/auth0/test/authentication/test_back_channel_login.py @@ -1,6 +1,7 @@ import unittest from unittest import mock +import json import requests from ...exceptions import Auth0Error, RateLimitError @@ -74,5 +75,64 @@ def test_should_require_scope(self, mock_post): # Assert the error message is correct self.assertIn("missing 1 required positional argument: \'scope\'", str(context.exception)) + @mock.patch("auth0.rest.RestClient.post") + def test_with_authorization_details(self, mock_post): + g = BackChannelLogin("my.domain.com", "cid", client_secret="clsec") + g.back_channel_login( + binding_message="This is a binding message.", + login_hint={"format": "iss_sub", "iss": "https://my.domain.auth0.com/", "sub": "auth0|USER_ID"}, + scope="openid", + authorization_details=[ + { + "type":"payment_initiation","locations":["https://example.com/payments"], + "instructedAmount": + { + "currency":"EUR","amount":"123.50" + }, + "creditorName":"Merchant A", + "creditorAccount": + { + "bic":"ABCIDEFFXXX", + "iban":"DE021001001093071118603" + }, + "remittanceInformationUnstructured":"Ref Number Merchant" + } + ], + ) + + args, kwargs = mock_post.call_args + + expected_data = { + "client_id": "cid", + "client_secret": "clsec", + "binding_message": "This is a binding message.", + "login_hint": {"format": "iss_sub", "iss": "https://my.domain.auth0.com/", "sub": "auth0|USER_ID" }, + "scope": "openid", + "authorization_details": [ + { + "type":"payment_initiation","locations":["https://example.com/payments"], + "instructedAmount": + { + "currency":"EUR","amount":"123.50" + }, + "creditorName":"Merchant A", + "creditorAccount": + { + "bic":"ABCIDEFFXXX", + "iban":"DE021001001093071118603" + }, + "remittanceInformationUnstructured":"Ref Number Merchant" + }], + } + + actual_data = kwargs["data"] + + self.assertEqual(args[0], "https://my.domain.com/bc-authorize") + + self.assertEqual( + json.dumps(actual_data, sort_keys=True), + json.dumps(expected_data, sort_keys=True) + ) + diff --git a/auth0/test/authentication/test_pushed_authorization_requests.py b/auth0/test/authentication/test_pushed_authorization_requests.py index 3a76b6f8..6bcb3ca7 100644 --- a/auth0/test/authentication/test_pushed_authorization_requests.py +++ b/auth0/test/authentication/test_pushed_authorization_requests.py @@ -48,7 +48,7 @@ def test_par_custom_params(self, mock_post): ) @mock.patch("auth0.rest.RestClient.post") - def test_rar(self, mock_post): + def test_with_authorization_details(self, mock_post): a = PushedAuthorizationRequests("my.domain.com", "cid", client_secret="sh!") a.pushed_authorization_request( response_type="code", diff --git a/poetry.lock b/poetry.lock index 34d4407f..dde7c710 100644 --- a/poetry.lock +++ b/poetry.lock @@ -158,14 +158,14 @@ frozenlist = ">=1.1.0" [[package]] name = "argcomplete" -version = "3.5.3" +version = "3.6.0" description = "Bash tab completion for argparse" optional = false python-versions = ">=3.8" groups = ["dev"] files = [ - {file = "argcomplete-3.5.3-py3-none-any.whl", hash = "sha256:2ab2c4a215c59fd6caaff41a869480a23e8f6a5f910b266c1808037f4e375b61"}, - {file = "argcomplete-3.5.3.tar.gz", hash = "sha256:c12bf50eded8aebb298c7b7da7a5ff3ee24dffd9f5281867dfe1424b58c55392"}, + {file = "argcomplete-3.6.0-py3-none-any.whl", hash = "sha256:4e3e4e10beb20e06444dbac0ac8dda650cb6349caeefe980208d3c548708bedd"}, + {file = "argcomplete-3.6.0.tar.gz", hash = "sha256:2e4e42ec0ba2fff54b0d244d0b1623e86057673e57bafe72dda59c64bd5dee8b"}, ] [package.extras] @@ -186,34 +186,34 @@ files = [ [[package]] name = "attrs" -version = "25.1.0" +version = "25.3.0" description = "Classes Without Boilerplate" optional = false python-versions = ">=3.8" groups = ["main", "dev"] files = [ - {file = "attrs-25.1.0-py3-none-any.whl", hash = "sha256:c75a69e28a550a7e93789579c22aa26b0f5b83b75dc4e08fe092980051e1090a"}, - {file = "attrs-25.1.0.tar.gz", hash = "sha256:1c97078a80c814273a76b2a298a932eb681c87415c11dee0a6921de7f1b02c3e"}, + {file = "attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3"}, + {file = "attrs-25.3.0.tar.gz", hash = "sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b"}, ] [package.extras] benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit-uv", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] +docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier"] tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] [[package]] name = "certifi" -version = "2024.12.14" +version = "2025.1.31" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" groups = ["main", "dev"] files = [ - {file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"}, - {file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"}, + {file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"}, + {file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"}, ] [[package]] @@ -700,26 +700,26 @@ all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2 [[package]] name = "iniconfig" -version = "2.0.0" +version = "2.1.0" description = "brain-dead simple config-ini parsing" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" groups = ["dev"] files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, + {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, + {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] [[package]] name = "mock" -version = "5.1.0" +version = "5.2.0" description = "Rolling backport of unittest.mock for all Pythons" optional = false python-versions = ">=3.6" groups = ["dev"] files = [ - {file = "mock-5.1.0-py3-none-any.whl", hash = "sha256:18c694e5ae8a208cdb3d2c20a993ca1a7b0efa258c247a1e565150f477f83744"}, - {file = "mock-5.1.0.tar.gz", hash = "sha256:5e96aad5ccda4718e0a229ed94b2024df75cc2d55575ba5762d31f5767b8767d"}, + {file = "mock-5.2.0-py3-none-any.whl", hash = "sha256:7ba87f72ca0e915175596069dbbcc7c75af7b5e9b9bc107ad6349ede0819982f"}, + {file = "mock-5.2.0.tar.gz", hash = "sha256:4e460e818629b4b173f32d08bf30d3af8123afbb8e04bb5707a1fd4799e503f0"}, ] [package.extras] diff --git a/requirements.txt b/requirements.txt index 5a828b22..0f578726 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,13 +5,13 @@ argcomplete==3.5.3 ; python_version >= "3.7" and python_version < "4.0" async-timeout==4.0.3 ; python_version >= "3.7" and python_version < "4.0" asynctest==0.13.0 ; python_version >= "3.7" and python_version < "3.8" attrs==23.1.0 ; python_version >= "3.7" and python_version < "4.0" -certifi==2023.11.17 ; python_version >= "3.7" and python_version < "4.0" +certifi==2025.1.31 ; python_version >= "3.7" and python_version < "4.0" cffi==1.17.1 ; python_version >= "3.7" and python_version < "4.0" charset-normalizer==3.2.0 ; python_version >= "3.7" and python_version < "4.0" click==8.1.7 ; python_version >= "3.7" and python_version < "4.0" colorama==0.4.6 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32" or python_version >= "3.7" and python_version < "4.0" and platform_system == "Windows" coverage[toml]==7.2.7 ; python_version >= "3.7" and python_version < "4.0" -cryptography==43.0.1 ; python_version >= "3.7" and python_version < "4.0" +cryptography==44.0.1 ; python_version >= "3.7" and python_version < "4.0" exceptiongroup==1.1.3 ; python_version >= "3.7" and python_version < "3.11" frozenlist==1.5.0 ; python_version >= "3.7" and python_version < "4.0" idna==3.10 ; python_version >= "3.7" and python_version < "4.0" @@ -24,18 +24,18 @@ pipx==1.2.0 ; python_version >= "3.7" and python_version < "4.0" pluggy==1.2.0 ; python_version >= "3.7" and python_version < "4.0" pycparser==2.21 ; python_version >= "3.7" and python_version < "4.0" pyjwt==2.8.0 ; python_version >= "3.7" and python_version < "4.0" -pyopenssl==23.3.0 ; python_version >= "3.7" and python_version < "4.0" +pyopenssl==25.0.0 ; python_version >= "3.7" and python_version < "4.0" pytest-aiohttp==1.0.4 ; python_version >= "3.7" and python_version < "4.0" pytest-asyncio==0.23.8 ; python_version >= "3.7" and python_version < "4.0" pytest-cov==4.1.0 ; python_version >= "3.7" and python_version < "4.0" pytest==7.4.0 ; python_version >= "3.7" and python_version < "4.0" pyyaml==6.0.2 ; python_version >= "3.7" and python_version < "4.0" -requests==2.31.0 ; python_version >= "3.7" and python_version < "4.0" +requests==2.32.3 ; python_version >= "3.7" and python_version < "4.0" responses==0.23.3 ; python_version >= "3.7" and python_version < "4.0" tomli==2.0.1 ; python_version >= "3.7" and python_full_version <= "3.11.0a6" types-pyyaml==6.0.12.11 ; python_version >= "3.7" and python_version < "4.0" typing-extensions==4.7.1 ; python_version >= "3.7" and python_version < "3.8" -urllib3==2.0.7 ; python_version >= "3.7" and python_version < "4.0" +urllib3==2.2.2 ; python_version >= "3.7" and python_version < "4.0" userpath==1.9.0 ; python_version >= "3.7" and python_version < "4.0" yarl==1.9.2 ; python_version >= "3.7" and python_version < "4.0" -zipp==3.15.0 ; python_version >= "3.7" and python_version < "3.8" +zipp==3.19.1 ; python_version >= "3.7" and python_version < "3.8"