oidcauthlib 3.0.23__tar.gz → 3.0.24__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 (96) hide show
  1. {oidcauthlib-3.0.23/oidcauthlib.egg-info → oidcauthlib-3.0.24}/PKG-INFO +3 -3
  2. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/README.md +2 -2
  3. oidcauthlib-3.0.24/VERSION +1 -0
  4. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/userinfo/oidc_userinfo_manager.py +11 -10
  5. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24/oidcauthlib.egg-info}/PKG-INFO +3 -3
  6. oidcauthlib-3.0.23/VERSION +0 -1
  7. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/LICENSE +0 -0
  8. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/MANIFEST.in +0 -0
  9. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/__init__.py +0 -0
  10. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/__init__.py +0 -0
  11. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/auth_helper.py +0 -0
  12. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/auth_manager.py +0 -0
  13. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/cache/__init__.py +0 -0
  14. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/cache/oauth_cache.py +0 -0
  15. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/cache/oauth_memory_cache.py +0 -0
  16. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/cache/oauth_mongo_cache.py +0 -0
  17. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/config/__init__.py +0 -0
  18. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/config/auth_config.py +0 -0
  19. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/config/auth_config_reader.py +0 -0
  20. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/dcr/__init__.py +0 -0
  21. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/dcr/dcr_client.py +0 -0
  22. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/dcr/dcr_manager.py +0 -0
  23. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/dcr/dcr_registration.py +0 -0
  24. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/exceptions/__init__.py +0 -0
  25. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/exceptions/authorization_bearer_token_expired_exception.py +0 -0
  26. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/exceptions/authorization_bearer_token_invalid_exception.py +0 -0
  27. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/exceptions/authorization_bearer_token_missing_exception.py +0 -0
  28. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/exceptions/authorization_needed_exception.py +0 -0
  29. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/fastapi_auth_manager.py +0 -0
  30. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/middleware/__init__.py +0 -0
  31. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/middleware/request_scope_middleware.py +0 -0
  32. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/middleware/token_reader_middleware.py +0 -0
  33. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/models/__init__.py +0 -0
  34. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/models/auth.py +0 -0
  35. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/models/base_db_model.py +0 -0
  36. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/models/cache_item.py +0 -0
  37. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/models/client_key_set.py +0 -0
  38. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/models/token.py +0 -0
  39. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/__init__.py +0 -0
  40. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/base_repository.py +0 -0
  41. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/memory/__init__.py +0 -0
  42. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/memory/memory_repository.py +0 -0
  43. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/mongo/__init__.py +0 -0
  44. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/mongo/mongo_repository.py +0 -0
  45. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/repository/repository_factory.py +0 -0
  46. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/routers/__init__.py +0 -0
  47. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/routers/auth_router.py +0 -0
  48. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/token_reader.py +0 -0
  49. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/userinfo/__init__.py +0 -0
  50. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/well_known_configuration/__init__.py +0 -0
  51. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/well_known_configuration/auth_server_metadata.py +0 -0
  52. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/well_known_configuration/auth_server_metadata_discovery.py +0 -0
  53. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/well_known_configuration/well_known_configuration_cache.py +0 -0
  54. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/well_known_configuration/well_known_configuration_cache_result.py +0 -0
  55. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/auth/well_known_configuration/well_known_configuration_manager.py +0 -0
  56. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/cache_gate/__init__.py +0 -0
  57. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/cache_gate/advisory_lock.py +0 -0
  58. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/cache_gate/version_gate.py +0 -0
  59. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/container/__init__.py +0 -0
  60. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/container/oidc_authlib_container_factory.py +0 -0
  61. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/__init__.py +0 -0
  62. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/attribute_names.py +0 -0
  63. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/configurator.py +0 -0
  64. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/filtering_sampler.py +0 -0
  65. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/filtering_span_exporter.py +0 -0
  66. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/filtering_span_processor.py +0 -0
  67. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/otel_setup.py +0 -0
  68. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/open_telemetry/span_names.py +0 -0
  69. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/py.typed +0 -0
  70. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/__init__.py +0 -0
  71. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/cache_to_collection_mapper.py +0 -0
  72. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/memory_storage_factory.py +0 -0
  73. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/mongo_gridfs_db.py +0 -0
  74. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/mongo_gridfs_exception.py +0 -0
  75. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/mongo_storage_factory.py +0 -0
  76. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/storage_factory.py +0 -0
  77. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/storage/storage_factory_creator.py +0 -0
  78. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/__init__.py +0 -0
  79. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/cached.py +0 -0
  80. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/environment/__init__.py +0 -0
  81. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/environment/abstract_environment_variables.py +0 -0
  82. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/environment/oidc_environment_variables.py +0 -0
  83. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/logger/__init__.py +0 -0
  84. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/logger/log_levels.py +0 -0
  85. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/logger/logging_response.py +0 -0
  86. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/logger/logging_transport.py +0 -0
  87. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/mongo_url_utils.py +0 -0
  88. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib/utilities/url_validator.py +0 -0
  89. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib.egg-info/SOURCES.txt +0 -0
  90. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib.egg-info/dependency_links.txt +0 -0
  91. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib.egg-info/requires.txt +0 -0
  92. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/oidcauthlib.egg-info/top_level.txt +0 -0
  93. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/pyproject.toml +0 -0
  94. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/setup.cfg +0 -0
  95. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/tests/test_mongo_url_utils.py +0 -0
  96. {oidcauthlib-3.0.23 → oidcauthlib-3.0.24}/tests/test_simple.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oidcauthlib
3
- Version: 3.0.23
3
+ Version: 3.0.24
4
4
  Summary: oidcauthlib
5
5
  Author-email: Imran Qureshi <imran.qureshi@bwell.com>
6
6
  License: Apache-2.0
@@ -58,8 +58,8 @@ scopes = await manager.get_scopes_from_user_info_async(access_token=token)
58
58
  - **Provider** is matched to the token's `iss`: an exact `issuer`, else a `well_known_uri` on the same scheme,
59
59
  host and port whose path segments start with the issuer's. Only a token with no `iss` at all is matched by
60
60
  its client id. A token matching no provider raises `ValueError`; it is never sent to another provider.
61
- - **Subject check:** the userinfo response's `sub` must equal the token's `sub` (OIDC Core 5.3.2); otherwise
62
- the lookup raises `ValueError` and nothing is cached.
61
+ - **Subject check:** for a token that has a `sub`, the userinfo response must carry the same `sub`
62
+ (OIDC Core 5.3.2); a missing or different one raises `ValueError` and nothing is cached.
63
63
  - **Cache** key is `oidc-userinfo-scopes:<issuer>:<client_id>:<sub>|v1` with each segment percent-encoded
64
64
  (so values containing `:` cannot collide, and two providers never share an entry); only the
65
65
  userinfo-derived scopes are stored, never the userinfo response. The token's own scopes are re-derived on every call. A token without
@@ -30,8 +30,8 @@ scopes = await manager.get_scopes_from_user_info_async(access_token=token)
30
30
  - **Provider** is matched to the token's `iss`: an exact `issuer`, else a `well_known_uri` on the same scheme,
31
31
  host and port whose path segments start with the issuer's. Only a token with no `iss` at all is matched by
32
32
  its client id. A token matching no provider raises `ValueError`; it is never sent to another provider.
33
- - **Subject check:** the userinfo response's `sub` must equal the token's `sub` (OIDC Core 5.3.2); otherwise
34
- the lookup raises `ValueError` and nothing is cached.
33
+ - **Subject check:** for a token that has a `sub`, the userinfo response must carry the same `sub`
34
+ (OIDC Core 5.3.2); a missing or different one raises `ValueError` and nothing is cached.
35
35
  - **Cache** key is `oidc-userinfo-scopes:<issuer>:<client_id>:<sub>|v1` with each segment percent-encoded
36
36
  (so values containing `:` cannot collide, and two providers never share an entry); only the
37
37
  userinfo-derived scopes are stored, never the userinfo response. The token's own scopes are re-derived on every call. A token without
@@ -0,0 +1 @@
1
+ 3.0.24
@@ -43,8 +43,8 @@ class OidcUserInfoManager:
43
43
  same scheme, host and port whose path segments start with the issuer's). Only a token with no ``iss`` at
44
44
  all is matched by its client id. A token matching no provider is an error: the bearer token is never
45
45
  sent to an unrelated provider.
46
- - The userinfo response's ``sub`` must equal the token's ``sub`` (OIDC Core 5.3.2), else the lookup fails
47
- and nothing is cached.
46
+ - For a token that has a ``sub``, the userinfo response must carry the same ``sub`` (OIDC Core 5.3.2); a
47
+ missing or different one fails the lookup and nothing is cached.
48
48
  - The userinfo endpoint is discovered through ``WellKnownConfigurationManager``.
49
49
  - Scopes are derived the way fhir-server-ui's ``jwtParser`` does: the ``scope`` claim (plus ``scp``,
50
50
  which Okta uses), the claims named in ``scope_claims``, and each claim named in ``group_claims``
@@ -184,12 +184,13 @@ class OidcUserInfoManager:
184
184
 
185
185
  ``access_token`` must already have been verified by the caller; its claims are trusted.
186
186
 
187
- Per OIDC Core 5.3.2 the response's ``sub`` must equal the token's ``sub``; a response that carries a
188
- different ``sub`` describes another user and is rejected.
187
+ Per OIDC Core 5.3.2 the response must carry a ``sub`` equal to the token's ``sub``; a response without
188
+ one, or with a different one, cannot be shown to describe the token's user and is rejected. A token
189
+ that has no ``sub`` has nothing to compare, so its response is accepted (and never cached).
189
190
 
190
191
  Raises:
191
- ValueError: the token, auth config, discovery document or response is unusable, or the response
192
- is for a different subject.
192
+ ValueError: the token, auth config, discovery document or response is unusable, or the response's
193
+ subject is missing or differs from the token's.
193
194
  httpx.HTTPError: the userinfo request failed.
194
195
  """
195
196
  if not access_token.token:
@@ -221,10 +222,10 @@ class OidcUserInfoManager:
221
222
  user_info = response.json()
222
223
  if not isinstance(user_info, dict):
223
224
  raise ValueError("User info response is not a valid JSON object")
224
- response_subject = user_info.get("sub")
225
- if response_subject is not None and access_token.subject and response_subject != access_token.subject:
226
- # Neither subject is logged: they identify users.
227
- raise ValueError("User info response is for a different subject than the token")
225
+ if access_token.subject and user_info.get("sub") != access_token.subject:
226
+ # Missing or different: ``sub`` is required in the response, and one that cannot be shown
227
+ # to be the token's subject must not be turned into scopes. Neither subject is logged.
228
+ raise ValueError("User info response subject is missing or differs from the token's subject")
228
229
  return user_info
229
230
 
230
231
  async def get_scopes_from_user_info_async(self, *, access_token: Token) -> list[str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oidcauthlib
3
- Version: 3.0.23
3
+ Version: 3.0.24
4
4
  Summary: oidcauthlib
5
5
  Author-email: Imran Qureshi <imran.qureshi@bwell.com>
6
6
  License: Apache-2.0
@@ -58,8 +58,8 @@ scopes = await manager.get_scopes_from_user_info_async(access_token=token)
58
58
  - **Provider** is matched to the token's `iss`: an exact `issuer`, else a `well_known_uri` on the same scheme,
59
59
  host and port whose path segments start with the issuer's. Only a token with no `iss` at all is matched by
60
60
  its client id. A token matching no provider raises `ValueError`; it is never sent to another provider.
61
- - **Subject check:** the userinfo response's `sub` must equal the token's `sub` (OIDC Core 5.3.2); otherwise
62
- the lookup raises `ValueError` and nothing is cached.
61
+ - **Subject check:** for a token that has a `sub`, the userinfo response must carry the same `sub`
62
+ (OIDC Core 5.3.2); a missing or different one raises `ValueError` and nothing is cached.
63
63
  - **Cache** key is `oidc-userinfo-scopes:<issuer>:<client_id>:<sub>|v1` with each segment percent-encoded
64
64
  (so values containing `:` cannot collide, and two providers never share an entry); only the
65
65
  userinfo-derived scopes are stored, never the userinfo response. The token's own scopes are re-derived on every call. A token without
@@ -1 +0,0 @@
1
- 3.0.23
File without changes
File without changes
File without changes