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

Adding Support For CIBA with RAR #679

Merged
merged 11 commits into from
Mar 21, 2025
4 changes: 4 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
1 change: 1 addition & 0 deletions auth0/authentication/back_channel_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ def back_channel_login(
"scope": scope,
**kwargs,
},
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
60 changes: 60 additions & 0 deletions auth0/test/authentication/test_back_channel_login.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import unittest
from unittest import mock
import json

import requests
from ...exceptions import Auth0Error, RateLimitError
Expand Down Expand Up @@ -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)
)



Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
34 changes: 17 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"