google-auth 2.56.2__tar.gz → 2.56.3__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 (199) hide show
  1. {google_auth-2.56.2/google_auth.egg-info → google_auth-2.56.3}/PKG-INFO +1 -1
  2. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/transport/sessions.py +3 -4
  3. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/grpc.py +9 -1
  4. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/requests.py +8 -1
  5. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/version.py +1 -1
  6. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/id_token.py +22 -4
  7. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/webauthn_handler.py +18 -3
  8. {google_auth-2.56.2 → google_auth-2.56.3/google_auth.egg-info}/PKG-INFO +1 -1
  9. {google_auth-2.56.2 → google_auth-2.56.3}/setup.py +1 -2
  10. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_id_token.py +45 -7
  11. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_webauthn_handler.py +21 -0
  12. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/aio/test_sessions.py +26 -0
  13. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/aio/test_sessions_mtls.py +1 -3
  14. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test_grpc.py +29 -0
  15. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test_requests.py +43 -12
  16. {google_auth-2.56.2 → google_auth-2.56.3}/LICENSE +0 -0
  17. {google_auth-2.56.2 → google_auth-2.56.3}/MANIFEST.in +0 -0
  18. {google_auth-2.56.2 → google_auth-2.56.3}/README.rst +0 -0
  19. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/__init__.py +0 -0
  20. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_agent_identity_utils.py +0 -0
  21. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_cache.py +0 -0
  22. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_cloud_sdk.py +0 -0
  23. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_credentials_async.py +0 -0
  24. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_credentials_base.py +0 -0
  25. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_default.py +0 -0
  26. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_default_async.py +0 -0
  27. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_exponential_backoff.py +0 -0
  28. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_helpers.py +0 -0
  29. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_jwt_async.py +0 -0
  30. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_oauth2client.py +0 -0
  31. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_refresh_worker.py +0 -0
  32. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_regional_access_boundary_utils.py +0 -0
  33. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/_service_account_info.py +0 -0
  34. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/__init__.py +0 -0
  35. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/_helpers.py +0 -0
  36. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/credentials.py +0 -0
  37. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/transport/__init__.py +0 -0
  38. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/transport/aiohttp.py +0 -0
  39. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aio/transport/mtls.py +0 -0
  40. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/api_key.py +0 -0
  41. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/app_engine.py +0 -0
  42. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/aws.py +0 -0
  43. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/compute_engine/__init__.py +0 -0
  44. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/compute_engine/_metadata.py +0 -0
  45. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/compute_engine/_mtls.py +0 -0
  46. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/compute_engine/credentials.py +0 -0
  47. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/credentials.py +0 -0
  48. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/__init__.py +0 -0
  49. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/_cryptography_rsa.py +0 -0
  50. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/_helpers.py +0 -0
  51. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/_python_rsa.py +0 -0
  52. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/base.py +0 -0
  53. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/es.py +0 -0
  54. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/es256.py +0 -0
  55. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/crypt/rsa.py +0 -0
  56. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/downscoped.py +0 -0
  57. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/environment_vars.py +0 -0
  58. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/exceptions.py +0 -0
  59. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/external_account.py +0 -0
  60. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/external_account_authorized_user.py +0 -0
  61. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/iam.py +0 -0
  62. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/identity_pool.py +0 -0
  63. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/impersonated_credentials.py +0 -0
  64. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/jwt.py +0 -0
  65. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/metrics.py +0 -0
  66. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/pluggable.py +0 -0
  67. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/py.typed +0 -0
  68. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/__init__.py +0 -0
  69. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/_aiohttp_requests.py +0 -0
  70. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/_custom_tls_signer.py +0 -0
  71. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/_http_client.py +0 -0
  72. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/_mtls_helper.py +0 -0
  73. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/_requests_base.py +0 -0
  74. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/mtls.py +0 -0
  75. {google_auth-2.56.2 → google_auth-2.56.3}/google/auth/transport/urllib3.py +0 -0
  76. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/__init__.py +0 -0
  77. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/_client.py +0 -0
  78. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/_client_async.py +0 -0
  79. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/_credentials_async.py +0 -0
  80. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/_id_token_async.py +0 -0
  81. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/_reauth_async.py +0 -0
  82. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/_service_account_async.py +0 -0
  83. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/challenges.py +0 -0
  84. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/credentials.py +0 -0
  85. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/gdch_credentials.py +0 -0
  86. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/py.typed +0 -0
  87. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/reauth.py +0 -0
  88. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/service_account.py +0 -0
  89. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/sts.py +0 -0
  90. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/utils.py +0 -0
  91. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/webauthn_handler_factory.py +0 -0
  92. {google_auth-2.56.2 → google_auth-2.56.3}/google/oauth2/webauthn_types.py +0 -0
  93. {google_auth-2.56.2 → google_auth-2.56.3}/google_auth.egg-info/SOURCES.txt +0 -0
  94. {google_auth-2.56.2 → google_auth-2.56.3}/google_auth.egg-info/dependency_links.txt +0 -0
  95. {google_auth-2.56.2 → google_auth-2.56.3}/google_auth.egg-info/requires.txt +0 -0
  96. {google_auth-2.56.2 → google_auth-2.56.3}/google_auth.egg-info/top_level.txt +0 -0
  97. {google_auth-2.56.2 → google_auth-2.56.3}/setup.cfg +0 -0
  98. {google_auth-2.56.2 → google_auth-2.56.3}/tests/__init__.py +0 -0
  99. {google_auth-2.56.2 → google_auth-2.56.3}/tests/aio/test__helpers.py +0 -0
  100. {google_auth-2.56.2 → google_auth-2.56.3}/tests/compute_engine/__init__.py +0 -0
  101. {google_auth-2.56.2 → google_auth-2.56.3}/tests/compute_engine/data/smbios_product_name +0 -0
  102. {google_auth-2.56.2 → google_auth-2.56.3}/tests/compute_engine/data/smbios_product_name_non_google +0 -0
  103. {google_auth-2.56.2 → google_auth-2.56.3}/tests/compute_engine/test__metadata.py +0 -0
  104. {google_auth-2.56.2 → google_auth-2.56.3}/tests/compute_engine/test__mtls.py +0 -0
  105. {google_auth-2.56.2 → google_auth-2.56.3}/tests/compute_engine/test_credentials.py +0 -0
  106. {google_auth-2.56.2 → google_auth-2.56.3}/tests/conftest.py +0 -0
  107. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/__init__.py +0 -0
  108. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/test__cryptography_rsa.py +0 -0
  109. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/test__python_rsa.py +0 -0
  110. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/test_crypt.py +0 -0
  111. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/test_es.py +0 -0
  112. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/test_es256.py +0 -0
  113. {google_auth-2.56.2 → google_auth-2.56.3}/tests/crypt/test_rsa.py +0 -0
  114. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/authorized_user.json +0 -0
  115. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/authorized_user_cloud_sdk.json +0 -0
  116. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/authorized_user_cloud_sdk_with_quota_project_id.json +0 -0
  117. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/authorized_user_with_rapt_token.json +0 -0
  118. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/client_secrets.json +0 -0
  119. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/context_aware_metadata.json +0 -0
  120. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/enterprise_cert_invalid.json +0 -0
  121. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/enterprise_cert_valid.json +0 -0
  122. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/enterprise_cert_valid_provider.json +0 -0
  123. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es256_privatekey.pem +0 -0
  124. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es256_public_cert.pem +0 -0
  125. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es256_publickey.pem +0 -0
  126. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es256_service_account.json +0 -0
  127. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es384_privatekey.pem +0 -0
  128. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es384_public_cert.pem +0 -0
  129. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es384_publickey.pem +0 -0
  130. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/es384_service_account.json +0 -0
  131. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/external_account_authorized_user.json +0 -0
  132. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/external_account_authorized_user_non_gdu.json +0 -0
  133. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/external_subject_token.json +0 -0
  134. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/external_subject_token.txt +0 -0
  135. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/gdch_service_account.json +0 -0
  136. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/impersonated_service_account_authorized_user_source.json +0 -0
  137. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/impersonated_service_account_external_account_authorized_user_source.json +0 -0
  138. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/impersonated_service_account_service_account_source.json +0 -0
  139. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/impersonated_service_account_with_quota_project.json +0 -0
  140. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/old_oauth_credentials_py3.pickle +0 -0
  141. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/other_cert.pem +0 -0
  142. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/pem_from_pkcs12.pem +0 -0
  143. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/privatekey.p12 +0 -0
  144. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/privatekey.pem +0 -0
  145. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/privatekey.pub +0 -0
  146. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/public_cert.pem +0 -0
  147. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/service_account.json +0 -0
  148. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/service_account_non_gdu.json +0 -0
  149. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/trust_chain_with_leaf.pem +0 -0
  150. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/trust_chain_without_leaf.pem +0 -0
  151. {google_auth-2.56.2 → google_auth-2.56.3}/tests/data/trust_chain_wrong_order.pem +0 -0
  152. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/__init__.py +0 -0
  153. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test__client.py +0 -0
  154. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_challenges.py +0 -0
  155. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_credentials.py +0 -0
  156. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_gdch_credentials.py +0 -0
  157. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_reauth.py +0 -0
  158. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_service_account.py +0 -0
  159. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_sts.py +0 -0
  160. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_utils.py +0 -0
  161. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_webauthn_handler_factory.py +0 -0
  162. {google_auth-2.56.2 → google_auth-2.56.3}/tests/oauth2/test_webauthn_types.py +0 -0
  163. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__cache.py +0 -0
  164. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__cloud_sdk.py +0 -0
  165. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__default.py +0 -0
  166. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__exponential_backoff.py +0 -0
  167. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__helpers.py +0 -0
  168. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__oauth2client.py +0 -0
  169. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__refresh_worker.py +0 -0
  170. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__regional_access_boundary_utils.py +0 -0
  171. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test__service_account_info.py +0 -0
  172. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_agent_identity_utils.py +0 -0
  173. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_api_key.py +0 -0
  174. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_app_engine.py +0 -0
  175. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_aws.py +0 -0
  176. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_credentials.py +0 -0
  177. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_credentials_async.py +0 -0
  178. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_downscoped.py +0 -0
  179. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_exceptions.py +0 -0
  180. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_external_account.py +0 -0
  181. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_external_account_authorized_user.py +0 -0
  182. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_iam.py +0 -0
  183. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_identity_pool.py +0 -0
  184. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_impersonated_credentials.py +0 -0
  185. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_jwt.py +0 -0
  186. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_metrics.py +0 -0
  187. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_packaging.py +0 -0
  188. {google_auth-2.56.2 → google_auth-2.56.3}/tests/test_pluggable.py +0 -0
  189. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/__init__.py +0 -0
  190. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/aio/conftest.py +0 -0
  191. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/aio/test_aiohttp.py +0 -0
  192. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/aioresponses_compat.py +0 -0
  193. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/compliance.py +0 -0
  194. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test__custom_tls_signer.py +0 -0
  195. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test__http_client.py +0 -0
  196. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test__mtls_helper.py +0 -0
  197. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test_aio_mtls_helper.py +0 -0
  198. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test_mtls.py +0 -0
  199. {google_auth-2.56.2 → google_auth-2.56.3}/tests/transport/test_urllib3.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-auth
3
- Version: 2.56.2
3
+ Version: 2.56.3
4
4
  Summary: Google Authentication Library
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-auth
6
6
  Author: Google Cloud Platform
@@ -192,14 +192,13 @@ class AsyncAuthorizedSession:
192
192
  ) = await mtls.get_client_cert_and_key(client_cert_callback)
193
193
 
194
194
  if is_mtls:
195
- ssl_context = await mtls._run_in_executor(
196
- mtls.make_client_cert_ssl_context, cert, key
197
- )
198
-
199
195
  # Re-create the auth request with the new SSL context
200
196
  if AIOHTTP_INSTALLED and isinstance(
201
197
  self._auth_request, AiohttpRequest
202
198
  ):
199
+ ssl_context = await mtls._run_in_executor(
200
+ mtls.make_client_cert_ssl_context, cert, key
201
+ )
203
202
  connector = aiohttp.TCPConnector(ssl=ssl_context)
204
203
  new_session = aiohttp.ClientSession(connector=connector)
205
204
 
@@ -48,9 +48,13 @@ class AuthMetadataPlugin(grpc.AuthMetadataPlugin):
48
48
  default_host (Optional[str]): A host like "pubsub.googleapis.com".
49
49
  This is used when a self-signed JWT is created from service
50
50
  account credentials.
51
+ suppress_metrics_header (bool): When enabled, ``x-goog-api-client``
52
+ will be stripped from authorization headers.
51
53
  """
52
54
 
53
- def __init__(self, credentials, request, default_host=None):
55
+ def __init__(
56
+ self, credentials, request, default_host=None, *, suppress_metrics_header=False
57
+ ):
54
58
  # pylint: disable=no-value-for-parameter
55
59
  # pylint doesn't realize that the super method takes no arguments
56
60
  # because this class is the same name as the superclass.
@@ -58,6 +62,7 @@ class AuthMetadataPlugin(grpc.AuthMetadataPlugin):
58
62
  self._credentials = credentials
59
63
  self._request = request
60
64
  self._default_host = default_host
65
+ self._suppress_metrics_header = suppress_metrics_header
61
66
 
62
67
  def _get_authorization_headers(self, context):
63
68
  """Gets the authorization headers for a request.
@@ -81,6 +86,9 @@ class AuthMetadataPlugin(grpc.AuthMetadataPlugin):
81
86
  self._request, context.method_name, context.service_url, headers
82
87
  )
83
88
 
89
+ if self._suppress_metrics_header and "x-goog-api-client" in headers:
90
+ del headers["x-goog-api-client"]
91
+
84
92
  return list(headers.items())
85
93
 
86
94
  def __call__(self, context, callback):
@@ -647,7 +647,14 @@ class AuthorizedSession(requests.Session):
647
647
  ):
648
648
  # Handle unauthorized permission error(401 status code)
649
649
  if response.status_code == http_client.UNAUTHORIZED:
650
- if self.is_mtls:
650
+ MTLS_URL_PREFIXES = [
651
+ "mtls.googleapis.com",
652
+ "mtls.sandbox.googleapis.com",
653
+ ]
654
+ use_mtls = self.is_mtls and any(
655
+ prefix in url for prefix in MTLS_URL_PREFIXES
656
+ )
657
+ if use_mtls:
651
658
  (
652
659
  call_cert_bytes,
653
660
  call_key_bytes,
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "2.56.2"
15
+ __version__ = "2.56.3"
@@ -124,7 +124,7 @@ def verify_token(
124
124
  intended for. If None then the audience is not verified.
125
125
  certs_url (str): The URL that specifies the certificates to use to
126
126
  verify the token. This URL should return JSON in the format of
127
- ``{'key id': 'x509 certificate'}`` or a certificate array according to
127
+ ``{'key id': 'x509 certificate'}`` or a JWK Set according to
128
128
  the JWK spec (see https://tools.ietf.org/html/rfc7517).
129
129
  clock_skew_in_seconds (int): The clock skew used for `iat` and `exp`
130
130
  validation.
@@ -132,17 +132,35 @@ def verify_token(
132
132
  Returns:
133
133
  Mapping[str, Any]: The decoded token.
134
134
  """
135
+ if isinstance(id_token, bytes):
136
+ id_token = id_token.decode("utf-8")
137
+
135
138
  certs = _fetch_certs(request, certs_url)
136
139
 
137
140
  if "keys" in certs:
138
141
  try:
139
- import jwt as jwt_lib # type: ignore
142
+ import jwt as jwt_lib
143
+ from jwt.api_jwk import PyJWKSet
144
+ from jwt.exceptions import PyJWKClientError
140
145
  except ImportError as caught_exc: # pragma: NO COVER
141
146
  raise ImportError(
142
147
  "The pyjwt library is not installed, please install the pyjwt package to use the jwk certs format."
143
148
  ) from caught_exc
144
- jwks_client = jwt_lib.PyJWKClient(certs_url)
145
- signing_key = jwks_client.get_signing_key_from_jwt(id_token)
149
+ jwkset = PyJWKSet.from_dict(certs)
150
+ header = jwt_lib.get_unverified_header(id_token)
151
+ kid = header.get("kid")
152
+
153
+ signing_key = None
154
+ for key in jwkset.keys:
155
+ if kid and key.key_id == kid and key.public_key_use in ("sig", None):
156
+ signing_key = key
157
+ break
158
+
159
+ if signing_key is None:
160
+ raise PyJWKClientError(
161
+ f'Unable to find a signing key that matches: "{kid}"'
162
+ )
163
+
146
164
  return jwt_lib.decode(
147
165
  id_token,
148
166
  signing_key.key,
@@ -57,9 +57,24 @@ class PluginHandler(WebAuthnHandler):
57
57
  request = length_bytes_le + input_json.encode()
58
58
 
59
59
  # Call plugin
60
- process_result = subprocess.run(
61
- [cmd], input=request, capture_output=True, check=True
62
- )
60
+ process_result = subprocess.run([cmd], input=request, capture_output=True)
61
+
62
+ if process_result.returncode != 0:
63
+ stdout_bytes = process_result.stdout
64
+ if (
65
+ len(stdout_bytes) >= 4
66
+ and struct.unpack("<I", stdout_bytes[:4])[0] == len(stdout_bytes) - 4
67
+ ):
68
+ stdout_bytes = stdout_bytes[4:]
69
+
70
+ error_msg = "Command '{}' returned non-zero exit status {}.\nStdout: {}\nStderr: {}".format(
71
+ cmd,
72
+ process_result.returncode,
73
+ stdout_bytes.decode(errors="replace").strip(),
74
+ process_result.stderr.decode(errors="replace").strip(),
75
+ )
76
+
77
+ raise exceptions.GoogleAuthError(error_msg)
63
78
 
64
79
  # Check length of response
65
80
  response_len_le = process_result.stdout[:4]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-auth
3
- Version: 2.56.2
3
+ Version: 2.56.3
4
4
  Summary: Google Authentication Library
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-auth
6
6
  Author: Google Cloud Platform
@@ -15,8 +15,7 @@
15
15
  import io
16
16
  import os
17
17
 
18
- from setuptools import find_namespace_packages
19
- from setuptools import setup
18
+ from setuptools import find_namespace_packages, setup
20
19
 
21
20
  cryptography_base_require = [
22
21
  "cryptography >= 38.0.3; python_version < '3.14'",
@@ -86,28 +86,66 @@ def test_verify_token(_fetch_certs, decode):
86
86
 
87
87
 
88
88
  @mock.patch("google.oauth2.id_token._fetch_certs", autospec=True)
89
- @mock.patch("jwt.PyJWKClient", autospec=True)
89
+ @mock.patch("jwt.api_jwk.PyJWKSet", autospec=True)
90
+ @mock.patch("jwt.get_unverified_header", autospec=True)
90
91
  @mock.patch("jwt.decode", autospec=True)
91
- def test_verify_token_jwk(decode, py_jwk, _fetch_certs):
92
+ def test_verify_token_jwk(decode, get_unverified_header, py_jwk_set, _fetch_certs):
92
93
  certs_url = "abc123"
93
94
  data = {"keys": [{"alg": "RS256"}]}
94
95
  _fetch_certs.return_value = data
96
+ get_unverified_header.return_value = {"kid": "mock-kid"}
97
+
98
+ mock_key = mock.MagicMock()
99
+ mock_key.key_id = "mock-kid"
100
+ mock_key.public_key_use = "sig"
101
+ mock_key.key = mock.sentinel.key
102
+ mock_key.algorithm_name = "mock-alg"
103
+ py_jwk_set.from_dict.return_value.keys = [mock_key]
95
104
  result = id_token.verify_token(
96
105
  mock.sentinel.token, mock.sentinel.request, certs_url=certs_url
97
106
  )
98
107
  assert result == decode.return_value
99
- py_jwk.assert_called_once_with(certs_url)
100
- signing_key = py_jwk.return_value.get_signing_key_from_jwt
108
+ py_jwk_set.from_dict.assert_called_once_with(data)
109
+ get_unverified_header.assert_called_once_with(mock.sentinel.token)
110
+
101
111
  _fetch_certs.assert_called_once_with(mock.sentinel.request, certs_url)
102
- signing_key.assert_called_once_with(mock.sentinel.token)
103
112
  decode.assert_called_once_with(
104
113
  mock.sentinel.token,
105
- signing_key.return_value.key,
106
- algorithms=[signing_key.return_value.algorithm_name],
114
+ mock.sentinel.key,
115
+ algorithms=["mock-alg"],
107
116
  audience=None,
108
117
  )
109
118
 
110
119
 
120
+ @mock.patch("google.oauth2.id_token._fetch_certs", autospec=True)
121
+ @mock.patch("jwt.api_jwk.PyJWKSet", autospec=True)
122
+ @mock.patch("jwt.get_unverified_header", autospec=True)
123
+ @mock.patch("jwt.decode", autospec=True)
124
+ def test_verify_token_jwk_missing_kid(
125
+ decode, get_unverified_header, py_jwk_set, _fetch_certs
126
+ ):
127
+ from jwt.exceptions import PyJWKClientError
128
+
129
+ certs_url = "abc123"
130
+ data = {"keys": [{"alg": "RS256"}]}
131
+ _fetch_certs.return_value = data
132
+ get_unverified_header.return_value = {"kid": "mock-kid"}
133
+
134
+ mock_key = mock.MagicMock()
135
+ mock_key.key_id = "different-kid"
136
+ mock_key.public_key_use = "sig"
137
+ mock_key.key = mock.sentinel.key
138
+ mock_key.algorithm_name = "mock-alg"
139
+ py_jwk_set.from_dict.return_value.keys = [mock_key]
140
+
141
+ with pytest.raises(
142
+ PyJWKClientError, match='Unable to find a signing key that matches: "mock-kid"'
143
+ ):
144
+ id_token.verify_token(
145
+ mock.sentinel.token, mock.sentinel.request, certs_url=certs_url
146
+ )
147
+
148
+
111
149
  @mock.patch("google.auth.jwt.decode", autospec=True)
112
150
  @mock.patch("google.oauth2.id_token._fetch_certs", autospec=True)
113
151
  def test_verify_token_args(_fetch_certs, decode):
@@ -49,6 +49,7 @@ def test_malformated_get_assertion_response(os_get_stub, subprocess_run_stub):
49
49
  response_len = struct.pack("<I", 5)
50
50
  response = "1234567890"
51
51
  mock_response = mock.Mock()
52
+ mock_response.returncode = 0
52
53
  mock_response.stdout = response_len + response.encode()
53
54
  subprocess_run_stub.return_value = mock_response
54
55
 
@@ -68,6 +69,7 @@ def test_failure_get_assertion(os_get_stub, subprocess_run_stub):
68
69
 
69
70
  # process returns get response in json
70
71
  mock_response = mock.Mock()
72
+ mock_response.returncode = 0
71
73
  mock_response.stdout = response_len + response_json
72
74
  subprocess_run_stub.return_value = mock_response
73
75
 
@@ -96,6 +98,7 @@ def test_success_get_assertion(os_get_stub, subprocess_run_stub):
96
98
 
97
99
  # process returns get response in json
98
100
  mock_response = mock.Mock()
101
+ mock_response.returncode = 0
99
102
  mock_response.stdout = valid_plugin_response_len + valid_plugin_response_json
100
103
  subprocess_run_stub.return_value = mock_response
101
104
 
@@ -146,3 +149,21 @@ def test_success_get_assertion(os_get_stub, subprocess_run_stub):
146
149
  assert (
147
150
  got_response.response.user_handle == success_response["response"]["userHandle"]
148
151
  )
152
+
153
+
154
+ def test_plugin_nonzero_exit(os_get_stub, subprocess_run_stub):
155
+ response_json = b"detailed_gnubby_internal_crash_log"
156
+ response_len = struct.pack("<I", len(response_json))
157
+
158
+ mock_response = mock.Mock()
159
+ mock_response.returncode = 1
160
+ mock_response.stdout = response_len + response_json
161
+ mock_response.stderr = b"stderr dump"
162
+ subprocess_run_stub.return_value = mock_response
163
+
164
+ test_handler = webauthn_handler.PluginHandler()
165
+ with pytest.raises(exceptions.GoogleAuthError) as excinfo:
166
+ test_handler.get(GET_ASSERTION_REQUEST)
167
+
168
+ assert "returned non-zero exit status 1" in str(excinfo.value)
169
+ assert "detailed_gnubby_internal_crash_log" in str(excinfo.value)
@@ -335,6 +335,32 @@ class TestAsyncAuthorizedSession(object):
335
335
  assert await response.read() == expected_payload
336
336
  response = await authed_session.close()
337
337
 
338
+ @pytest.mark.asyncio
339
+ async def test_configure_mtls_channel_with_custom_transport_and_broken_cert(self):
340
+ auth_request = MockRequest()
341
+ authed_session = sessions.AsyncAuthorizedSession(
342
+ self.credentials, auth_request=auth_request
343
+ )
344
+
345
+ with patch(
346
+ "google.auth.transport._mtls_helper.check_use_client_cert",
347
+ return_value=True,
348
+ ):
349
+
350
+ def callback():
351
+ return b"invalid-cert", b"invalid-key"
352
+
353
+ with pytest.warns(
354
+ UserWarning,
355
+ match="Attempted to establish mTLS, but a custom async transport was provided",
356
+ ):
357
+ await authed_session.configure_mtls_channel(callback)
358
+
359
+ assert authed_session._is_mtls is False
360
+ assert authed_session._cached_cert is None
361
+
362
+ await authed_session.close()
363
+
338
364
 
339
365
  def test_mock_request_clone():
340
366
  request = MockRequest()
@@ -193,9 +193,7 @@ class TestSessionsMtls:
193
193
  # If the request handler is not an AiohttpRequest, the library cannot configure
194
194
  # the connection to use mTLS, so _is_mtls must be False to reflect this unconfigured state.
195
195
  assert session._is_mtls is False
196
- mock_make_context.assert_called_once_with(
197
- b"fake_cert_data", b"fake_key_data"
198
- )
196
+ mock_make_context.assert_not_called()
199
197
  await session.close()
200
198
 
201
199
  @pytest.mark.asyncio
@@ -132,6 +132,35 @@ class TestAuthMetadataPlugin(object):
132
132
  "https://{}/".format(default_host)
133
133
  )
134
134
 
135
+ def test_suppress_metrics_header(self):
136
+ credentials = mock.create_autospec(service_account.Credentials)
137
+
138
+ # Mock credentials before_request that adds metric and authorization
139
+ def mock_before_request(request, method, url, headers):
140
+ headers["x-goog-api-client"] = "foo"
141
+ headers["authorization"] = "Bearer token"
142
+
143
+ credentials.before_request.side_effect = mock_before_request
144
+ request = mock.create_autospec(transport.Request)
145
+
146
+ # By default, suppress_metrics_header=False
147
+ plugin = google.auth.transport.grpc.AuthMetadataPlugin(credentials, request)
148
+ context = mock.create_autospec(grpc.AuthMetadataContext, instance=True)
149
+ context.method_name = "methodName"
150
+ context.service_url = "https://pubsub.googleapis.com/methodName"
151
+
152
+ headers = dict(plugin._get_authorization_headers(context))
153
+ assert "x-goog-api-client" in headers
154
+ assert headers["x-goog-api-client"] == "foo"
155
+
156
+ # With suppress_metrics_header=True
157
+ plugin_suppressed = google.auth.transport.grpc.AuthMetadataPlugin(
158
+ credentials, request, suppress_metrics_header=True
159
+ )
160
+ headers_suppressed = dict(plugin_suppressed._get_authorization_headers(context))
161
+ assert "x-goog-api-client" not in headers_suppressed
162
+ assert headers_suppressed["authorization"] == "Bearer token"
163
+
135
164
 
136
165
  @mock.patch(
137
166
  "google.auth.transport._mtls_helper.get_client_ssl_credentials", autospec=True
@@ -213,6 +213,7 @@ def make_response(status=http_client.OK, data=None):
213
213
 
214
214
  class TestAuthorizedSession(object):
215
215
  TEST_URL = "http://example.com/"
216
+ MTLS_TEST_URL = "https://example.mtls.googleapis.com/"
216
217
 
217
218
  def test_constructor(self):
218
219
  authed_session = google.auth.transport.requests.AuthorizedSession(
@@ -727,7 +728,7 @@ class TestAuthorizedSession(object):
727
728
  authed_session = google.auth.transport.requests.AuthorizedSession(
728
729
  credentials, refresh_timeout=60
729
730
  )
730
- authed_session.mount(self.TEST_URL, adapter)
731
+ authed_session.mount(self.MTLS_TEST_URL, adapter)
731
732
 
732
733
  old_cert = b"-----BEGIN CERTIFICATE-----\nMIIBdTCCARqgAwIBAgIJAOYVvu/axMxvMAoGCCqGSM49BAMCMCcxJTAjBgNVBAMM\nHEdvb2dsZSBFbmRwb2ludCBWZXJpZmljYXRpb24wHhcNMjUwNzMwMjMwNjA4WhcN\nMjYwNzMxMjMwNjA4WjAnMSUwIwYDVQQDDBxHb29nbGUgRW5kcG9pbnQgVmVyaWZp\nY2F0aW9uMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbtr18gkEtwPow2oqyZsU\n4KLwFaLFlRlYv55UATS3QTDykDnIufC42TJCnqFRYhwicwpE2jnUV+l9g3Voias8\nraMvMC0wCQYDVR0TBAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUH\nAwIwCgYIKoZIzj0EAwIDSQAwRgIhAKcjW6dmF1YCksXPgDPlPu/nSnOjb3qCcivz\n/Jxq2zoeAiEA7/aNxcEoCGS3hwMIXoaaD/vPcZOOopKSyqXCvxRooKQ=\n-----END CERTIFICATE-----\n"
733
734
 
@@ -745,7 +746,7 @@ class TestAuthorizedSession(object):
745
746
  "call_client_cert_callback",
746
747
  return_value=(new_cert, new_key),
747
748
  ) as mock_callback:
748
- result = authed_session.request("GET", self.TEST_URL)
749
+ result = authed_session.request("GET", self.MTLS_TEST_URL)
749
750
 
750
751
  # Asserts to verify the behavior.
751
752
  assert mock_callback.called
@@ -766,7 +767,7 @@ class TestAuthorizedSession(object):
766
767
  authed_session = google.auth.transport.requests.AuthorizedSession(
767
768
  credentials, refresh_timeout=60
768
769
  )
769
- authed_session.mount(self.TEST_URL, adapter)
770
+ authed_session.mount(self.MTLS_TEST_URL, adapter)
770
771
  authed_session._is_mtls = True
771
772
 
772
773
  old_cert = CERT_MOCK_VAL
@@ -784,7 +785,7 @@ class TestAuthorizedSession(object):
784
785
  "call_client_cert_callback",
785
786
  return_value=(new_cert, new_key),
786
787
  ):
787
- result = authed_session.request("GET", self.TEST_URL)
788
+ result = authed_session.request("GET", self.MTLS_TEST_URL)
788
789
 
789
790
  # Asserts to verify the behavior.
790
791
  assert credentials.refresh.call_count == 2
@@ -832,11 +833,11 @@ class TestAuthorizedSession(object):
832
833
  authed_session = google.auth.transport.requests.AuthorizedSession(
833
834
  credentials, refresh_timeout=60
834
835
  )
835
- authed_session.mount(self.TEST_URL, adapter)
836
+ authed_session.mount(self.MTLS_TEST_URL, adapter)
836
837
 
837
838
  authed_session._is_mtls = True
838
839
 
839
- result = authed_session.request("GET", self.TEST_URL)
840
+ result = authed_session.request("GET", self.MTLS_TEST_URL)
840
841
  assert result.status_code == final_response.status_code
841
842
 
842
843
  # Asserts to verify the behavior.
@@ -851,7 +852,7 @@ class TestAuthorizedSession(object):
851
852
  authed_session = google.auth.transport.requests.AuthorizedSession(
852
853
  credentials, refresh_timeout=60
853
854
  )
854
- authed_session.mount(self.TEST_URL, adapter)
855
+ authed_session.mount(self.MTLS_TEST_URL, adapter)
855
856
 
856
857
  old_cert = b"-----BEGIN CERTIFICATE-----\nMIIBdTCCARqgAwIBAgIJAOYVvu/axMxvMAoGCCqGSM49BAMCMCcxJTAjBgNVBAMM\nHEdvb2dsZSBFbmRwb2ludCBWZXJpZmljYXRpb24wHhcNMjUwNzMwMjMwNjA4WhcN\nMjYwNzMxMjMwNjA4WjAnMSUwIwYDVQQDDBxHb29nbGUgRW5kcG9pbnQgVmVyaWZp\nY2F0aW9uMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbtr18gkEtwPow2oqyZsU\n4KLwFaLFlRlYv55UATS3QTDykDnIufC42TJCnqFRYhwicwpE2jnUV+l9g3Voias8\nraMvMC0wCQYDVR0TBAIwADALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUH\nAwIwCgYIKoZIzj0EAwIDSQAwRgIhAKcjW6dmF1YCksXPgDPlPu/nSnOjb3qCcivz\n/Jxq2zoeAiEA7/aNxcEoCGS3hwMIXoaaD/vPcZOOopKSyqXCvxRooKQ=\n-----END CERTIFICATE-----\n"
857
858
 
@@ -873,7 +874,7 @@ class TestAuthorizedSession(object):
873
874
  side_effect=Exception("Failed to reconfigure"),
874
875
  ):
875
876
  with pytest.raises(exceptions.MutualTLSChannelError):
876
- authed_session.request("GET", self.TEST_URL)
877
+ authed_session.request("GET", self.MTLS_TEST_URL)
877
878
 
878
879
  # Assert to verify behavior
879
880
  credentials.refresh.assert_not_called()
@@ -885,7 +886,7 @@ class TestAuthorizedSession(object):
885
886
  authed_session = google.auth.transport.requests.AuthorizedSession(
886
887
  credentials, refresh_timeout=60
887
888
  )
888
- authed_session.mount(self.TEST_URL, adapter)
889
+ authed_session.mount(self.MTLS_TEST_URL, adapter)
889
890
  authed_session._is_mtls = True
890
891
  authed_session._cached_cert = b"cached_cert"
891
892
 
@@ -894,7 +895,7 @@ class TestAuthorizedSession(object):
894
895
  side_effect=Exception("check_params failed"),
895
896
  ) as mock_check_params:
896
897
  with pytest.raises(Exception, match="check_params failed"):
897
- authed_session.request("GET", self.TEST_URL)
898
+ authed_session.request("GET", self.MTLS_TEST_URL)
898
899
 
899
900
  mock_check_params.assert_called_once()
900
901
  credentials.refresh.assert_not_called()
@@ -920,7 +921,7 @@ class TestAuthorizedSession(object):
920
921
  authed_session = google.auth.transport.requests.AuthorizedSession(
921
922
  credentials, refresh_status_codes=custom_refresh_codes
922
923
  )
923
- authed_session.mount(self.TEST_URL, adapter)
924
+ authed_session.mount(self.MTLS_TEST_URL, adapter)
924
925
 
925
926
  # Enable mTLS to prove it is skipped despite being enabled
926
927
  authed_session._is_mtls = True
@@ -928,7 +929,7 @@ class TestAuthorizedSession(object):
928
929
  with mock.patch(
929
930
  "google.auth.transport.requests._mtls_helper", autospec=True
930
931
  ) as mock_helper:
931
- authed_session.request("GET", self.TEST_URL)
932
+ authed_session.request("GET", self.MTLS_TEST_URL)
932
933
 
933
934
  # Assert refresh happened (Outer Check was True)
934
935
  assert credentials.refresh.called
@@ -936,6 +937,36 @@ class TestAuthorizedSession(object):
936
937
  # Assert mTLS check logic was SKIPPED (Inner Check was False)
937
938
  assert not mock_helper.check_parameters_for_unauthorized_response.called
938
939
 
940
+ def test_cert_rotation_skipped_on_non_mtls_url(self):
941
+ """
942
+ Tests that mTLS cert rotation is skipped on a non-mTLS URL even if
943
+ mTLS is enabled and an UNAUTHORIZED (401) response is received.
944
+ """
945
+ credentials = mock.Mock(wraps=CredentialsStub())
946
+ # First request will 401, second request will succeed.
947
+ adapter = AdapterStub(
948
+ [
949
+ make_response(status=http_client.UNAUTHORIZED),
950
+ make_response(status=http_client.OK),
951
+ ]
952
+ )
953
+ authed_session = google.auth.transport.requests.AuthorizedSession(
954
+ credentials, refresh_timeout=60
955
+ )
956
+ authed_session.mount(self.TEST_URL, adapter)
957
+ authed_session._is_mtls = True
958
+
959
+ with mock.patch(
960
+ "google.auth.transport.requests._mtls_helper", autospec=True
961
+ ) as mock_helper:
962
+ authed_session.request("GET", self.TEST_URL)
963
+
964
+ # Assert refresh happened
965
+ assert credentials.refresh.called
966
+
967
+ # Assert mTLS check logic was SKIPPED
968
+ assert not mock_helper.check_parameters_for_unauthorized_response.called
969
+
939
970
  def test_configure_mtls_channel_subsequent_failure(self):
940
971
  # 1. Setup successful mTLS configuration
941
972
  mock_callback = mock.Mock()
File without changes
File without changes
File without changes