auth0 6.4.0 → 6.6.0

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 (302) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +3 -3
  3. data/.fern/replay.lock +10 -46
  4. data/.version +1 -1
  5. data/CHANGELOG.md +17 -0
  6. data/EXAMPLES.md +20 -0
  7. data/README.md +18 -0
  8. data/examples/ruby-api/Gemfile.lock +1 -1
  9. data/lib/auth0/attack_protection/brute_force_protection/types/update_brute_force_settings_request_content.rb +2 -0
  10. data/lib/auth0/auth_client.rb +27 -2
  11. data/lib/auth0/client.rb +20 -2
  12. data/lib/auth0/client_grants/client.rb +72 -0
  13. data/lib/auth0/client_grants/types/search_client_grants_request_parameters.rb +23 -0
  14. data/lib/auth0/client_profiles/client.rb +233 -0
  15. data/lib/auth0/client_profiles/types/create_client_profile_request_content.rb +17 -0
  16. data/lib/auth0/client_profiles/types/list_client_profiles_request_parameters.rb +13 -0
  17. data/lib/auth0/client_profiles/types/update_client_profile_request_content.rb +19 -0
  18. data/lib/auth0/clients/client.rb +84 -0
  19. data/lib/auth0/clients/types/create_client_request_content.rb +4 -0
  20. data/lib/auth0/clients/types/list_clients_request_parameters.rb +2 -0
  21. data/lib/auth0/clients/types/search_clients_request_parameters.rb +23 -0
  22. data/lib/auth0/clients/types/update_client_request_content.rb +6 -0
  23. data/lib/auth0/connections/keys/client.rb +5 -5
  24. data/lib/auth0/email_templates/client.rb +14 -2
  25. data/lib/auth0/experimentation/experiments/client.rb +2 -47
  26. data/lib/auth0/experimentation/experiments/types/create_experiment_request_content.rb +1 -1
  27. data/lib/auth0/experimentation/experiments/types/update_experiment_request_parameters.rb +2 -0
  28. data/lib/auth0/experimentation/feature_flags/client.rb +0 -45
  29. data/lib/auth0/experimentation/feature_flags/types/update_feature_flag_request_content.rb +2 -0
  30. data/lib/auth0/experimentation/segments/client.rb +4 -1
  31. data/lib/auth0/experimentation/segments/types/list_segments_request_parameters.rb +2 -0
  32. data/lib/auth0/experimentation/segments/types/update_segment_request_content.rb +2 -0
  33. data/lib/auth0/internal/http/rate_limit.rb +103 -0
  34. data/lib/auth0/internal/http/raw_client.rb +14 -2
  35. data/lib/auth0/internal/types/model.rb +15 -6
  36. data/lib/auth0/mixins/httpproxy.rb +9 -1
  37. data/lib/auth0/mixins/initializer.rb +5 -0
  38. data/lib/auth0/portals/client.rb +198 -0
  39. data/lib/auth0/portals/types/create_portal_request_content.rb +21 -0
  40. data/lib/auth0/portals/types/update_portal_request_content.rb +23 -0
  41. data/lib/auth0/resource_servers/types/create_resource_server_request_content.rb +4 -0
  42. data/lib/auth0/resource_servers/types/update_resource_server_request_content.rb +4 -0
  43. data/lib/auth0/roles/client.rb +2 -1
  44. data/lib/auth0/tenants/settings/types/update_tenant_settings_request_content.rb +4 -0
  45. data/lib/auth0/types/brute_force_protection_form_submission_mode_enum.rb +12 -0
  46. data/lib/auth0/types/cimd_external_metadata_created_by_enum.rb +12 -0
  47. data/lib/auth0/types/client.rb +8 -0
  48. data/lib/auth0/types/client_anonymous_session_transfer_network_binding_enum.rb +13 -0
  49. data/lib/auth0/types/client_external_metadata_status_enum.rb +12 -0
  50. data/lib/auth0/types/client_grant_sort_field_enum.rb +12 -0
  51. data/lib/auth0/types/client_oidc_support.rb +14 -0
  52. data/lib/auth0/types/client_oidc_support_patch.rb +14 -0
  53. data/lib/auth0/types/client_profile.rb +21 -0
  54. data/lib/auth0/types/client_profile_apply_policy.rb +12 -0
  55. data/lib/auth0/types/client_profile_apply_policy_external_metadata_created_by_enum.rb +11 -0
  56. data/lib/auth0/types/client_profile_apply_policy_external_metadata_type_enum.rb +11 -0
  57. data/lib/auth0/types/client_profile_client_configuration.rb +20 -0
  58. data/lib/auth0/types/client_profile_client_configuration_oidc_support.rb +10 -0
  59. data/lib/auth0/types/client_profile_client_configuration_oidc_support_allowed_scopes_enum.rb +14 -0
  60. data/lib/auth0/types/client_profile_client_configuration_oidc_support_default_value.rb +14 -0
  61. data/lib/auth0/types/client_profile_client_configuration_organization_discovery_method_enum.rb +12 -0
  62. data/lib/auth0/types/client_profile_client_configuration_organization_discovery_methods.rb +10 -0
  63. data/lib/auth0/types/client_profile_client_configuration_organization_require_behavior.rb +10 -0
  64. data/lib/auth0/types/client_profile_client_configuration_organization_require_behavior_enum.rb +13 -0
  65. data/lib/auth0/types/client_profile_client_configuration_organization_usage.rb +10 -0
  66. data/lib/auth0/types/client_profile_client_configuration_organization_usage_enum.rb +13 -0
  67. data/lib/auth0/types/client_profile_client_configuration_refresh_token.rb +14 -0
  68. data/lib/auth0/types/client_profile_client_configuration_require_proof_of_possession.rb +10 -0
  69. data/lib/auth0/types/client_profile_description.rb +23 -0
  70. data/lib/auth0/types/client_profile_id.rb +23 -0
  71. data/lib/auth0/types/client_profile_name.rb +23 -0
  72. data/lib/auth0/types/client_profile_refresh_token_idle_token_lifetime.rb +10 -0
  73. data/lib/auth0/types/client_profile_refresh_token_leeway.rb +10 -0
  74. data/lib/auth0/types/client_profile_refresh_token_token_lifetime.rb +10 -0
  75. data/lib/auth0/types/client_search_response.rb +143 -0
  76. data/lib/auth0/types/client_sort_field_enum.rb +12 -0
  77. data/lib/auth0/types/connection_client_id_samlxaa_requesting_app.rb +23 -0
  78. data/lib/auth0/types/connection_client_secret_samlxaa_requesting_app.rb +23 -0
  79. data/lib/auth0/types/connection_options_auth0.rb +2 -0
  80. data/lib/auth0/types/connection_options_saml.rb +10 -0
  81. data/lib/auth0/types/connection_otp_channel_settings.rb +12 -0
  82. data/lib/auth0/types/connection_otp_settings.rb +12 -0
  83. data/lib/auth0/types/connection_profile_provisioning.rb +2 -0
  84. data/lib/auth0/types/connection_profile_provisioning_google_workspace.rb +10 -0
  85. data/lib/auth0/types/connection_profile_provisioning_google_workspace_sync_users.rb +23 -0
  86. data/lib/auth0/types/connection_profile_strategy_overrides_provisioning.rb +2 -0
  87. data/lib/auth0/types/connection_properties_options.rb +2 -0
  88. data/lib/auth0/types/connection_response_common.rb +6 -6
  89. data/lib/auth0/types/connection_response_content_ad.rb +2 -2
  90. data/lib/auth0/types/connection_response_content_adfs.rb +2 -2
  91. data/lib/auth0/types/connection_response_content_amazon.rb +2 -2
  92. data/lib/auth0/types/connection_response_content_apple.rb +2 -2
  93. data/lib/auth0/types/connection_response_content_auth0.rb +2 -2
  94. data/lib/auth0/types/connection_response_content_auth0oidc.rb +2 -2
  95. data/lib/auth0/types/connection_response_content_azure_ad.rb +2 -2
  96. data/lib/auth0/types/connection_response_content_baidu.rb +2 -2
  97. data/lib/auth0/types/connection_response_content_bitbucket.rb +2 -2
  98. data/lib/auth0/types/connection_response_content_bitly.rb +2 -2
  99. data/lib/auth0/types/connection_response_content_box.rb +2 -2
  100. data/lib/auth0/types/connection_response_content_custom.rb +2 -2
  101. data/lib/auth0/types/connection_response_content_daccount.rb +2 -2
  102. data/lib/auth0/types/connection_response_content_dropbox.rb +2 -2
  103. data/lib/auth0/types/connection_response_content_dwolla.rb +2 -2
  104. data/lib/auth0/types/connection_response_content_email.rb +2 -2
  105. data/lib/auth0/types/connection_response_content_evernote.rb +2 -2
  106. data/lib/auth0/types/connection_response_content_evernote_sandbox.rb +2 -2
  107. data/lib/auth0/types/connection_response_content_exact.rb +2 -2
  108. data/lib/auth0/types/connection_response_content_facebook.rb +2 -2
  109. data/lib/auth0/types/connection_response_content_fitbit.rb +2 -2
  110. data/lib/auth0/types/connection_response_content_git_hub.rb +2 -2
  111. data/lib/auth0/types/connection_response_content_google_apps.rb +2 -2
  112. data/lib/auth0/types/connection_response_content_google_o_auth2.rb +2 -2
  113. data/lib/auth0/types/connection_response_content_instagram.rb +2 -2
  114. data/lib/auth0/types/connection_response_content_ip.rb +2 -2
  115. data/lib/auth0/types/connection_response_content_line.rb +2 -2
  116. data/lib/auth0/types/connection_response_content_linkedin.rb +2 -2
  117. data/lib/auth0/types/connection_response_content_o_auth1.rb +2 -2
  118. data/lib/auth0/types/connection_response_content_o_auth2.rb +2 -2
  119. data/lib/auth0/types/connection_response_content_office365.rb +2 -2
  120. data/lib/auth0/types/connection_response_content_oidc.rb +2 -2
  121. data/lib/auth0/types/connection_response_content_okta.rb +2 -2
  122. data/lib/auth0/types/connection_response_content_paypal.rb +2 -2
  123. data/lib/auth0/types/connection_response_content_paypal_sandbox.rb +2 -2
  124. data/lib/auth0/types/connection_response_content_ping_federate.rb +2 -2
  125. data/lib/auth0/types/connection_response_content_planning_center.rb +2 -2
  126. data/lib/auth0/types/connection_response_content_salesforce.rb +2 -2
  127. data/lib/auth0/types/connection_response_content_salesforce_community.rb +2 -2
  128. data/lib/auth0/types/connection_response_content_salesforce_sandbox.rb +2 -2
  129. data/lib/auth0/types/connection_response_content_saml.rb +4 -2
  130. data/lib/auth0/types/connection_response_content_sharepoint.rb +2 -2
  131. data/lib/auth0/types/connection_response_content_shop.rb +2 -2
  132. data/lib/auth0/types/connection_response_content_shopify.rb +2 -2
  133. data/lib/auth0/types/connection_response_content_sms.rb +2 -2
  134. data/lib/auth0/types/connection_response_content_soundcloud.rb +2 -2
  135. data/lib/auth0/types/connection_response_content_thirty_seven_signals.rb +2 -2
  136. data/lib/auth0/types/connection_response_content_twitter.rb +2 -2
  137. data/lib/auth0/types/connection_response_content_untappd.rb +2 -2
  138. data/lib/auth0/types/connection_response_content_vkontakte.rb +2 -2
  139. data/lib/auth0/types/connection_response_content_weibo.rb +2 -2
  140. data/lib/auth0/types/connection_response_content_windows_live.rb +2 -2
  141. data/lib/auth0/types/connection_response_content_wordpress.rb +2 -2
  142. data/lib/auth0/types/connection_response_content_yahoo.rb +2 -2
  143. data/lib/auth0/types/connection_response_content_yandex.rb +2 -2
  144. data/lib/auth0/types/consent_signing_key.rb +15 -0
  145. data/lib/auth0/types/create_client_response_content.rb +8 -0
  146. data/lib/auth0/types/create_connection_request_content_saml.rb +2 -0
  147. data/lib/auth0/types/create_resource_server_response_content.rb +4 -0
  148. data/lib/auth0/types/create_segment_response_content.rb +2 -0
  149. data/lib/auth0/types/enabled_features_enum.rb +1 -0
  150. data/lib/auth0/types/event_stream_cloud_event_connection_created_cloud_event.rb +1 -1
  151. data/lib/auth0/types/event_stream_cloud_event_connection_deleted_cloud_event.rb +1 -1
  152. data/lib/auth0/types/event_stream_cloud_event_connection_updated_cloud_event.rb +1 -1
  153. data/lib/auth0/types/event_stream_cloud_event_context.rb +2 -0
  154. data/lib/auth0/types/event_stream_cloud_event_context_transaction.rb +30 -0
  155. data/lib/auth0/types/event_stream_cloud_event_context_transaction_protocol_enum.rb +24 -0
  156. data/lib/auth0/types/event_stream_cloud_event_context_transaction_response_mode_enum.rb +14 -0
  157. data/lib/auth0/types/event_stream_cloud_event_context_transaction_response_type_item_enum.rb +13 -0
  158. data/lib/auth0/types/event_stream_cloud_event_group_created_cloud_event.rb +1 -1
  159. data/lib/auth0/types/event_stream_cloud_event_group_deleted_cloud_event.rb +1 -1
  160. data/lib/auth0/types/event_stream_cloud_event_group_member_added_cloud_event.rb +1 -1
  161. data/lib/auth0/types/event_stream_cloud_event_group_member_deleted_cloud_event.rb +1 -1
  162. data/lib/auth0/types/event_stream_cloud_event_group_role_assigned_cloud_event.rb +1 -1
  163. data/lib/auth0/types/event_stream_cloud_event_group_role_deleted_cloud_event.rb +1 -1
  164. data/lib/auth0/types/event_stream_cloud_event_group_updated_cloud_event.rb +1 -1
  165. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_cloud_event.rb +1 -1
  166. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_object.rb +2 -0
  167. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_object_organization_member_access_level.rb +18 -0
  168. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_object_organization_member_access_level0enum.rb +11 -0
  169. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_object_organization_member_access_level1enum.rb +11 -0
  170. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_object_organization_member_access_level2enum.rb +11 -0
  171. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_object_organization_member_access_level3enum.rb +11 -0
  172. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_previous_object.rb +2 -0
  173. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_previous_object_organization_member_access_l_1dbe67.rb +11 -0
  174. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_previous_object_organization_member_access_l_4de563.rb +11 -0
  175. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_previous_object_organization_member_access_l_7087fd.rb +11 -0
  176. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_previous_object_organization_member_access_l_a4ce06.rb +11 -0
  177. data/lib/auth0/types/event_stream_cloud_event_org_connection_added_previous_object_organization_member_access_level.rb +18 -0
  178. data/lib/auth0/types/event_stream_cloud_event_org_connection_removed_cloud_event.rb +1 -1
  179. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_cloud_event.rb +1 -1
  180. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_object.rb +2 -0
  181. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_object_organization_member_access_level.rb +18 -0
  182. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_object_organization_member_access_level0enum.rb +11 -0
  183. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_object_organization_member_access_level1enum.rb +11 -0
  184. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_object_organization_member_access_level2enum.rb +11 -0
  185. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_object_organization_member_access_level3enum.rb +11 -0
  186. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_previous_object.rb +2 -0
  187. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_previous_object_organization_member_access_3669df.rb +11 -0
  188. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_previous_object_organization_member_access_55f897.rb +11 -0
  189. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_previous_object_organization_member_access_66926d.rb +11 -0
  190. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_previous_object_organization_member_access_88dadc.rb +11 -0
  191. data/lib/auth0/types/event_stream_cloud_event_org_connection_updated_previous_object_organization_member_access_level.rb +18 -0
  192. data/lib/auth0/types/event_stream_cloud_event_org_created_cloud_event.rb +1 -1
  193. data/lib/auth0/types/event_stream_cloud_event_org_deleted_cloud_event.rb +1 -1
  194. data/lib/auth0/types/event_stream_cloud_event_org_group_role_assigned_cloud_event.rb +1 -1
  195. data/lib/auth0/types/event_stream_cloud_event_org_group_role_deleted_cloud_event.rb +1 -1
  196. data/lib/auth0/types/event_stream_cloud_event_org_member_added_cloud_event.rb +1 -1
  197. data/lib/auth0/types/event_stream_cloud_event_org_member_deleted_cloud_event.rb +1 -1
  198. data/lib/auth0/types/event_stream_cloud_event_org_member_role_assigned_cloud_event.rb +1 -1
  199. data/lib/auth0/types/event_stream_cloud_event_org_member_role_deleted_cloud_event.rb +1 -1
  200. data/lib/auth0/types/event_stream_cloud_event_org_updated_cloud_event.rb +1 -1
  201. data/lib/auth0/types/event_stream_cloud_event_user_created_cloud_event.rb +1 -1
  202. data/lib/auth0/types/event_stream_cloud_event_user_deleted_cloud_event.rb +1 -1
  203. data/lib/auth0/types/event_stream_cloud_event_user_updated_cloud_event.rb +1 -1
  204. data/lib/auth0/types/get_brute_force_settings_response_content.rb +2 -0
  205. data/lib/auth0/types/get_client_response_content.rb +8 -0
  206. data/lib/auth0/types/get_resource_server_response_content.rb +4 -0
  207. data/lib/auth0/types/get_segment_response_content.rb +2 -0
  208. data/lib/auth0/types/get_tenant_settings_response_content.rb +4 -0
  209. data/lib/auth0/types/guardian_factor_name_enum.rb +1 -0
  210. data/lib/auth0/types/internal_server_error_body.rb +13 -0
  211. data/lib/auth0/types/internal_server_error_body_error.rb +11 -0
  212. data/lib/auth0/types/list_client_profiles_paginated_response_content.rb +12 -0
  213. data/lib/auth0/types/list_portals_response_content.rb +9 -0
  214. data/lib/auth0/types/list_user_consent_signing_keys_response_content.rb +9 -0
  215. data/lib/auth0/types/oauth_scope.rb +8 -0
  216. data/lib/auth0/types/page_component.rb +33 -0
  217. data/lib/auth0/types/page_component_auth0form.rb +9 -0
  218. data/lib/auth0/types/page_component_auth0form_config.rb +11 -0
  219. data/lib/auth0/types/page_component_auth0media_image.rb +9 -0
  220. data/lib/auth0/types/page_component_auth0media_image_config.rb +13 -0
  221. data/lib/auth0/types/page_component_auth0my_account_mfa_management.rb +9 -0
  222. data/lib/auth0/types/page_component_auth0my_account_mfa_management_config.rb +7 -0
  223. data/lib/auth0/types/page_component_auth0my_account_passkey_management.rb +9 -0
  224. data/lib/auth0/types/page_component_auth0my_account_passkey_management_config.rb +7 -0
  225. data/lib/auth0/types/page_component_auth0my_organization_details_edit.rb +9 -0
  226. data/lib/auth0/types/page_component_auth0my_organization_details_edit_config.rb +7 -0
  227. data/lib/auth0/types/page_component_auth0my_organization_domain_table.rb +9 -0
  228. data/lib/auth0/types/page_component_auth0my_organization_domain_table_config.rb +7 -0
  229. data/lib/auth0/types/page_component_auth0my_organization_member_management.rb +9 -0
  230. data/lib/auth0/types/page_component_auth0my_organization_member_management_config.rb +7 -0
  231. data/lib/auth0/types/page_component_auth0structure_section.rb +9 -0
  232. data/lib/auth0/types/page_component_auth0structure_section_config.rb +15 -0
  233. data/lib/auth0/types/page_component_auth0structure_section_variant_enum.rb +12 -0
  234. data/lib/auth0/types/page_component_auth0structure_separator.rb +9 -0
  235. data/lib/auth0/types/page_component_auth0structure_separator_config.rb +11 -0
  236. data/lib/auth0/types/page_component_auth0structure_separator_variant_enum.rb +13 -0
  237. data/lib/auth0/types/page_component_auth0typography_heading.rb +9 -0
  238. data/lib/auth0/types/page_component_auth0typography_heading_config.rb +11 -0
  239. data/lib/auth0/types/page_component_auth0typography_rich_text.rb +9 -0
  240. data/lib/auth0/types/page_component_auth0typography_rich_text_config.rb +9 -0
  241. data/lib/auth0/types/page_component_no_children.rb +31 -0
  242. data/lib/auth0/types/page_slug.rb +23 -0
  243. data/lib/auth0/types/portal.rb +25 -0
  244. data/lib/auth0/types/portal_client_secret_post.rb +11 -0
  245. data/lib/auth0/types/portal_client_secret_post_request.rb +13 -0
  246. data/lib/auth0/types/portal_client_secret_post_request_token_endpoint_auth_method.rb +11 -0
  247. data/lib/auth0/types/portal_client_secret_post_token_endpoint_auth_method.rb +11 -0
  248. data/lib/auth0/types/portal_custom_code.rb +9 -0
  249. data/lib/auth0/types/portal_custom_code_nullable.rb +23 -0
  250. data/lib/auth0/types/portal_date_time.rb +23 -0
  251. data/lib/auth0/types/portal_id.rb +23 -0
  252. data/lib/auth0/types/portal_name.rb +23 -0
  253. data/lib/auth0/types/portal_navigation.rb +9 -0
  254. data/lib/auth0/types/portal_navigation_nullable.rb +23 -0
  255. data/lib/auth0/types/portal_page.rb +13 -0
  256. data/lib/auth0/types/portal_pages_by_type.rb +11 -0
  257. data/lib/auth0/types/portal_pages_by_type_nullable.rb +23 -0
  258. data/lib/auth0/types/portal_slug.rb +23 -0
  259. data/lib/auth0/types/portal_summary.rb +17 -0
  260. data/lib/auth0/types/position.rb +13 -0
  261. data/lib/auth0/types/preview_cimd_metadata_response_content.rb +2 -0
  262. data/lib/auth0/types/resource_server.rb +4 -0
  263. data/lib/auth0/types/resource_server_agent_subject_claims_response_enum.rb +12 -0
  264. data/lib/auth0/types/resource_server_agent_subject_claims_schema_enum.rb +12 -0
  265. data/lib/auth0/types/resource_server_search_response.rb +4 -0
  266. data/lib/auth0/types/resource_server_type_enum.rb +11 -0
  267. data/lib/auth0/types/role_owner_id.rb +23 -0
  268. data/lib/auth0/types/role_owner_id_filter.rb +23 -0
  269. data/lib/auth0/types/rotate_client_secret_response_content.rb +8 -0
  270. data/lib/auth0/types/search_client_grants_response_content.rb +11 -0
  271. data/lib/auth0/types/search_clients_response_content.rb +11 -0
  272. data/lib/auth0/types/search_organization.rb +0 -2
  273. data/lib/auth0/types/segment.rb +2 -0
  274. data/lib/auth0/types/segment_status_enum.rb +12 -0
  275. data/lib/auth0/types/sidebar.rb +9 -0
  276. data/lib/auth0/types/sidebar_component.rb +19 -0
  277. data/lib/auth0/types/sidebar_component_auth0external_link.rb +10 -0
  278. data/lib/auth0/types/sidebar_component_auth0external_link_config.rb +13 -0
  279. data/lib/auth0/types/sidebar_component_auth0external_link_v2.rb +9 -0
  280. data/lib/auth0/types/sidebar_component_auth0external_link_v2config.rb +13 -0
  281. data/lib/auth0/types/sidebar_component_auth0internal_link.rb +10 -0
  282. data/lib/auth0/types/sidebar_component_auth0internal_link_config.rb +13 -0
  283. data/lib/auth0/types/sidebar_component_auth0internal_link_v2.rb +9 -0
  284. data/lib/auth0/types/sidebar_component_auth0internal_link_v2config.rb +13 -0
  285. data/lib/auth0/types/system_role_owner_id.rb +11 -0
  286. data/lib/auth0/types/update_brute_force_settings_response_content.rb +2 -0
  287. data/lib/auth0/types/update_client_response_content.rb +8 -0
  288. data/lib/auth0/types/update_connection_options.rb +2 -0
  289. data/lib/auth0/types/update_connection_request_content_saml.rb +2 -0
  290. data/lib/auth0/types/update_resource_server_response_content.rb +4 -0
  291. data/lib/auth0/types/update_segment_response_content.rb +2 -0
  292. data/lib/auth0/types/update_tenant_settings_response_content.rb +4 -0
  293. data/lib/auth0/types/update_variation_overrides_map.rb +1 -1
  294. data/lib/auth0/users/client.rb +120 -0
  295. data/lib/auth0/version.rb +1 -1
  296. data/lib/auth0.rb +142 -6
  297. data/wiremock/wiremock-mappings.json +666 -158
  298. metadata +143 -6
  299. data/lib/auth0/experimentation/experiments/types/update_experiment_status_request_content.rb +0 -15
  300. data/lib/auth0/experimentation/feature_flags/types/update_feature_flag_status_request_content.rb +0 -15
  301. data/lib/auth0/types/update_experiment_status_response_content.rb +0 -45
  302. data/lib/auth0/types/update_feature_flag_status_response_content.rb +0 -23
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Auth0
4
+ module ClientProfiles
5
+ module Types
6
+ class UpdateClientProfileRequestContent < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :name, -> { String }, optional: true, nullable: false
10
+
11
+ field :description, -> { String }, optional: true, nullable: false
12
+
13
+ field :client_configuration, -> { Auth0::Types::ClientProfileClientConfiguration }, optional: true, nullable: false
14
+
15
+ field :apply_policy, -> { Auth0::Types::ClientProfileApplyPolicy }, optional: true, nullable: false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -54,6 +54,7 @@ module Auth0
54
54
  # @option params [Boolean, nil] :is_first_party
55
55
  # @option params [String, nil] :app_type
56
56
  # @option params [String, nil] :external_client_id
57
+ # @option params [String, nil] :agent_id
57
58
  # @option params [String, nil] :q
58
59
  #
59
60
  # @example
@@ -67,6 +68,7 @@ module Auth0
67
68
  # is_first_party: true,
68
69
  # app_type: "app_type",
69
70
  # external_client_id: "external_client_id",
71
+ # agent_id: "agent_id",
70
72
  # q: "q"
71
73
  # )
72
74
  #
@@ -83,6 +85,7 @@ module Auth0
83
85
  query_params["is_first_party"] = params[:is_first_party] if params.key?(:is_first_party)
84
86
  query_params["app_type"] = params[:app_type] if params.key?(:app_type)
85
87
  query_params["external_client_id"] = params[:external_client_id] if params.key?(:external_client_id)
88
+ query_params["agent_id"] = params[:agent_id] if params.key?(:agent_id)
86
89
  query_params["q"] = params[:q] if params.key?(:q)
87
90
 
88
91
  Auth0::Internal::OffsetItemIterator.new(
@@ -257,6 +260,87 @@ module Auth0
257
260
  end
258
261
  end
259
262
 
263
+ # Search clients using SCIM or Lucene filter syntax with low-latency, eventually consistent results.
264
+ # Use the parser parameter to specify "scim" or "lucene" syntax (default: "lucene").
265
+ # This endpoint provides an alternative to the standard GET /clients endpoint with better performance
266
+ # for complex queries. Results may not reflect recent updates immediately.
267
+ #
268
+ # - This endpoint only supports `read:clients` and `read:client_summary` scopes. The `read:client_keys` and
269
+ # `read:client_credentials` scopes are not supported.
270
+ # - The following fields are never returned by this endpoint:
271
+ # - `client_secret`
272
+ # - `encryption_key`
273
+ # - `signing_keys`
274
+ # - `owners`
275
+ # - `addons`
276
+ #
277
+ # @param request_options [Hash]
278
+ # @param params [Hash]
279
+ # @option request_options [String] :base_url
280
+ # @option request_options [Hash{String => Object}] :additional_headers
281
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
282
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
283
+ # @option request_options [Integer] :timeout_in_seconds
284
+ # @option params [String, nil] :q
285
+ # @option params [Auth0::Types::SearchParserEnum, nil] :parser
286
+ # @option params [String, nil] :fields
287
+ # @option params [Boolean, nil] :include_fields
288
+ # @option params [Integer, nil] :take
289
+ # @option params [String, nil] :from
290
+ # @option params [Auth0::Types::ClientSortFieldEnum, nil] :sort
291
+ #
292
+ # @example
293
+ # client.clients.search(
294
+ # q: "q",
295
+ # parser: "scim",
296
+ # fields: "fields",
297
+ # include_fields: true,
298
+ # take: 1,
299
+ # from: "from",
300
+ # sort: "name"
301
+ # )
302
+ #
303
+ # @return [Auth0::Types::SearchClientsResponseContent]
304
+ def search(request_options: {}, **params)
305
+ params = Auth0::Internal::Types::Utils.normalize_keys(params)
306
+ query_params = {}
307
+ query_params["q"] = params[:q] if params.key?(:q)
308
+ query_params["parser"] = params[:parser] if params.key?(:parser)
309
+ query_params["fields"] = params[:fields] if params.key?(:fields)
310
+ query_params["include_fields"] = params[:include_fields] if params.key?(:include_fields)
311
+ query_params["take"] = params.fetch(:take, 50)
312
+ query_params["from"] = params[:from] if params.key?(:from)
313
+ query_params["sort"] = params[:sort] if params.key?(:sort)
314
+
315
+ Auth0::Internal::CursorItemIterator.new(
316
+ cursor_field: :next_,
317
+ item_field: :clients,
318
+ initial_cursor: query_params["from"]
319
+ ) do |next_cursor|
320
+ query_params["from"] = next_cursor
321
+ request = Auth0::Internal::JSON::Request.new(
322
+ base_url: request_options[:base_url],
323
+ method: "GET",
324
+ path: "clients/search",
325
+ query: query_params,
326
+ request_options: request_options
327
+ )
328
+ begin
329
+ response = @client.send(request)
330
+ rescue Net::HTTPRequestTimeout
331
+ raise Auth0::Errors::TimeoutError
332
+ end
333
+ code = response.code.to_i
334
+ if code.between?(200, 299)
335
+ parsed_response = (response.body.to_s.empty? ? nil : Auth0::Types::SearchClientsResponseContent.load(response.body))
336
+ [parsed_response, response]
337
+ else
338
+ error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
339
+ raise error_class.new(response.body, code: code)
340
+ end
341
+ end
342
+ end
343
+
260
344
  # Retrieve client details by ID. Clients are SSO connections or Applications linked with your Auth0 tenant. A list
261
345
  # of fields to include or exclude may also be specified.
262
346
  # For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and
@@ -108,6 +108,8 @@ module Auth0
108
108
 
109
109
  field :anonymous_sessions, -> { Auth0::Types::CreateAnonymousSessions }, optional: true, nullable: false
110
110
 
111
+ field :enforce_anon_session_transfer_network_binding, -> { Auth0::Types::ClientAnonymousSessionTransferNetworkBindingEnum }, optional: true, nullable: false
112
+
111
113
  field :third_party_security_mode, -> { Auth0::Types::ClientThirdPartySecurityModeEnum }, optional: true, nullable: false
112
114
 
113
115
  field :redirection_policy, -> { Auth0::Types::ClientRedirectionPolicyEnum }, optional: true, nullable: false
@@ -120,6 +122,8 @@ module Auth0
120
122
 
121
123
  field :async_approval_notification_channels, -> { Internal::Types::Array[Auth0::Types::AsyncApprovalNotificationsChannelsEnum] }, optional: true, nullable: false
122
124
 
125
+ field :agent_id, -> { String }, optional: true, nullable: false
126
+
123
127
  field :oidc_support, -> { Auth0::Types::ClientOidcSupportPost }, optional: true, nullable: false
124
128
  end
125
129
  end
@@ -22,6 +22,8 @@ module Auth0
22
22
 
23
23
  field :external_client_id, -> { String }, optional: true, nullable: false
24
24
 
25
+ field :agent_id, -> { String }, optional: true, nullable: false
26
+
25
27
  field :q, -> { String }, optional: true, nullable: false
26
28
  end
27
29
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Auth0
4
+ module Clients
5
+ module Types
6
+ class SearchClientsRequestParameters < Internal::Types::Model
7
+ field :q, -> { String }, optional: true, nullable: false
8
+
9
+ field :parser, -> { Auth0::Types::SearchParserEnum }, optional: true, nullable: false
10
+
11
+ field :fields, -> { String }, optional: true, nullable: false
12
+
13
+ field :include_fields, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+
15
+ field :take, -> { Integer }, optional: true, nullable: false
16
+
17
+ field :from, -> { String }, optional: true, nullable: false
18
+
19
+ field :sort, -> { Auth0::Types::ClientSortFieldEnum }, optional: true, nullable: false
20
+ end
21
+ end
22
+ end
23
+ end
@@ -68,6 +68,8 @@ module Auth0
68
68
 
69
69
  field :anonymous_sessions, -> { Auth0::Types::UpdateAnonymousSessions }, optional: true, nullable: false
70
70
 
71
+ field :enforce_anon_session_transfer_network_binding, -> { Auth0::Types::ClientAnonymousSessionTransferNetworkBindingEnum }, optional: true, nullable: false
72
+
71
73
  field :form_template, -> { String }, optional: true, nullable: false
72
74
 
73
75
  field :addons, -> { Auth0::Types::ClientAddons }, optional: true, nullable: false
@@ -121,6 +123,10 @@ module Auth0
121
123
  field :third_party_security_mode, -> { Auth0::Types::ClientThirdPartySecurityModeEnum }, optional: true, nullable: false
122
124
 
123
125
  field :redirection_policy, -> { Auth0::Types::ClientRedirectionPolicyEnum }, optional: true, nullable: false
126
+
127
+ field :agent_id, -> { String }, optional: true, nullable: false
128
+
129
+ field :oidc_support, -> { Auth0::Types::ClientOidcSupportPatch }, optional: true, nullable: false
124
130
  end
125
131
  end
126
132
  end
@@ -11,7 +11,7 @@ module Auth0
11
11
  @client = client
12
12
  end
13
13
 
14
- # Gets the connection keys for the Okta or OIDC connection strategy.
14
+ # Gets the connection keys for the Okta, OIDC, or SAML (samlp) connection strategy.
15
15
  #
16
16
  # @param request_options [Hash]
17
17
  # @param params [Hash]
@@ -48,9 +48,9 @@ module Auth0
48
48
  end
49
49
  end
50
50
 
51
- # Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create
52
- # keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime
53
- # transitions.
51
+ # Provision initial connection keys for Okta, OIDC, or SAML (samlp) connection strategies. This endpoint allows
52
+ # you to create keys before configuring the connection to use Private Key JWT authentication, enabling
53
+ # zero-downtime transitions.
54
54
  #
55
55
  # @param request_options [Hash]
56
56
  # @param params [Hash]
@@ -94,7 +94,7 @@ module Auth0
94
94
  end
95
95
  end
96
96
 
97
- # Rotates the connection keys for the Okta or OIDC connection strategies.
97
+ # Rotates the connection keys for the Okta, OIDC, or SAML (samlp) connection strategies.
98
98
  #
99
99
  # @param request_options [Hash]
100
100
  # @param params [Hash]
@@ -21,7 +21,14 @@ module Auth0
21
21
  # @option request_options [Integer] :timeout_in_seconds
22
22
  #
23
23
  # @example
24
- # client.email_templates.create(template: "verify_email")
24
+ # client.email_templates.create(
25
+ # template: "verify_email",
26
+ # body: nil,
27
+ # from: nil,
28
+ # subject: nil,
29
+ # syntax: nil,
30
+ # enabled: nil
31
+ # )
25
32
  #
26
33
  # @return [Auth0::Types::CreateEmailTemplateResponseContent]
27
34
  def create(request_options: {}, **params)
@@ -101,7 +108,12 @@ module Auth0
101
108
  # @example
102
109
  # client.email_templates.set(
103
110
  # template_name: "verify_email",
104
- # template: "verify_email"
111
+ # template: "verify_email",
112
+ # body: nil,
113
+ # from: nil,
114
+ # subject: nil,
115
+ # syntax: nil,
116
+ # enabled: nil
105
117
  # )
106
118
  #
107
119
  # @return [Auth0::Types::SetEmailTemplateResponseContent]
@@ -88,7 +88,8 @@ module Auth0
88
88
  # client.experimentation.experiments.create(
89
89
  # name: "name",
90
90
  # feature_flag_id: "feature_flag_id",
91
- # authentication_flow: "authentication"
91
+ # authentication_flow: "authentication",
92
+ # allocation_strategy: "percentage"
92
93
  # )
93
94
  #
94
95
  # @return [Auth0::Types::CreateExperimentResponseContent]
@@ -278,52 +279,6 @@ module Auth0
278
279
  end
279
280
  end
280
281
 
281
- # Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active,
282
- # active/paused → completed. Activation runs full readiness validation.
283
- #
284
- # @param request_options [Hash]
285
- # @param params [Auth0::Experimentation::Experiments::Types::UpdateExperimentStatusRequestContent]
286
- # @option request_options [String] :base_url
287
- # @option request_options [Hash{String => Object}] :additional_headers
288
- # @option request_options [Hash{String => Object}] :additional_query_parameters
289
- # @option request_options [Hash{String => Object}] :additional_body_parameters
290
- # @option request_options [Integer] :timeout_in_seconds
291
- # @option params [String] :id
292
- #
293
- # @example
294
- # client.experimentation.experiments.update_status(
295
- # id: "id",
296
- # status: "active"
297
- # )
298
- #
299
- # @return [Auth0::Types::UpdateExperimentStatusResponseContent]
300
- def update_status(request_options: {}, **params)
301
- params = Auth0::Internal::Types::Utils.normalize_keys(params)
302
- request_data = Auth0::Experimentation::Experiments::Types::UpdateExperimentStatusRequestContent.new(params).to_h
303
- non_body_param_names = %w[id]
304
- body = request_data.except(*non_body_param_names)
305
-
306
- request = Auth0::Internal::JSON::Request.new(
307
- base_url: request_options[:base_url],
308
- method: "POST",
309
- path: "experimentation/experiments/#{URI.encode_uri_component(params[:id].to_s)}/status",
310
- body: body,
311
- request_options: request_options
312
- )
313
- begin
314
- response = @client.send(request)
315
- rescue Net::HTTPRequestTimeout
316
- raise Auth0::Errors::TimeoutError
317
- end
318
- code = response.code.to_i
319
- if code.between?(200, 299)
320
- (response.body.to_s.empty? ? nil : Auth0::Types::UpdateExperimentStatusResponseContent.load(response.body))
321
- else
322
- error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
323
- raise error_class.new(response.body, code: code)
324
- end
325
- end
326
-
327
282
  # Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing
328
283
  # any blockers. Read-only; no state is modified.
329
284
  #
@@ -15,7 +15,7 @@ module Auth0
15
15
 
16
16
  field :default_config, -> { Auth0::Types::DefaultConfigEnum }, optional: true, nullable: false
17
17
 
18
- field :allocation_strategy, -> { Auth0::Types::AllocationStrategyEnum }, optional: true, nullable: false
18
+ field :allocation_strategy, -> { Auth0::Types::AllocationStrategyEnum }, optional: false, nullable: false
19
19
 
20
20
  field :allocations, -> { Internal::Types::Array[Auth0::Types::AllocationRequestItem] }, optional: true, nullable: false
21
21
 
@@ -18,6 +18,8 @@ module Auth0
18
18
  field :default_config, -> { Auth0::Types::DefaultConfigEnum }, optional: true, nullable: false
19
19
 
20
20
  field :levels, -> { Internal::Types::Array[Integer] }, optional: true, nullable: false
21
+
22
+ field :status, -> { Auth0::Types::ExperimentTransitionStatusEnum }, optional: true, nullable: false
21
23
  end
22
24
  end
23
25
  end
@@ -225,51 +225,6 @@ module Auth0
225
225
  end
226
226
  end
227
227
 
228
- # Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived.
229
- #
230
- # @param request_options [Hash]
231
- # @param params [Auth0::Experimentation::FeatureFlags::Types::UpdateFeatureFlagStatusRequestContent]
232
- # @option request_options [String] :base_url
233
- # @option request_options [Hash{String => Object}] :additional_headers
234
- # @option request_options [Hash{String => Object}] :additional_query_parameters
235
- # @option request_options [Hash{String => Object}] :additional_body_parameters
236
- # @option request_options [Integer] :timeout_in_seconds
237
- # @option params [String] :id
238
- #
239
- # @example
240
- # client.experimentation.feature_flags.update_status(
241
- # id: "id",
242
- # status: "draft"
243
- # )
244
- #
245
- # @return [Auth0::Types::UpdateFeatureFlagStatusResponseContent]
246
- def update_status(request_options: {}, **params)
247
- params = Auth0::Internal::Types::Utils.normalize_keys(params)
248
- request_data = Auth0::Experimentation::FeatureFlags::Types::UpdateFeatureFlagStatusRequestContent.new(params).to_h
249
- non_body_param_names = %w[id]
250
- body = request_data.except(*non_body_param_names)
251
-
252
- request = Auth0::Internal::JSON::Request.new(
253
- base_url: request_options[:base_url],
254
- method: "POST",
255
- path: "experimentation/feature-flags/#{URI.encode_uri_component(params[:id].to_s)}/status",
256
- body: body,
257
- request_options: request_options
258
- )
259
- begin
260
- response = @client.send(request)
261
- rescue Net::HTTPRequestTimeout
262
- raise Auth0::Errors::TimeoutError
263
- end
264
- code = response.code.to_i
265
- if code.between?(200, 299)
266
- (response.body.to_s.empty? ? nil : Auth0::Types::UpdateFeatureFlagStatusResponseContent.load(response.body))
267
- else
268
- error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
269
- raise error_class.new(response.body, code: code)
270
- end
271
- end
272
-
273
228
  # @return [Auth0::Variations::Client]
274
229
  def variations
275
230
  @variations ||= Auth0::Experimentation::FeatureFlags::Variations::Client.new(client: @client)
@@ -12,6 +12,8 @@ module Auth0
12
12
  field :description, -> { String }, optional: true, nullable: false
13
13
 
14
14
  field :parameters, -> { Internal::Types::Hash[String, Auth0::Types::FeatureFlagConfigParam] }, optional: true, nullable: false
15
+
16
+ field :status, -> { Auth0::Types::FeatureFlagStatusEnum }, optional: true, nullable: false
15
17
  end
16
18
  end
17
19
  end
@@ -23,12 +23,14 @@ module Auth0
23
23
  # @option params [String, nil] :from
24
24
  # @option params [Integer, nil] :take
25
25
  # @option params [Auth0::Types::SegmentTypeFilterEnum, nil] :type
26
+ # @option params [Auth0::Types::SegmentStatusEnum, nil] :status
26
27
  #
27
28
  # @example
28
29
  # client.experimentation.segments.list(
29
30
  # from: "from",
30
31
  # take: 1,
31
- # type: "auth0"
32
+ # type: "auth0",
33
+ # status: "active"
32
34
  # )
33
35
  #
34
36
  # @return [Auth0::Types::ListSegmentsResponseContent]
@@ -38,6 +40,7 @@ module Auth0
38
40
  query_params["from"] = params[:from] if params.key?(:from)
39
41
  query_params["take"] = params.fetch(:take, 50)
40
42
  query_params["type"] = params[:type] if params.key?(:type)
43
+ query_params["status"] = params[:status] if params.key?(:status)
41
44
 
42
45
  Auth0::Internal::CursorItemIterator.new(
43
46
  cursor_field: :next_,
@@ -10,6 +10,8 @@ module Auth0
10
10
  field :take, -> { Integer }, optional: true, nullable: false
11
11
 
12
12
  field :type, -> { Auth0::Types::SegmentTypeFilterEnum }, optional: true, nullable: false
13
+
14
+ field :status, -> { Auth0::Types::SegmentStatusEnum }, optional: true, nullable: false
13
15
  end
14
16
  end
15
17
  end
@@ -12,6 +12,8 @@ module Auth0
12
12
  field :description, -> { String }, optional: true, nullable: false
13
13
 
14
14
  field :rules, -> { Internal::Types::Array[Auth0::Types::SegmentRule] }, optional: true, nullable: false
15
+
16
+ field :status, -> { Auth0::Types::SegmentStatusEnum }, optional: true, nullable: false
15
17
  end
16
18
  end
17
19
  end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Auth0
4
+ module Internal
5
+ module Http
6
+ # Rate limit information parsed from the `x-ratelimit-*` headers Auth0
7
+ # returns on API responses.
8
+ #
9
+ # @see https://auth0.com/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy
10
+ class RateLimit
11
+ # @return [Integer, nil] the maximum number of requests allowed in the current window
12
+ attr_reader :limit
13
+ # @return [Integer, nil] the number of requests remaining in the current window
14
+ attr_reader :remaining
15
+ # @return [Time, nil] the UTC time at which the current window resets
16
+ attr_reader :reset
17
+
18
+ # @param limit [Integer, nil]
19
+ # @param remaining [Integer, nil]
20
+ # @param reset [Time, nil]
21
+ def initialize(limit:, remaining:, reset:)
22
+ @limit = limit
23
+ @remaining = remaining
24
+ @reset = reset
25
+ end
26
+
27
+ # Build from an object that exposes headers via `#[]` using the HTTP
28
+ # header name (e.g. a `Net::HTTPResponse`, whose `#[]` is
29
+ # case-insensitive). Used by the Management API (RawClient) path.
30
+ #
31
+ # @param response [#[]] responds to `[]` with header access
32
+ # @return [Auth0::Internal::Http::RateLimit]
33
+ def self.from_http_response(response)
34
+ build(
35
+ response["x-ratelimit-limit"],
36
+ response["x-ratelimit-remaining"],
37
+ response["x-ratelimit-reset"]
38
+ )
39
+ end
40
+
41
+ # Build from a plain headers hash (e.g. RestClient's, whose keys are
42
+ # symbols like `:x_ratelimit_remaining`). Keys are matched
43
+ # case-insensitively and dash/underscore-agnostically. Used by the
44
+ # Authentication API (HTTPProxy) path.
45
+ #
46
+ # @param headers [Hash, nil]
47
+ # @return [Auth0::Internal::Http::RateLimit]
48
+ def self.from_headers(headers)
49
+ normalized = (headers || {}).each_with_object({}) do |(key, value), acc|
50
+ acc[key.to_s.downcase.tr("-", "_")] = value
51
+ end
52
+
53
+ build(
54
+ normalized["x_ratelimit_limit"],
55
+ normalized["x_ratelimit_remaining"],
56
+ normalized["x_ratelimit_reset"]
57
+ )
58
+ end
59
+
60
+ # Invokes the handler with the given rate limit. A handler error must
61
+ # never break the caller's request, so it is rescued and warned rather
62
+ # than raised. Parsing happens before this call, so a parsing bug is not
63
+ # misattributed to the handler.
64
+ #
65
+ # @param handler [#call, nil] the configured rate limit handler
66
+ # @param rate_limit [Auth0::Internal::Http::RateLimit]
67
+ # @return [void]
68
+ def self.deliver(handler, rate_limit)
69
+ return if handler.nil?
70
+
71
+ handler.call(rate_limit)
72
+ rescue StandardError => e
73
+ warn "[auth0] rate_limit_handler raised #{e.class}: #{e.message}"
74
+ end
75
+
76
+ # @param limit [String, nil] raw `x-ratelimit-limit` value
77
+ # @param remaining [String, nil] raw `x-ratelimit-remaining` value
78
+ # @param reset [String, nil] raw `x-ratelimit-reset` value
79
+ # @return [Auth0::Internal::Http::RateLimit]
80
+ def self.build(limit, remaining, reset)
81
+ reset_epoch = to_integer(reset)
82
+
83
+ new(
84
+ limit: to_integer(limit),
85
+ remaining: to_integer(remaining),
86
+ reset: reset_epoch.nil? ? nil : Time.at(reset_epoch).utc
87
+ )
88
+ end
89
+ private_class_method :build
90
+
91
+ # Parse an integer header value, returning nil for blank or non-numeric
92
+ # input (so a malformed header is never silently reported as 0).
93
+ #
94
+ # @param value [String, nil] the raw header value
95
+ # @return [Integer, nil]
96
+ def self.to_integer(value)
97
+ Integer(value.to_s.strip, exception: false)
98
+ end
99
+ private_class_method :to_integer
100
+ end
101
+ end
102
+ end
103
+ end
@@ -3,6 +3,8 @@
3
3
  # This file was auto-generated by Fern from our API Definition.
4
4
  # Modified by Auth0 to use Auth0 telemetry format with dynamic versioning.
5
5
 
6
+ require_relative "rate_limit"
7
+
6
8
  module Auth0
7
9
  module Internal
8
10
  module Http
@@ -20,14 +22,21 @@ module Auth0
20
22
  # @return [String] The base URL for requests
21
23
  attr_reader :base_url
22
24
 
25
+ # @return [#call, nil] Optional callback invoked with an
26
+ # {Auth0::Internal::Http::RateLimit} after every response.
27
+ attr_accessor :rate_limit_handler
28
+
23
29
  # @param base_url [String] The base url for the request.
24
30
  # @param max_retries [Integer] The number of times to retry a failed request, defaults to 2.
25
31
  # @param timeout [Float] The timeout for the request, defaults to 60.0 seconds.
26
32
  # @param headers [Hash] The headers for the request.
27
- def initialize(base_url:, max_retries: 2, timeout: 60.0, headers: {})
33
+ # @param rate_limit_handler [#call, nil] Optional callback invoked with the
34
+ # parsed rate limit (from the `x-ratelimit-*` headers) after every response.
35
+ def initialize(base_url:, max_retries: 2, timeout: 60.0, headers: {}, rate_limit_handler: nil)
28
36
  @base_url = base_url
29
37
  @max_retries = max_retries
30
38
  @timeout = timeout
39
+ @rate_limit_handler = rate_limit_handler
31
40
 
32
41
  # Auth0 telemetry in standard format
33
42
  telemetry = {
@@ -45,7 +54,7 @@ module Auth0
45
54
  end
46
55
 
47
56
  # @param request [Auth0::Internal::Http::BaseRequest] The HTTP request.
48
- # @return [HTTP::Response] The HTTP response.
57
+ # @return [Net::HTTPResponse] The HTTP response.
49
58
  def send(request)
50
59
  url = build_url(request)
51
60
  attempt = 0
@@ -67,6 +76,9 @@ module Auth0
67
76
 
68
77
  response = conn.request(http_request)
69
78
 
79
+ # Report rate limit on every response, including retried 429s.
80
+ RateLimit.deliver(@rate_limit_handler, RateLimit.from_http_response(response)) if @rate_limit_handler
81
+
70
82
  break unless should_retry?(response, attempt)
71
83
 
72
84
  delay = retry_delay(response, attempt)
@@ -141,13 +141,22 @@ module Auth0
141
141
  values = Utils.symbolize_keys(values.dup)
142
142
 
143
143
  self.class.fields.each do |field_name, field|
144
- value = values.delete(field.api_name.to_sym) || values.delete(field.api_name) || values.delete(field_name)
144
+ # key?/nil? checks keep an explicit `false`, and both keys are consumed so neither leaks into extra fields
145
+ value = nil
146
+ [field.api_name.to_sym, field_name].uniq.each do |key|
147
+ next unless values.key?(key)
145
148
 
146
- field_value = value || (if field.literal?
147
- field.value
148
- elsif field.default
149
- field.default
150
- end)
149
+ candidate = values.delete(key)
150
+ value = candidate if value.nil?
151
+ end
152
+
153
+ field_value = if !value.nil?
154
+ value
155
+ elsif field.literal?
156
+ field.value
157
+ elsif !field.default.nil?
158
+ field.default
159
+ end
151
160
 
152
161
  @data[field_name] = Utils.coerce(field.type, field_value)
153
162
  end