rp_python_sdk 0.10.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/PKG-INFO +9 -3
  2. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/README.md +6 -0
  3. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/pyproject.toml +5 -4
  4. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/endpoints/get_participants.py +5 -1
  5. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/endpoints/retrieve_tokens.py +4 -3
  6. rp_python_sdk-1.1.0/rp_python_sdk/endpoints/util/system_info.py +23 -0
  7. rp_python_sdk-1.1.0/rp_python_sdk/endpoints/util/user_agent.py +9 -0
  8. rp_python_sdk-1.1.0/rp_python_sdk/endpoints/util/version_info.py +2 -0
  9. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/__init__.py +0 -0
  10. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/endpoints/pushed_authorisation_request.py +0 -0
  11. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/endpoints/user_info.py +0 -0
  12. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/endpoints/util/fapi.py +0 -0
  13. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/endpoints/util/mapping.py +0 -0
  14. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/filters/participant_filters.py +0 -0
  15. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/model.py +0 -0
  16. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/relying_party_client_sdk.py +0 -0
  17. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/relying_party_client_sdk_exception.py +0 -0
  18. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/sdk_config.py +0 -0
  19. {rp_python_sdk-0.10.0 → rp_python_sdk-1.1.0}/rp_python_sdk/setup_logger.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: rp_python_sdk
3
- Version: 0.10.0
3
+ Version: 1.1.0
4
4
  Summary: Python SDK for Relying Parties to enable simple integration with the Digital Identity ecosystem
5
5
  License: Proprietary
6
6
  Author: Erik Pragt
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Requires-Dist: authlib (>=1.3.2,<2.0.0)
14
14
  Requires-Dist: cffi (>=1.17.1,<2.0.0)
15
- Requires-Dist: cryptography (>=43.0.1,<44.0.0)
15
+ Requires-Dist: cryptography (>=44.0.0,<45.0.0)
16
16
  Requires-Dist: joserfc (>=1.0.0,<2.0.0)
17
17
  Requires-Dist: requests (>=2.32.3,<3.0.0)
18
18
  Description-Content-Type: text/markdown
@@ -426,6 +426,12 @@ poetry publish
426
426
 
427
427
  ## Release Notes
428
428
 
429
+ ### 1.1.0 (Mar 14, 2025)
430
+ - Implement user agent logging.
431
+
432
+ ### 0.11.0 (Nov 29, 2024)
433
+ - Update to use Authorisation Server issuer attribute as `aud` value when retrieving tokens.
434
+
429
435
  ### 0.10.0 (Oct 24, 2024)
430
436
  - JWT signature verification for id_token in the retrieve_tokens step.
431
437
 
@@ -407,6 +407,12 @@ poetry publish
407
407
 
408
408
  ## Release Notes
409
409
 
410
+ ### 1.1.0 (Mar 14, 2025)
411
+ - Implement user agent logging.
412
+
413
+ ### 0.11.0 (Nov 29, 2024)
414
+ - Update to use Authorisation Server issuer attribute as `aud` value when retrieving tokens.
415
+
410
416
  ### 0.10.0 (Oct 24, 2024)
411
417
  - JWT signature verification for id_token in the retrieve_tokens step.
412
418
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rp_python_sdk"
3
- version = "0.10.0"
3
+ version = "1.1.0"
4
4
  description = "Python SDK for Relying Parties to enable simple integration with the Digital Identity ecosystem"
5
5
  authors = ["Erik Pragt <erik.pragt@connectid.com.au>"]
6
6
  license = "Proprietary"
@@ -10,17 +10,18 @@ readme = "README.md"
10
10
  python = "^3.12"
11
11
  requests = "^2.32.3"
12
12
  authlib = "^1.3.2"
13
- cryptography = "^43.0.1"
13
+ cryptography = "^44.0.0"
14
14
  joserfc = "^1.0.0"
15
15
  cffi = "^1.17.1"
16
16
 
17
17
  [tool.poetry.group.test.dependencies]
18
18
  pytest = "^8.3.3"
19
- httpx = "^0.27.2"
19
+ httpx = "^0.28.0"
20
+ toml = "^0.10.2"
20
21
 
21
22
  [tool.poetry.group.dev.dependencies]
22
23
  black = "^24.10.0"
23
- pre-commit = "^3.8.0"
24
+ pre-commit = "^4.0.0"
24
25
  mypy = "^1.13.0"
25
26
  requests-mock = "^1.12.1"
26
27
  freezegun = "^1.4.0"
@@ -4,6 +4,7 @@ import requests
4
4
  import json
5
5
 
6
6
  from rp_python_sdk.endpoints.util.mapping import from_dict
7
+ from rp_python_sdk.endpoints.util.user_agent import build_user_agent
7
8
  from rp_python_sdk.filters.participant_filters import remove_out_of_date_certifications, \
8
9
  remove_unofficial_certifications, filter_for_fallback_identity_service_providers, \
9
10
  remove_participants_without_auth_servers, remove_fallback_identity_service_provider, \
@@ -62,7 +63,10 @@ def _retrieve_full_participants_list(config: SdkConfig) -> list[Participant]:
62
63
  logger.info(f"Retrieving all identity providers from {config.registry_participants_uri}")
63
64
 
64
65
  response = requests.get(config.registry_participants_uri,
65
- timeout=config.custom_config.timeout_in_seconds)
66
+ timeout=config.custom_config.timeout_in_seconds,
67
+ headers={
68
+ 'User-Agent': build_user_agent(config)
69
+ })
66
70
  if response.status_code != 200:
67
71
  raise RelyingPartyClientSdkException(
68
72
  f"Call to identity provider endpoint failed with code: {response.status_code}")
@@ -40,15 +40,16 @@ def retrieve_tokens(config: SdkConfig, authorisation_server_id: str, callback_bo
40
40
  f"{authorisation_server.customer_friendly_name}, x-fapi-interaction-id: {x_fapi_interaction_id}")
41
41
 
42
42
  token_endpoint = issuer_metadata.get_preferred_token_endpoint()
43
+ issuer = issuer_metadata.issuer
43
44
 
44
45
  if callback_body.state != original_state:
45
46
  raise RelyingPartyClientSdkException(
46
47
  f"Callback response state value does not match state, callback state: {callback_body.state}, "
47
48
  f"state {original_state}, x-fapi-interaction-id: {x_fapi_interaction_id}")
48
49
 
49
- if callback_body.iss != issuer_metadata.issuer:
50
+ if callback_body.iss != issuer:
50
51
  raise RelyingPartyClientSdkException(
51
- f"iss mismatch, expected {issuer_metadata.issuer} , got: {callback_body.iss}")
52
+ f"iss mismatch, expected {issuer}, got: {callback_body.iss}")
52
53
 
53
54
  redirect_uri = config.application_redirect_uri
54
55
  client_id = config.client_id
@@ -59,7 +60,7 @@ def retrieve_tokens(config: SdkConfig, authorisation_server_id: str, callback_bo
59
60
 
60
61
  client_assertion_payload = {
61
62
  'sub': client_id,
62
- 'aud': token_endpoint,
63
+ 'aud': issuer,
63
64
  'iss': client_id,
64
65
  'exp': exp,
65
66
  'jti': jti,
@@ -0,0 +1,23 @@
1
+ import platform
2
+
3
+
4
+ def get_system_info():
5
+ os_name = platform.system() # e.g., "Darwin", "Windows", "Linux"
6
+ os_version = platform.version() # e.g., "19.6.0", "10.0.19043", "5.15.0-84-generic"
7
+ python_version = platform.python_version() # Python version
8
+
9
+ return f"{detect_operating_system(os_name)}; {os_name} {os_version}; Python{python_version}"
10
+
11
+ def detect_operating_system(input):
12
+ if input is None:
13
+ return "Unknown"
14
+
15
+ os_name = input.lower()
16
+ if "darwin" in os_name:
17
+ return "Macintosh"
18
+ elif "win" in os_name:
19
+ return "Windows"
20
+ elif "linux" in os_name:
21
+ return "Linux"
22
+ else:
23
+ return "Other"
@@ -0,0 +1,9 @@
1
+ from rp_python_sdk.endpoints.util.system_info import get_system_info
2
+ from rp_python_sdk.endpoints.util.version_info import get_version_info
3
+ from rp_python_sdk.sdk_config import SdkConfig
4
+
5
+
6
+ def build_user_agent(config: SdkConfig) -> str:
7
+ version = get_version_info()
8
+ platform = get_system_info()
9
+ return f"cid-rp-python-sdk/{version} ({platform}) +{config.client_id}"
@@ -0,0 +1,2 @@
1
+ def get_version_info():
2
+ return "1.1.0" # Version number