auth0 4.11.0 → 5.20.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 (358) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -0
  3. data/CHANGELOG.md +477 -19
  4. data/README.md +80 -129
  5. data/auth0.gemspec +10 -13
  6. data/lib/auth0/algorithm.rb +5 -0
  7. data/lib/auth0/api/authentication_endpoints.rb +189 -242
  8. data/lib/auth0/api/v2/actions.rb +209 -0
  9. data/lib/auth0/api/v2/attack_protection.rb +79 -0
  10. data/lib/auth0/api/v2/branding.rb +65 -0
  11. data/lib/auth0/api/v2/client_grants.rb +27 -2
  12. data/lib/auth0/api/v2/clients.rb +42 -0
  13. data/lib/auth0/api/v2/connections.rb +14 -5
  14. data/lib/auth0/api/v2/device_credentials.rb +12 -7
  15. data/lib/auth0/api/v2/grants.rb +49 -0
  16. data/lib/auth0/api/v2/jobs.rb +28 -5
  17. data/lib/auth0/api/v2/log_streams.rb +78 -0
  18. data/lib/auth0/api/v2/logs.rb +2 -2
  19. data/lib/auth0/api/v2/organizations.rb +407 -0
  20. data/lib/auth0/api/v2/prompts.rb +70 -0
  21. data/lib/auth0/api/v2/refresh_tokens.rb +34 -0
  22. data/lib/auth0/api/v2/roles.rb +7 -3
  23. data/lib/auth0/api/v2/sessions.rb +43 -0
  24. data/lib/auth0/api/v2/tickets.rb +25 -2
  25. data/lib/auth0/api/v2/users.rb +216 -14
  26. data/lib/auth0/api/v2.rb +21 -3
  27. data/lib/auth0/client_assertion.rb +45 -0
  28. data/lib/auth0/exception.rb +19 -8
  29. data/lib/auth0/mixins/access_token_struct.rb +2 -2
  30. data/lib/auth0/mixins/api_token_struct.rb +2 -3
  31. data/lib/auth0/mixins/httpproxy.rb +99 -35
  32. data/lib/auth0/mixins/initializer.rb +6 -9
  33. data/lib/auth0/mixins/permission_struct.rb +2 -2
  34. data/lib/auth0/mixins/token_management.rb +35 -0
  35. data/lib/auth0/mixins/validation.rb +335 -1
  36. data/lib/auth0/mixins.rb +2 -1
  37. data/lib/auth0/version.rb +1 -1
  38. data/lib/auth0.rb +1 -0
  39. metadata +71 -608
  40. data/.bundle/config +0 -4
  41. data/.circleci/config.yml +0 -23
  42. data/.env.example +0 -2
  43. data/.gemrelease +0 -2
  44. data/.github/CODEOWNERS +0 -1
  45. data/.github/ISSUE_TEMPLATE.md +0 -39
  46. data/.github/PULL_REQUEST_TEMPLATE.md +0 -35
  47. data/.github/stale.yml +0 -20
  48. data/.gitignore +0 -14
  49. data/.rspec +0 -3
  50. data/.rubocop.yml +0 -10
  51. data/.rubocop_todo.yml +0 -5
  52. data/CODE_OF_CONDUCT.md +0 -3
  53. data/DEPLOYMENT.md +0 -61
  54. data/Dockerfile +0 -5
  55. data/Gemfile +0 -19
  56. data/Gemfile.lock +0 -224
  57. data/Guardfile +0 -37
  58. data/RUBYGEM.md +0 -9
  59. data/Rakefile +0 -53
  60. data/codecov.yml +0 -22
  61. data/deploy_documentation.sh +0 -29
  62. data/doc_config/templates/default/fulldoc/html/css/full_list.css +0 -79
  63. data/doc_config/templates/default/fulldoc/html/css/style.css +0 -546
  64. data/doc_config/templates/default/layout/html/breadcrumb.erb +0 -11
  65. data/doc_config/templates/default/layout/html/footer.erb +0 -115
  66. data/doc_config/templates/default/layout/html/headers.erb +0 -17
  67. data/doc_config/templates/default/layout/html/layout.erb +0 -27
  68. data/examples/ruby-api/.env.example +0 -2
  69. data/examples/ruby-api/.gitignore +0 -86
  70. data/examples/ruby-api/Gemfile +0 -8
  71. data/examples/ruby-api/README.md +0 -24
  72. data/examples/ruby-api/config.ru +0 -2
  73. data/examples/ruby-api/main.rb +0 -33
  74. data/examples/ruby-on-rails-api/.env.example +0 -2
  75. data/examples/ruby-on-rails-api/.gitignore +0 -18
  76. data/examples/ruby-on-rails-api/Gemfile +0 -48
  77. data/examples/ruby-on-rails-api/README.md +0 -27
  78. data/examples/ruby-on-rails-api/Rakefile +0 -6
  79. data/examples/ruby-on-rails-api/app/assets/images/.keep +0 -0
  80. data/examples/ruby-on-rails-api/app/assets/javascripts/application.js +0 -16
  81. data/examples/ruby-on-rails-api/app/assets/stylesheets/application.css +0 -15
  82. data/examples/ruby-on-rails-api/app/controllers/application_controller.rb +0 -8
  83. data/examples/ruby-on-rails-api/app/controllers/concerns/.keep +0 -0
  84. data/examples/ruby-on-rails-api/app/controllers/ping_controller.rb +0 -6
  85. data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +0 -11
  86. data/examples/ruby-on-rails-api/app/helpers/application_helper.rb +0 -3
  87. data/examples/ruby-on-rails-api/app/mailers/.keep +0 -0
  88. data/examples/ruby-on-rails-api/app/models/.keep +0 -0
  89. data/examples/ruby-on-rails-api/app/models/User.rb +0 -5
  90. data/examples/ruby-on-rails-api/app/models/concerns/.keep +0 -0
  91. data/examples/ruby-on-rails-api/app/views/layouts/application.html.erb +0 -14
  92. data/examples/ruby-on-rails-api/bin/bundle +0 -3
  93. data/examples/ruby-on-rails-api/bin/rails +0 -4
  94. data/examples/ruby-on-rails-api/bin/rake +0 -4
  95. data/examples/ruby-on-rails-api/bin/setup +0 -29
  96. data/examples/ruby-on-rails-api/config/application.rb +0 -23
  97. data/examples/ruby-on-rails-api/config/boot.rb +0 -4
  98. data/examples/ruby-on-rails-api/config/database.yml +0 -27
  99. data/examples/ruby-on-rails-api/config/environment.rb +0 -5
  100. data/examples/ruby-on-rails-api/config/environments/development.rb +0 -37
  101. data/examples/ruby-on-rails-api/config/environments/production.rb +0 -83
  102. data/examples/ruby-on-rails-api/config/environments/test.rb +0 -41
  103. data/examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb +0 -7
  104. data/examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb +0 -3
  105. data/examples/ruby-on-rails-api/config/initializers/dotenv.rb +0 -4
  106. data/examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb +0 -4
  107. data/examples/ruby-on-rails-api/config/initializers/inflections.rb +0 -16
  108. data/examples/ruby-on-rails-api/config/initializers/knock.rb +0 -35
  109. data/examples/ruby-on-rails-api/config/initializers/mime_types.rb +0 -4
  110. data/examples/ruby-on-rails-api/config/initializers/session_store.rb +0 -3
  111. data/examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb +0 -14
  112. data/examples/ruby-on-rails-api/config/locales/en.yml +0 -23
  113. data/examples/ruby-on-rails-api/config/routes.rb +0 -58
  114. data/examples/ruby-on-rails-api/config/secrets.yml +0 -28
  115. data/examples/ruby-on-rails-api/config.ru +0 -4
  116. data/examples/ruby-on-rails-api/db/schema.rb +0 -15
  117. data/examples/ruby-on-rails-api/db/seeds.rb +0 -7
  118. data/examples/ruby-on-rails-api/lib/assets/.keep +0 -0
  119. data/examples/ruby-on-rails-api/lib/tasks/.keep +0 -0
  120. data/examples/ruby-on-rails-api/log/.keep +0 -0
  121. data/examples/ruby-on-rails-api/public/404.html +0 -67
  122. data/examples/ruby-on-rails-api/public/422.html +0 -67
  123. data/examples/ruby-on-rails-api/public/500.html +0 -66
  124. data/examples/ruby-on-rails-api/public/favicon.ico +0 -0
  125. data/examples/ruby-on-rails-api/public/robots.txt +0 -5
  126. data/examples/ruby-on-rails-api/test/controllers/.keep +0 -0
  127. data/examples/ruby-on-rails-api/test/fixtures/.keep +0 -0
  128. data/examples/ruby-on-rails-api/test/helpers/.keep +0 -0
  129. data/examples/ruby-on-rails-api/test/integration/.keep +0 -0
  130. data/examples/ruby-on-rails-api/test/mailers/.keep +0 -0
  131. data/examples/ruby-on-rails-api/test/models/.keep +0 -0
  132. data/examples/ruby-on-rails-api/test/ping_controller_test.rb +0 -8
  133. data/examples/ruby-on-rails-api/test/secured_ping_controller_test.rb +0 -26
  134. data/examples/ruby-on-rails-api/test/test_helper.rb +0 -16
  135. data/lib/auth0/api/v1/clients.rb +0 -48
  136. data/lib/auth0/api/v1/connections.rb +0 -53
  137. data/lib/auth0/api/v1/logs.rb +0 -34
  138. data/lib/auth0/api/v1/rules.rb +0 -45
  139. data/lib/auth0/api/v1/users.rb +0 -164
  140. data/lib/auth0/api/v1.rb +0 -19
  141. data/publish_rubygem.sh +0 -10
  142. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_change_password/should_trigger_a_password_reset.yml +0 -63
  143. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_email.yml +0 -54
  144. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_password.yml +0 -54
  145. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_invalid_audience.yml +0 -55
  146. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_custom_audience.yml +0 -117
  147. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_default_scope.yml +0 -119
  148. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_saml_metadata/should_retrieve_SAML_metadata.yml +0 -57
  149. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_fail_as_not_authorized.yml +0 -55
  150. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_return_the_userinfo.yml +0 -118
  151. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_wsfed_metadata/should_retrieve_WSFED_metadata.yml +0 -55
  152. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/create_test_user.yml +0 -58
  153. data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/delete_test_user.yml +0 -54
  154. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_check_if_ip_is_blocked/should_return_200_response_code.yml +0 -65
  155. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_remove_ip_block/should_remove_an_IP_successfully.yml +0 -60
  156. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_add_token_to_blacklist/should_add_a_token_to_the_blacklist.yml +0 -56
  157. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_blacklisted_tokens/should_get_the_added_token_from_the_blacklist.yml +0 -59
  158. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_at_least_1_result.yml +0 -62
  159. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_first_page_of_one_result.yml +0 -66
  160. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_test_client_grant.yml +0 -62
  161. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_delete_client_grant/should_delete_the_test_client_grant.yml +0 -54
  162. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_patch_client_grant/should_update_the_test_client_grant.yml +0 -64
  163. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client.yml +0 -118
  164. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client_grant.yml +0 -64
  165. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client.yml +0 -54
  166. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client_grant.yml +0 -54
  167. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_exclude_and_include_fields_properly.yml +0 -91
  168. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_include_the_specified_fields.yml +0 -63
  169. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/should_get_the_test_client.yml +0 -92
  170. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_fields_not_specified.yml +0 -60
  171. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_the_specified_fields.yml +0 -132
  172. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_include_the_specified_fields.yml +0 -63
  173. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_paginate_results.yml +0 -65
  174. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/should_get_at_least_one_client.yml +0 -132
  175. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_delete_client/should_delete_the_test_client_without_an_error.yml +0 -54
  176. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_patch_client/should_update_the_client_with_the_correct_attributes.yml +0 -94
  177. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/create_test_client.yml +0 -118
  178. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +0 -63
  179. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +0 -61
  180. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +0 -63
  181. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +0 -59
  182. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +0 -59
  183. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +0 -59
  184. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +0 -59
  185. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +0 -59
  186. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +0 -54
  187. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +0 -110
  188. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +0 -66
  189. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +0 -65
  190. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_user.yml +0 -68
  191. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_delete_device_credential/should_delete_the_test_credential_without_an_error.yml +0 -54
  192. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/_filter_by_type/should_exclude_the_test_credential.yml +0 -59
  193. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_have_at_least_1_entry.yml +0 -62
  194. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_include_the_test_credential.yml +0 -62
  195. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_credential.yml +0 -62
  196. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_user.yml +0 -68
  197. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_credential.yml +0 -54
  198. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_user.yml +0 -54
  199. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_configure_provider/should_configure_a_new_email_provider.yml +0 -63
  200. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_delete_the_existing_email_provider_without_an_error.yml +0 -54
  201. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_throw_an_error_trying_to_get_the_email_provider.yml +0 -51
  202. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_with_specific_fields.yml +0 -60
  203. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_without_specific_fields.yml +0 -61
  204. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/should_get_the_existing_email_provider.yml +0 -61
  205. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_update_provider/should_update_the_existing_email_provider.yml +0 -63
  206. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/delete_existing_provider.yml +0 -54
  207. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_create_an_export_users_job_successfully.yml +0 -61
  208. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_get_the_export_users_job.yml +0 -117
  209. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_create_an_import_users_job_successfully.yml +0 -60
  210. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_get_the_import_users_job.yml +0 -116
  211. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_create_a_new_verification_email_job.yml +0 -119
  212. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_get_the_completed_verification_email.yml +0 -175
  213. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_reject_an_invalid_client_id.yml +0 -109
  214. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/delete_imported_user.yml +0 -110
  215. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/search_for_connection_id.yml +0 -59
  216. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_match_the_created_log_entry.yml +0 -265
  217. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_not_be_empty.yml +0 -265
  218. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_fields_not_specified.yml +0 -61
  219. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_the_specified_fields.yml +0 -75
  220. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_have_one_log_entry.yml +0 -76
  221. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_include_the_specified_fields.yml +0 -62
  222. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_from/should_take_one_log_entry.yml +0 -258
  223. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/create_test_user.yml +0 -68
  224. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_disabled_rule.yml +0 -54
  225. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_enabled_rule.yml +0 -54
  226. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_user.yml +0 -54
  227. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_delete_resource_server/should_delete_the_test_server_without_an_error.yml +0 -54
  228. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_patch_resource_server/should_update_the_resource_server_with_the_correct_attributes.yml +0 -61
  229. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_server/should_get_the_test_server.yml +0 -59
  230. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_get_the_test_server.yml +0 -59
  231. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_at_least_1_result.yml +0 -59
  232. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_the_first_page_of_one_result.yml +0 -64
  233. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/create_test_server.yml +0 -61
  234. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/delete_test_server.yml +0 -54
  235. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_permissions/should_add_a_Permission_to_the_Role_successfully.yml +0 -69
  236. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_users/should_add_a_User_to_the_Role_successfully.yml +0 -69
  237. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_delete_role/should_delete_the_Role_successfully.yml +0 -62
  238. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role/should_get_the_Role_successfully.yml +0 -67
  239. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_exactly_1_Permission.yml +0 -67
  240. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_the_added_Permission_from_the_Role_successfully.yml +0 -67
  241. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_exactly_1_User.yml +0 -67
  242. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_the_added_User_from_the_Role_successfully.yml +0 -67
  243. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_roles/should_get_the_Role_successfully.yml +0 -67
  244. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_remove_role_permissions/should_remove_a_Permission_from_the_Role_successfully.yml +0 -64
  245. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_update_role/should_update_the_Role_successfully.yml +0 -69
  246. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_api.yml +0 -69
  247. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_role.yml +0 -69
  248. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_user.yml +0 -69
  249. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_api.yml +0 -62
  250. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_user.yml +0 -62
  251. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_disabled_rule_without_an_error.yml +0 -54
  252. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_enabled_rule_without_an_error.yml +0 -54
  253. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_fields_not_specified.yml +0 -62
  254. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_specified_fields.yml +0 -62
  255. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_include_the_specified_fields.yml +0 -61
  256. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/should_get_a_specific_rule.yml +0 -62
  257. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_exclude_fields_not_specified.yml +0 -60
  258. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_include_the_specified_fields.yml +0 -61
  259. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_disabled_rule.yml +0 -63
  260. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_enabled_rule.yml +0 -62
  261. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_paginated_results.yml +0 -128
  262. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/should_return_at_least_1_rule.yml +0 -64
  263. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_update_rule/should_update_the_disabled_rule_to_be_enabled.yml +0 -64
  264. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_disabled_rule.yml +0 -65
  265. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_enabled_rule.yml +0 -65
  266. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_active_users/should_have_at_least_one_active_user.yml +0 -59
  267. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_daily_stats/should_have_at_least_one_stats_entry_for_the_timeframe.yml +0 -63
  268. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings/should_get_the_tenant_settings.yml +0 -95
  269. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_exclude_a_field_not_requested.yml +0 -61
  270. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_include_the_field_requested.yml +0 -61
  271. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_revert_the_tenant_name.yml +0 -96
  272. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_update_the_tenant_settings_with_a_new_tenant_name.yml +0 -96
  273. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_email_verification/should_create_an_email_verification_ticket.yml +0 -63
  274. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_password_change/should_create_a_password_change_ticket.yml +0 -63
  275. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/create_test_user.yml +0 -68
  276. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/delete_test_user.yml +0 -54
  277. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_permissions/should_add_a_Permissions_for_a_User_successfully.yml +0 -67
  278. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_roles/should_add_a_Role_to_a_User_successfully.yml +0 -62
  279. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_User_successfully.yml +0 -60
  280. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_secondary_User_successfully.yml +0 -60
  281. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user_provider/should_attempt_to_delete_the_MFA_provider_for_the_User.yml +0 -60
  282. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_enrollments/should_get_Enrollments_for_a_User_successfully.yml +0 -65
  283. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_exactly_1_Permission_for_a_User_successfully.yml +0 -65
  284. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_the_correct_Permission_for_a_User_successfully.yml +0 -65
  285. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_roles/should_get_Roles_for_a_User_successfully.yml +0 -65
  286. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_invalidate_browsers/should_invalidate_MFA_browsers_for_the_User_successfully.yml +0 -62
  287. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_link_user_account/should_link_two_Users_successfully.yml +0 -67
  288. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_patch_user/should_patch_the_User_successfully.yml +0 -68
  289. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_permissions/should_remove_a_Permission_from_a_User_successfully.yml +0 -62
  290. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_roles/should_remove_a_Role_from_a_User_successfully.yml +0 -62
  291. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_unlink_user_account/should_unlink_two_Users_successfully.yml +0 -65
  292. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_fields_not_indicated.yml +0 -65
  293. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_the_fields_indicated.yml +0 -65
  294. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_include_the_fields_indicated.yml +0 -65
  295. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/should_retrieve_the_created_user.yml +0 -65
  296. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user_logs/should_get_Logs_for_a_User_successfully.yml +0 -69
  297. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/is_expected_to_find_a_user_with_a_v2_search_engine_query.yml +0 -65
  298. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/is_expected_to_find_a_user_with_a_v3_search_engine_query.yml +0 -65
  299. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_exclude_the_indicated_fields_when_paginated.yml +0 -65
  300. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_include_the_indicated_fields_when_paginated.yml +0 -65
  301. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_not_include_other_fields_when_paginated.yml +0 -65
  302. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_return_the_correct_number_of_results_when_paginated.yml +0 -65
  303. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/should_have_at_least_one_user.yml +0 -65
  304. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_secondary_test_user.yml +0 -67
  305. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_api.yml +0 -67
  306. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_role.yml +0 -67
  307. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_user.yml +0 -67
  308. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_api.yml +0 -60
  309. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_role.yml +0 -60
  310. data/spec/integration/lib/auth0/api/api_authentication_spec.rb +0 -120
  311. data/spec/integration/lib/auth0/api/v2/api_anomaly_spec.rb +0 -17
  312. data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +0 -27
  313. data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +0 -75
  314. data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +0 -166
  315. data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +0 -159
  316. data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +0 -128
  317. data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +0 -117
  318. data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +0 -112
  319. data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +0 -91
  320. data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +0 -130
  321. data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +0 -145
  322. data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +0 -177
  323. data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +0 -22
  324. data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +0 -59
  325. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +0 -53
  326. data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +0 -73
  327. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +0 -300
  328. data/spec/integration/lib/auth0/auth0_client_spec.rb +0 -90
  329. data/spec/lib/auth0/api/authentication_endpoints_spec.rb +0 -678
  330. data/spec/lib/auth0/api/v2/anomaly_spec.rb +0 -26
  331. data/spec/lib/auth0/api/v2/blacklists_spec.rb +0 -25
  332. data/spec/lib/auth0/api/v2/client_grants_spec.rb +0 -76
  333. data/spec/lib/auth0/api/v2/clients_spec.rb +0 -104
  334. data/spec/lib/auth0/api/v2/connections_spec.rb +0 -140
  335. data/spec/lib/auth0/api/v2/device_credentials_spec.rb +0 -73
  336. data/spec/lib/auth0/api/v2/emails_spec.rb +0 -47
  337. data/spec/lib/auth0/api/v2/guardian_spec.rb +0 -154
  338. data/spec/lib/auth0/api/v2/jobs_spec.rb +0 -111
  339. data/spec/lib/auth0/api/v2/logs_spec.rb +0 -48
  340. data/spec/lib/auth0/api/v2/resource_servers_spec.rb +0 -86
  341. data/spec/lib/auth0/api/v2/roles_spec.rb +0 -362
  342. data/spec/lib/auth0/api/v2/rules_spec.rb +0 -95
  343. data/spec/lib/auth0/api/v2/stats_spec.rb +0 -22
  344. data/spec/lib/auth0/api/v2/tenants_spec.rb +0 -26
  345. data/spec/lib/auth0/api/v2/tickets_spec.rb +0 -46
  346. data/spec/lib/auth0/api/v2/user_blocks_spec.rb +0 -52
  347. data/spec/lib/auth0/api/v2/users_by_email_spec.rb +0 -21
  348. data/spec/lib/auth0/api/v2/users_spec.rb +0 -525
  349. data/spec/lib/auth0/client_spec.rb +0 -153
  350. data/spec/lib/auth0/mixins/httpproxy_spec.rb +0 -304
  351. data/spec/lib/auth0/mixins/initializer_spec.rb +0 -30
  352. data/spec/spec_helper.rb +0 -62
  353. data/spec/support/credentials.rb +0 -30
  354. data/spec/support/dummy_class.rb +0 -18
  355. data/spec/support/dummy_class_for_proxy.rb +0 -5
  356. data/spec/support/dummy_class_for_restclient.rb +0 -2
  357. data/spec/support/import_users.json +0 -13
  358. data/spec/support/stub_response.rb +0 -1
@@ -0,0 +1,209 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the actions endpoints
5
+ module Actions
6
+ include Auth0::Mixins::Validation
7
+
8
+ attr_reader :actions_path
9
+
10
+ # Get all actions.
11
+ # @see https://auth0.com/docs/api/management/v2#!/Actions/get_actions
12
+ # @param trigger_id [string] An actions extensibility point.
13
+ # @param action_name [string] The name of the action to retrieve.
14
+ # @param deployed [boolean] filter to only retrieve actions that are deployed.
15
+ # @param per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
16
+ # @param page [integer] The page number. Zero based.
17
+ # @param installed [boolean] When true, return only installed actions. When false, return only custom actions. Returns all actions by default.
18
+ # @return [json] Actions and pagination info
19
+ def actions(trigger_id = nil, action_name = nil, deployed: nil, per_page: nil, page: nil, installed: nil)
20
+ request_params = {
21
+ triggerId: trigger_id,
22
+ actionName: action_name,
23
+ deployed: deployed,
24
+ per_page: per_page,
25
+ page: page,
26
+ installed: installed
27
+ }
28
+
29
+ path = "#{actions_path}/actions"
30
+ get(path, request_params)
31
+ end
32
+ alias get_actions actions
33
+
34
+ # Create a new action.
35
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/post_action
36
+ # @param body [hash] See https://auth0.com/docs/api/management/v2/#!/actions/post_action for available options
37
+ # @return [json] Returns the created action.
38
+ def create_action(body = {})
39
+ path = "#{actions_path}/actions"
40
+ post(path, body)
41
+ end
42
+
43
+ # Retrieve the set of triggers currently available within actions. A trigger is an extensibility point to which actions can be bound.
44
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/get_triggers
45
+ #
46
+ # @return [json] Returns triggers of the action
47
+ def actions_triggers
48
+ path = "#{actions_path}/triggers"
49
+ get(path)
50
+ end
51
+
52
+ # Get an action by id.
53
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/get_action
54
+ # @param action_id [string] The action_id of the user to retrieve.
55
+ #
56
+ # @return [json] Returns the action with the given action_id if it exists.
57
+ def action(action_id)
58
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
59
+ path = "#{actions_path}/actions/#{action_id}"
60
+ get(path)
61
+ end
62
+ alias get_action action
63
+
64
+
65
+ # Deletes a single action given its id
66
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/delete_action
67
+ # @param action_id [string] The action ID
68
+ # @param force [boolean] Force action deletion detaching bindings (defaults to false)
69
+ def delete_action(action_id, force=false)
70
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
71
+ path = "#{actions_path}/actions/#{action_id}"
72
+ delete(path, { force: force })
73
+ end
74
+
75
+ # Update an existing action.
76
+ # @see https://auth0.com/docs/api/management/v2/#!/Actions/patch_action
77
+ # @param action_id [string] The action ID
78
+ # @param body [hash] The optional parameters to update.
79
+ #
80
+ # @return [json] Returns the updated user.
81
+ def patch_action(action_id, body)
82
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
83
+ raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?
84
+ path = "#{actions_path}/actions/#{action_id}"
85
+ patch(path, body)
86
+ end
87
+ alias update_action patch_action
88
+
89
+ # Retrieve information about a specific execution of a trigger.
90
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/get_action
91
+ # @param execution_id [string] The ID of the exeution to retrieve.
92
+ #
93
+ # @return [json] Returns the action with the given execution_id if it exists.
94
+ def execution(execution_id)
95
+ raise Auth0::MissingExecutionId, 'Must supply a valid execution_id' if execution_id.to_s.empty?
96
+ path = "#{actions_path}/executions/#{execution_id}"
97
+ get(path)
98
+ end
99
+ alias get_execution execution
100
+
101
+ # Retrieve all of an action's versions.
102
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/versions
103
+ # @param action_id [string] The ID of the action.
104
+ # @param per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
105
+ # @param page [integer] The page number. Zero based
106
+ #
107
+ # @return [json] Returns the action with the given execution_id if it exists.
108
+ def actions_versions(action_id, page: nil, per_page: nil)
109
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
110
+ path = "#{actions_path}/actions/#{action_id}/versions"
111
+ request_params = {
112
+ per_page: per_page,
113
+ page: page
114
+ }
115
+
116
+ get(path, request_params)
117
+ end
118
+ alias get_actions_versions actions_versions
119
+
120
+ # Retrieve the actions that are bound to a trigger.
121
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/get_bindings
122
+ # @param trigger_id [string] An actions extensibility point.
123
+ # @param per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
124
+ # @param page [integer] The page number. Zero based
125
+ #
126
+ # @return [json] Returns the action with the given trigger_id if it exists.
127
+ def trigger_bindings(trigger_id, page: nil, per_page: nil)
128
+ raise Auth0::MissingTriggerId, 'Must supply a valid trigger_id' if trigger_id.to_s.empty?
129
+ path = "#{actions_path}/triggers/#{trigger_id}/bindings"
130
+ request_params = {
131
+ per_page: per_page,
132
+ page: page
133
+ }
134
+
135
+ get(path, request_params)
136
+ end
137
+ alias get_trigger_bindings trigger_bindings
138
+
139
+ # Update the actions that are bound (i.e. attached) to a trigger.
140
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/patch_bindings
141
+ # @param trigger_id [string] An actions extensibility point.
142
+ # @param body [hash] The optional parameters to update.
143
+ #
144
+ # @return [json] Returns the bindings that were updated.
145
+ def patch_trigger_bindings(trigger_id, body = nil)
146
+ raise Auth0::MissingTriggerId, 'Must supply a valid trigger_id' if trigger_id.to_s.empty?
147
+ raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?
148
+ path = "#{actions_path}/triggers/#{trigger_id}/bindings"
149
+ patch(path, body)
150
+ end
151
+ alias update_trigger_bindings patch_trigger_bindings
152
+
153
+ # Retrieve a specific version of an action
154
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/get_action_version
155
+ # @param action_id [string] The ID of the action.
156
+ # @param version_id [string] The ID of the action version.
157
+ #
158
+ # @return [json] Returns the action.
159
+ def action_by_version(action_id, version_id)
160
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
161
+ raise Auth0::MissingVersionId, 'Must supply a valid version_id' if version_id.to_s.empty?
162
+ path = "#{actions_path}/actions/#{action_id}/versions/#{version_id}"
163
+ get(path)
164
+ end
165
+ alias get_action_by_version action_by_version
166
+
167
+ # Deploy an action.
168
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/post_deploy_action
169
+ # @param action_id [string] The ID of the action.
170
+ # @return [json] Returns the created action.
171
+ def deploy_action(action_id)
172
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
173
+ path = "#{actions_path}/actions/#{action_id}/deploy"
174
+ post(path)
175
+ end
176
+
177
+ # Test an action.
178
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/post_test_action
179
+ # @param action_id [string] The ID of the action.
180
+ # @param body [hash] See https://auth0.com/docs/api/management/v2/#!/actions/post_test_action for available options
181
+ # @return [json] Returns the created action.
182
+ def test_action(action_id, body = {})
183
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
184
+ raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?
185
+ path = "#{actions_path}/actions/#{action_id}/test"
186
+ post(path, body)
187
+ end
188
+
189
+ # Performs the equivalent of a roll-back of an action to an earlier, specified version.
190
+ # @see https://auth0.com/docs/api/management/v2/#!/actions/post_deploy_draft_version
191
+ # @param action_id [string] The ID of the action.
192
+ # @param version_id [string] The ID of the action version.
193
+ # @return [json] Returns the created action.
194
+ def rollback_action(action_id, version_id)
195
+ raise Auth0::MissingActionId, 'Must supply a valid action_id' if action_id.to_s.empty?
196
+ raise Auth0::MissingVersionId, 'Must supply a valid version_id' if version_id.to_s.empty?
197
+ path = "#{actions_path}/actions/#{action_id}/versions/#{version_id}/deploy"
198
+ post(path)
199
+ end
200
+
201
+ private
202
+ # actions API path
203
+ def actions_path
204
+ @actions_path ||= '/api/v2/actions'
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,79 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the attack-protection endpoints
5
+ module AttackProtection
6
+ attr_reader :attack_protection_path
7
+
8
+ # Get breached password detection settings
9
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_breached_password_detection
10
+ # @return [json] The configuration for breached password detection
11
+ def breached_password_detection
12
+ get(breached_password_settings_path)
13
+ end
14
+ alias get_breached_password_detection_settings breached_password_detection
15
+
16
+ # Update breached password detection settings
17
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_breached_password_detection
18
+ # @param body [hash] See https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_breached_password_detection for available options
19
+ # @return [json] The configuration for breached password detection
20
+ def patch_breached_password_detection(body)
21
+ patch(breached_password_settings_path, body)
22
+ end
23
+
24
+ # Get brute force protection settings.
25
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_brute_force_protection
26
+ # @return [json] The configuration for brute force protection
27
+ def brute_force_protection
28
+ get(brute_force_protection_settings_path)
29
+ end
30
+ alias get_brute_force_protection_settings brute_force_protection
31
+
32
+ # Update brute force protection settings.
33
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_brute_force_protection
34
+ # @param body [hash] See https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_brute_force_protection for available options
35
+ # @return [json] The configuration for brute force protection
36
+ def patch_brute_force_protection(body)
37
+ patch(brute_force_protection_settings_path, body)
38
+ end
39
+ alias update_brute_force_protection_settings patch_brute_force_protection
40
+
41
+ # Get suspicious IP throttling settings
42
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_suspicious_ip_throttling
43
+ # @return The configuration for suspicious IP throttling
44
+ def suspicious_ip_throttling
45
+ get(suspicious_ip_throttling_settings_path)
46
+ end
47
+ alias get_suspicious_ip_throttling_settings suspicious_ip_throttling
48
+
49
+ # Update suspicious IP throttling settings
50
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_suspicious_ip_throttling
51
+ # @param body [hash] See https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_suspicious_ip_throttling for available options
52
+ # @return The configuration for suspicious IP throttling
53
+ def patch_suspicious_ip_throttling(body)
54
+ patch(suspicious_ip_throttling_settings_path, body)
55
+ end
56
+ alias update_suspicious_ip_throttling_settings patch_suspicious_ip_throttling
57
+
58
+ private
59
+
60
+ def attack_protection_path
61
+ @attack_protection_path ||= '/api/v2/attack-protection'
62
+ end
63
+ alias update_breached_password_detection_settings patch_breached_password_detection
64
+
65
+ def breached_password_settings_path
66
+ "#{attack_protection_path}/breached-password-detection"
67
+ end
68
+
69
+ def brute_force_protection_settings_path
70
+ "#{attack_protection_path}/brute-force-protection"
71
+ end
72
+
73
+ def suspicious_ip_throttling_settings_path
74
+ "#{attack_protection_path}/suspicious-ip-throttling"
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,65 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the branding endpoints
5
+ module Branding
6
+ attr_reader :branding_path
7
+
8
+ # Retrieve branding settings.
9
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/get_branding
10
+ #
11
+ # @return [json] Returns branding settings.
12
+ def branding()
13
+ get(branding_path)
14
+ end
15
+ alias get_branding branding
16
+
17
+ # Update branding settings.
18
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/patch_branding
19
+ # @param body [hash] the branding settings to update
20
+ #
21
+ # @return [json] Returns branding settings.
22
+ def patch_branding(body = {})
23
+ patch(branding_path, body)
24
+ end
25
+ alias update_branding patch_branding
26
+
27
+ # Get template for New Universal Login Experience
28
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/get_universal_login
29
+ #
30
+ # @return [json] Returns branding settings.
31
+ def branding_templates_for_universal_login
32
+ get(templates_path)
33
+ end
34
+ alias get_branding_templates_for_universal_login branding_templates_for_universal_login
35
+
36
+ # Delete template for New Universal Login Experience
37
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/delete_universal_login
38
+ def delete_branding_templates_for_universal_login
39
+ delete(templates_path)
40
+ end
41
+
42
+ # Set template for New Universal Login Experience
43
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/put_universal_login
44
+ # @param body [hash] the branding settings to update
45
+ #
46
+ # @return [json] Returns branding settings.
47
+ def put_branding_templates_for_universal_login(body = {})
48
+ put(templates_path, body)
49
+ end
50
+ alias set_branding_templates_for_universal_login put_branding_templates_for_universal_login
51
+
52
+ private
53
+
54
+ # Branding API path
55
+ def branding_path
56
+ @branding_path ||= '/api/v2/branding'
57
+ end
58
+
59
+ def templates_path
60
+ @templates_path ||= "#{branding_path}/templates/universal-login"
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -11,13 +11,15 @@ module Auth0
11
11
  # @param audience [string] The audience of the client grant to retrieve.
12
12
  # @param page [int] Page number to get, 0-based.
13
13
  # @param per_page [int] Results per page if also passing a page number.
14
+ # @param allow_any_organization [bool] Optional filter on allow_any_organization.
14
15
  # @return [json] Returns the client grants.
15
- def client_grants (client_id: nil, audience: nil, page: nil, per_page: nil)
16
+ def client_grants (client_id: nil, audience: nil, page: nil, per_page: nil, allow_any_organization: nil)
16
17
  request_params = {
17
18
  client_id: client_id,
18
19
  audience: audience,
19
20
  page: page,
20
- per_page: per_page
21
+ per_page: per_page,
22
+ allow_any_organization: allow_any_organization
21
23
  }
22
24
  get(client_grants_path, request_params)
23
25
  end
@@ -54,6 +56,29 @@ module Auth0
54
56
  end
55
57
  alias update_client_grant patch_client_grant
56
58
 
59
+
60
+ # Get the organizations associated to a client grant.
61
+ # @param id [string] The client_grant_id of the client grant.
62
+ # @param options [hash] The Hash options used to define the paging of results
63
+ # * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
64
+ # * :page [integer] The page number. Zero based.
65
+ # * :from [string] For checkpoint pagination, the ID from which to start selection from.
66
+ # * :take [integer] For checkpoint pagination, the number of entries to retrieve. Default is 50.
67
+ # * :include_totals [boolean] True to include query summary in the result, false or nil otherwise.
68
+ # @return [json] Returns the organizations.
69
+ def get_client_grants_organizations(client_grant_id, options = {})
70
+ raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty?
71
+ request_params = {
72
+ per_page: options.fetch(:per_page, nil),
73
+ page: options.fetch(:page, nil),
74
+ from: options.fetch(:from, nil),
75
+ take: options.fetch(:take, nil),
76
+ include_totals: options.fetch(:include_totals, nil)
77
+ }
78
+ path = "#{client_grants_path}/#{client_grant_id}/organizations"
79
+ get(path, request_params)
80
+ end
81
+
57
82
  private
58
83
 
59
84
  # Client Grants API path
@@ -73,12 +73,54 @@ module Auth0
73
73
  patch(path, options)
74
74
  end
75
75
 
76
+ # Creates credentials for a client
77
+ # @param client_id [string] The Id of the client to update
78
+ # @param options [hash] The payload to send to the endpoint
79
+ def create_client_credentials(client_id, options)
80
+ raise Auth0::MissingClientId, 'Must specify a client id' if client_id.to_s.empty?
81
+ raise Auth0::MissingParameter, 'Must specify a valid body' if options.to_s.empty?
82
+ post(client_credentials_path(client_id), options)
83
+ end
84
+
85
+ # Gets the credentials for a client
86
+ # @param client_id [string] The Id of the client
87
+ # @return [hash] The client credentials
88
+ def client_credentials(client_id)
89
+ raise Auth0::MissingClientId, 'Must specify a client id' if client_id.to_s.empty?
90
+ get(client_credentials_path(client_id))
91
+ end
92
+ alias get_client_credentials client_credentials
93
+
94
+ # Gets a client credential by ID
95
+ # @param client_id [string] The Id of the client
96
+ # @param credential_id [string] The Id of the credential to retrieve
97
+ # @return [hash] The credential
98
+ def client_credential(client_id, credential_id)
99
+ raise Auth0::MissingClientId, 'Must specify a client id' if client_id.to_s.empty?
100
+ raise Auth0::MissingParameter, 'Must specify a credential id' if credential_id.to_s.empty?
101
+ get("#{client_credentials_path(client_id)}/#{credential_id}")
102
+ end
103
+ alias get_client_credential client_credential
104
+
105
+ # Deletes a credential from the specified client
106
+ # @param client_id [string] The Id of the client
107
+ # @param credential_id [string] The Id of the credential to delete
108
+ def delete_client_credential(client_id, credential_id)
109
+ raise Auth0::MissingClientId, 'Must specify a client id' if client_id.to_s.empty?
110
+ raise Auth0::MissingParameter, 'Must specify a credential id' if credential_id.to_s.empty?
111
+ delete("#{client_credentials_path(client_id)}/#{credential_id}")
112
+ end
113
+
76
114
  private
77
115
 
78
116
  # Clients API path
79
117
  def clients_path
80
118
  @clients_path ||= '/api/v2/clients'
81
119
  end
120
+
121
+ def client_credentials_path(client_id)
122
+ "#{clients_path}/#{client_id}/credentials"
123
+ end
82
124
  end
83
125
  end
84
126
  end
@@ -9,25 +9,31 @@ module Auth0
9
9
  # being specified. Accepts a list of fields to include or exclude in the resulting list of connection objects.
10
10
  # @see https://auth0.com/docs/api/management/v2#!/Connections/get_connections
11
11
  # @param strategy [string] Strategy to filter connection results.
12
+ # @param name [string] Name to filter connection results.
12
13
  # @param fields [string] A comma separated list of fields to include or exclude from the result.
13
14
  # @param include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
14
15
  # @param page [int] Page number to get, 0-based.
15
16
  # @param per_page [int] Results per page if also passing a page number.
17
+ # @param include_totals [boolean] True if query totals should be included in the result. Defaults to false.
16
18
  # @return [json] Returns the existing connections matching the strategy.
17
19
  def connections(
18
20
  strategy: nil,
21
+ name: nil,
19
22
  fields: nil,
20
23
  include_fields: nil,
21
24
  page: nil,
22
- per_page: nil
25
+ per_page: nil,
26
+ include_totals: nil
23
27
  )
24
28
  include_fields = true if !fields.nil? && include_fields.nil?
25
29
  request_params = {
26
30
  strategy: strategy,
31
+ name: name,
27
32
  fields: fields.is_a?(Array) ? fields.join(',') : fields,
28
33
  include_fields: include_fields,
29
34
  page: !page.nil? ? page.to_i : nil,
30
- per_page: !page.nil? && !per_page.nil? ? per_page.to_i : nil
35
+ per_page: !page.nil? && !per_page.nil? ? per_page.to_i : nil,
36
+ include_totals: include_totals
31
37
  }
32
38
  get(connections_path, request_params)
33
39
  end
@@ -35,7 +41,7 @@ module Auth0
35
41
 
36
42
  # Creates a new connection according to the JSON object received in body.
37
43
  # @see https://auth0.com/docs/api/v2#!/Connections/post_connections
38
- # @param body [hash] The Hash options used to define the conecctions's properties.
44
+ # @param body [hash] The Hash options used to define the connections's properties.
39
45
  #
40
46
  # @return [json] Returns the created connection.
41
47
  def create_connection(body)
@@ -78,8 +84,11 @@ module Auth0
78
84
  def delete_connection_user(connection_id, user_email)
79
85
  raise Auth0::InvalidParameter, 'Must supply a valid connection id' if connection_id.to_s.empty?
80
86
  raise Auth0::InvalidParameter, 'Must supply a valid user email' if user_email.to_s.empty?
81
- path = "#{connections_path}/#{connection_id}/users?email=#{user_email}"
82
- delete(path)
87
+ path = "#{connections_path}/#{connection_id}/users"
88
+ request_params = {
89
+ email: user_email
90
+ }
91
+ delete(path, request_params)
83
92
  end
84
93
 
85
94
  # Updates a connection. Updates the fields specified in the body parameter.
@@ -1,7 +1,7 @@
1
1
  module Auth0
2
2
  module Api
3
3
  module V2
4
- # Methods to use the device crenditials endpoints
4
+ # Methods to use the device credentials endpoints
5
5
  module DeviceCredentials
6
6
  attr_reader :device_credentials_path
7
7
 
@@ -12,21 +12,26 @@ module Auth0
12
12
  # * :fields [string] A comma separated list of fields to include or exclude from the result.
13
13
  # * :include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
14
14
  # * :user_id [string] The user_id of the devices to retrieve.
15
- # * :type [string] The type of credentials. Possible values: 'public_key' or 'refresh_token'.
15
+ # * :type [string] Type of credentials to retrieve. Must be 'public_key', 'refresh_token' or 'rotating_refresh_token'
16
+ # * :page [integer] The page number. Zero based
17
+ # * :per_page [integer] The amount of entries per page
18
+ # * :include_totals [boolean] Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
16
19
  #
17
20
  # @return [json] Returns the list of existing devices for the specified client_id.
18
21
  # rubocop:disable Metrics/AbcSize
19
- def device_credentials(client_id, options = {})
22
+ def device_credentials(client_id = nil, options = {})
20
23
  request_params = {
21
24
  fields: options.fetch(:fields, nil),
22
25
  include_fields: options.fetch(:include_fields, nil),
23
26
  user_id: options.fetch(:user_id, nil),
24
27
  client_id: client_id,
25
- type: options.fetch(:type, nil)
28
+ type: options.fetch(:type, nil),
29
+ page: options.fetch(:page, nil),
30
+ per_page: options.fetch(:per_page, nil),
31
+ include_totals: options.fetch(:include_totals, nil)
26
32
  }
27
- raise Auth0::InvalidParameter, 'Must supply a valid client_id' if client_id.to_s.empty?
28
- if !request_params[:type].nil? && !%w(public_key refresh_token).include?(request_params[:type])
29
- raise Auth0::InvalidParameter, 'Type must be one of \'public_key\', \'refresh_token\''
33
+ if !request_params[:type].nil? && !%w(public_key refresh_token rotating_refresh_token).include?(request_params[:type])
34
+ raise Auth0::InvalidParameter, 'Type must be one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\''
30
35
  end
31
36
  get(device_credentials_path, request_params)
32
37
  end
@@ -0,0 +1,49 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ module Grants
5
+ attr_reader :grants_path
6
+
7
+ # Retrieve the grants associated with your account.
8
+ # @see https://auth0.com/docs/api/management/v2#!/Grants/get_grants
9
+ # @param client_id [string] The client_id of the grants to retrieve.
10
+ # @param user_id [string] The user_id of the grants to retrieve.
11
+ # @param audience [string] The audience of the grants to retrieve.
12
+ # @param page [int] The page index of the results to return. First page is 0.
13
+ # @param per_page [int] The number of results per page. Paging is disabled if parameter not sent.
14
+ # @param include_totals [boolean] Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).
15
+ # @return [json] Returns the grants.
16
+ def grants(client_id: nil, user_id: nil, audience: nil, page: nil, per_page: nil, include_totals: nil)
17
+ request_params = {
18
+ client_id: client_id,
19
+ user_id: user_id,
20
+ audience: audience,
21
+ page: page,
22
+ per_page: per_page,
23
+ include_totals: include_totals
24
+ }
25
+ get(grants_path, request_params)
26
+ end
27
+ alias get_all_grants grants
28
+
29
+ # Delete a grant associated with your account.
30
+ # @see https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id
31
+ # @param id [string] The id of the grant to delete.
32
+ # @param user_id [string] The user_id of the grant to delete.
33
+ def delete_grant(id, user_id)
34
+ raise Auth0::InvalidParameter, 'Must specify a grant id as id' if id.to_s.empty?
35
+ raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
36
+ path = "#{grants_path}/#{id}"
37
+ delete(path, user_id: user_id)
38
+ end
39
+
40
+ private
41
+
42
+ # Grants API path
43
+ def grants_path
44
+ @grants_path ||= '/api/v2/grants'
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -60,6 +60,9 @@ module Auth0
60
60
  # :format [string] The format of the file. Valid values are: "json" and "csv".
61
61
  # :limit [integer] Limit the number of users to export.
62
62
  # :fields [array] A list of fields to be included in the CSV.
63
+ # This can either be an array of strings representing field names, or an object.
64
+ # If it's a string, it is mapped to the correct { name: '<field name>' } object required by the endpoint.
65
+ # If it's an object, it is passed through as-is to the endpoint.
63
66
  # If omitted, a set of predefined fields will be exported.
64
67
  #
65
68
  # @return [json] Returns the job status and properties.
@@ -78,13 +81,25 @@ module Auth0
78
81
  # @see https://auth0.com/docs/api/management/v2#!/Jobs/post_verification_email
79
82
  # @param user_id [string] The user_id of the user to whom the email will be sent.
80
83
  # @param client_id [string] Client ID to send an Application-specific email.
84
+ # @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
85
+ # * :user_id [string] user_id of the identity.
86
+ # * :provider [string] provider of the identity.
87
+ # @param organization_id [string] organization id
81
88
  #
82
89
  # @return [json] Returns the job status and properties.
83
- def send_verification_email(user_id, client_id = nil)
90
+ def send_verification_email(user_id, client_id = nil, identity: nil, organization_id: nil)
84
91
  raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
85
92
 
86
93
  request_params = { user_id: user_id }
87
94
  request_params[:client_id] = client_id unless client_id.nil?
95
+ request_params[:organization_id] = organization_id unless organization_id.nil?
96
+
97
+ if identity
98
+ unless identity.is_a? Hash
99
+ raise Auth0::InvalidParameter, 'Identity must be a hash send an email verification'
100
+ end
101
+ request_params[:identity] = identity
102
+ end
88
103
 
89
104
  path = "#{jobs_path}/verification-email"
90
105
  post(path, request_params)
@@ -97,14 +112,22 @@ module Auth0
97
112
  @jobs_path ||= '/api/v2/jobs'
98
113
  end
99
114
 
100
- # Map array of field names for export to array of objects
101
- # @param fields [array] Field names to be included in the export
102
-
115
+ # Map array of fields for export to array of objects
116
+ # @param fields [array] Fields to be included in the export
117
+ # This can either be an array of strings representing field names, or an object.
118
+ # If it's a string, it is mapped to the correct { name: '<field name>' } object required by the endpoint.
119
+ # If it's an object, it is passed through as-is to the endpoint.
103
120
  # @return [array] Returns the fields mapped as array of objects for the export_users endpoint
104
121
  def fields_for_export(fields)
105
122
  return nil if fields.to_s.empty?
106
123
 
107
- fields.map { |field| { name: field } }
124
+ fields.map { |field|
125
+ if field.is_a? String
126
+ { name: field }
127
+ else
128
+ field
129
+ end
130
+ }
108
131
  end
109
132
  end
110
133
  end