auth0 4.17.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.
- checksums.yaml +4 -4
- data/.version +1 -0
- data/CHANGELOG.md +407 -22
- data/README.md +80 -178
- data/auth0.gemspec +10 -15
- data/lib/auth0/api/authentication_endpoints.rb +162 -249
- data/lib/auth0/api/v2/actions.rb +209 -0
- data/lib/auth0/api/v2/attack_protection.rb +79 -0
- data/lib/auth0/api/v2/branding.rb +65 -0
- data/lib/auth0/api/v2/client_grants.rb +27 -2
- data/lib/auth0/api/v2/clients.rb +42 -0
- data/lib/auth0/api/v2/connections.rb +14 -5
- data/lib/auth0/api/v2/device_credentials.rb +12 -7
- data/lib/auth0/api/v2/grants.rb +49 -0
- data/lib/auth0/api/v2/jobs.rb +18 -5
- data/lib/auth0/api/v2/logs.rb +2 -2
- data/lib/auth0/api/v2/organizations.rb +407 -0
- data/lib/auth0/api/v2/refresh_tokens.rb +34 -0
- data/lib/auth0/api/v2/roles.rb +7 -3
- data/lib/auth0/api/v2/sessions.rb +43 -0
- data/lib/auth0/api/v2/tickets.rb +14 -2
- data/lib/auth0/api/v2/users.rb +203 -12
- data/lib/auth0/api/v2.rb +18 -4
- data/lib/auth0/client_assertion.rb +45 -0
- data/lib/auth0/exception.rb +17 -8
- data/lib/auth0/mixins/access_token_struct.rb +2 -2
- data/lib/auth0/mixins/api_token_struct.rb +2 -3
- data/lib/auth0/mixins/httpproxy.rb +98 -36
- data/lib/auth0/mixins/initializer.rb +6 -9
- data/lib/auth0/mixins/permission_struct.rb +2 -2
- data/lib/auth0/mixins/token_management.rb +35 -0
- data/lib/auth0/mixins/validation.rb +33 -6
- data/lib/auth0/mixins.rb +2 -1
- data/lib/auth0/version.rb +1 -1
- metadata +58 -632
- data/.bundle/config +0 -4
- data/.circleci/config.yml +0 -23
- data/.env.example +0 -2
- data/.gemrelease +0 -2
- data/.github/CODEOWNERS +0 -1
- data/.github/ISSUE_TEMPLATE.md +0 -39
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -35
- data/.github/stale.yml +0 -20
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/.rubocop.yml +0 -10
- data/.rubocop_todo.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -3
- data/DEPLOYMENT.md +0 -61
- data/Dockerfile +0 -5
- data/Gemfile +0 -19
- data/Gemfile.lock +0 -227
- data/Guardfile +0 -37
- data/RUBYGEM.md +0 -9
- data/Rakefile +0 -53
- data/codecov.yml +0 -22
- data/deploy_documentation.sh +0 -29
- data/doc_config/templates/default/fulldoc/html/css/full_list.css +0 -79
- data/doc_config/templates/default/fulldoc/html/css/style.css +0 -546
- data/doc_config/templates/default/layout/html/breadcrumb.erb +0 -11
- data/doc_config/templates/default/layout/html/footer.erb +0 -115
- data/doc_config/templates/default/layout/html/headers.erb +0 -17
- data/doc_config/templates/default/layout/html/layout.erb +0 -27
- data/examples/ruby-api/.env.example +0 -2
- data/examples/ruby-api/.gitignore +0 -86
- data/examples/ruby-api/Gemfile +0 -8
- data/examples/ruby-api/README.md +0 -24
- data/examples/ruby-api/config.ru +0 -2
- data/examples/ruby-api/main.rb +0 -33
- data/examples/ruby-on-rails-api/.env.example +0 -2
- data/examples/ruby-on-rails-api/.gitignore +0 -18
- data/examples/ruby-on-rails-api/Gemfile +0 -48
- data/examples/ruby-on-rails-api/README.md +0 -27
- data/examples/ruby-on-rails-api/Rakefile +0 -6
- data/examples/ruby-on-rails-api/app/assets/images/.keep +0 -0
- data/examples/ruby-on-rails-api/app/assets/javascripts/application.js +0 -16
- data/examples/ruby-on-rails-api/app/assets/stylesheets/application.css +0 -15
- data/examples/ruby-on-rails-api/app/controllers/application_controller.rb +0 -8
- data/examples/ruby-on-rails-api/app/controllers/concerns/.keep +0 -0
- data/examples/ruby-on-rails-api/app/controllers/ping_controller.rb +0 -6
- data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +0 -11
- data/examples/ruby-on-rails-api/app/helpers/application_helper.rb +0 -3
- data/examples/ruby-on-rails-api/app/mailers/.keep +0 -0
- data/examples/ruby-on-rails-api/app/models/.keep +0 -0
- data/examples/ruby-on-rails-api/app/models/User.rb +0 -5
- data/examples/ruby-on-rails-api/app/models/concerns/.keep +0 -0
- data/examples/ruby-on-rails-api/app/views/layouts/application.html.erb +0 -14
- data/examples/ruby-on-rails-api/bin/bundle +0 -3
- data/examples/ruby-on-rails-api/bin/rails +0 -4
- data/examples/ruby-on-rails-api/bin/rake +0 -4
- data/examples/ruby-on-rails-api/bin/setup +0 -29
- data/examples/ruby-on-rails-api/config/application.rb +0 -23
- data/examples/ruby-on-rails-api/config/boot.rb +0 -4
- data/examples/ruby-on-rails-api/config/database.yml +0 -27
- data/examples/ruby-on-rails-api/config/environment.rb +0 -5
- data/examples/ruby-on-rails-api/config/environments/development.rb +0 -37
- data/examples/ruby-on-rails-api/config/environments/production.rb +0 -83
- data/examples/ruby-on-rails-api/config/environments/test.rb +0 -41
- data/examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb +0 -7
- data/examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb +0 -3
- data/examples/ruby-on-rails-api/config/initializers/dotenv.rb +0 -4
- data/examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb +0 -4
- data/examples/ruby-on-rails-api/config/initializers/inflections.rb +0 -16
- data/examples/ruby-on-rails-api/config/initializers/knock.rb +0 -35
- data/examples/ruby-on-rails-api/config/initializers/mime_types.rb +0 -4
- data/examples/ruby-on-rails-api/config/initializers/session_store.rb +0 -3
- data/examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb +0 -14
- data/examples/ruby-on-rails-api/config/locales/en.yml +0 -23
- data/examples/ruby-on-rails-api/config/routes.rb +0 -58
- data/examples/ruby-on-rails-api/config/secrets.yml +0 -28
- data/examples/ruby-on-rails-api/config.ru +0 -4
- data/examples/ruby-on-rails-api/db/schema.rb +0 -15
- data/examples/ruby-on-rails-api/db/seeds.rb +0 -7
- data/examples/ruby-on-rails-api/lib/assets/.keep +0 -0
- data/examples/ruby-on-rails-api/lib/tasks/.keep +0 -0
- data/examples/ruby-on-rails-api/log/.keep +0 -0
- data/examples/ruby-on-rails-api/public/404.html +0 -67
- data/examples/ruby-on-rails-api/public/422.html +0 -67
- data/examples/ruby-on-rails-api/public/500.html +0 -66
- data/examples/ruby-on-rails-api/public/favicon.ico +0 -0
- data/examples/ruby-on-rails-api/public/robots.txt +0 -5
- data/examples/ruby-on-rails-api/test/controllers/.keep +0 -0
- data/examples/ruby-on-rails-api/test/fixtures/.keep +0 -0
- data/examples/ruby-on-rails-api/test/helpers/.keep +0 -0
- data/examples/ruby-on-rails-api/test/integration/.keep +0 -0
- data/examples/ruby-on-rails-api/test/mailers/.keep +0 -0
- data/examples/ruby-on-rails-api/test/models/.keep +0 -0
- data/examples/ruby-on-rails-api/test/ping_controller_test.rb +0 -8
- data/examples/ruby-on-rails-api/test/secured_ping_controller_test.rb +0 -26
- data/examples/ruby-on-rails-api/test/test_helper.rb +0 -16
- data/lib/auth0/api/v1/clients.rb +0 -58
- data/lib/auth0/api/v1/connections.rb +0 -68
- data/lib/auth0/api/v1/logs.rb +0 -43
- data/lib/auth0/api/v1/rules.rb +0 -57
- data/lib/auth0/api/v1/users.rb +0 -227
- data/lib/auth0/api/v1.rb +0 -19
- data/publish_rubygem.sh +0 -10
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_change_password/should_trigger_a_password_reset.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_email.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_password.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_invalid_audience.yml +0 -55
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_custom_audience.yml +0 -117
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_default_scope.yml +0 -119
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_saml_metadata/should_retrieve_SAML_metadata.yml +0 -57
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_fail_as_not_authorized.yml +0 -55
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_return_the_userinfo.yml +0 -118
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_wsfed_metadata/should_retrieve_WSFED_metadata.yml +0 -55
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/create_test_user.yml +0 -58
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/delete_test_user.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_check_if_ip_is_blocked/should_return_200_response_code.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_remove_ip_block/should_remove_an_IP_successfully.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_add_token_to_blacklist/should_add_a_token_to_the_blacklist.yml +0 -56
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_blacklisted_tokens/should_get_the_added_token_from_the_blacklist.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_at_least_1_result.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_first_page_of_one_result.yml +0 -66
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_test_client_grant.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_delete_client_grant/should_delete_the_test_client_grant.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_patch_client_grant/should_update_the_test_client_grant.yml +0 -64
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client.yml +0 -118
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client_grant.yml +0 -64
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client_grant.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_exclude_and_include_fields_properly.yml +0 -91
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_include_the_specified_fields.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/should_get_the_test_client.yml +0 -92
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_fields_not_specified.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_the_specified_fields.yml +0 -132
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_include_the_specified_fields.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_paginate_results.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/should_get_at_least_one_client.yml +0 -132
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_delete_client/should_delete_the_test_client_without_an_error.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_patch_client/should_update_the_client_with_the_correct_attributes.yml +0 -94
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/create_test_client.yml +0 -118
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +0 -110
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +0 -66
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_user.yml +0 -68
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_delete_device_credential/should_delete_the_test_credential_without_an_error.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/_filter_by_type/should_exclude_the_test_credential.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_have_at_least_1_entry.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_include_the_test_credential.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_credential.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_user.yml +0 -68
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_credential.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_user.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_configure_provider/should_configure_a_new_email_provider.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_delete_the_existing_email_provider_without_an_error.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_throw_an_error_trying_to_get_the_email_provider.yml +0 -51
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_with_specific_fields.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_without_specific_fields.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/should_get_the_existing_email_provider.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_update_provider/should_update_the_existing_email_provider.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/delete_existing_provider.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_create_an_export_users_job_successfully.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_get_the_export_users_job.yml +0 -117
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_create_an_import_users_job_successfully.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_get_the_import_users_job.yml +0 -116
- 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
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_get_the_completed_verification_email.yml +0 -175
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_reject_an_invalid_client_id.yml +0 -109
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/delete_imported_user.yml +0 -110
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/search_for_connection_id.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_match_the_created_log_entry.yml +0 -265
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_not_be_empty.yml +0 -265
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_fields_not_specified.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_the_specified_fields.yml +0 -75
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_have_one_log_entry.yml +0 -76
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_include_the_specified_fields.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_from/should_take_one_log_entry.yml +0 -258
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/create_test_user.yml +0 -68
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_disabled_rule.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_enabled_rule.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_user.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_delete_resource_server/should_delete_the_test_server_without_an_error.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_patch_resource_server/should_update_the_resource_server_with_the_correct_attributes.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_server/should_get_the_test_server.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_get_the_test_server.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_at_least_1_result.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_the_first_page_of_one_result.yml +0 -64
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/create_test_server.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/delete_test_server.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_permissions/should_add_a_Permission_to_the_Role_successfully.yml +0 -69
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_users/should_add_a_User_to_the_Role_successfully.yml +0 -69
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_delete_role/should_delete_the_Role_successfully.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role/should_get_the_Role_successfully.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_exactly_1_Permission.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_the_added_Permission_from_the_Role_successfully.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_exactly_1_User.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_the_added_User_from_the_Role_successfully.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_roles/should_get_the_Role_successfully.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_remove_role_permissions/should_remove_a_Permission_from_the_Role_successfully.yml +0 -64
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_update_role/should_update_the_Role_successfully.yml +0 -69
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_api.yml +0 -69
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_role.yml +0 -69
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_user.yml +0 -69
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_api.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_user.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_disabled_rule_without_an_error.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_enabled_rule_without_an_error.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_fields_not_specified.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_specified_fields.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_include_the_specified_fields.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/should_get_a_specific_rule.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_exclude_fields_not_specified.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_include_the_specified_fields.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_disabled_rule.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_enabled_rule.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_paginated_results.yml +0 -128
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/should_return_at_least_1_rule.yml +0 -64
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_update_rule/should_update_the_disabled_rule_to_be_enabled.yml +0 -64
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_disabled_rule.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_enabled_rule.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_active_users/should_have_at_least_one_active_user.yml +0 -59
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_daily_stats/should_have_at_least_one_stats_entry_for_the_timeframe.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings/should_get_the_tenant_settings.yml +0 -95
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_exclude_a_field_not_requested.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_include_the_field_requested.yml +0 -61
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_revert_the_tenant_name.yml +0 -96
- 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
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_email_verification/should_create_an_email_verification_ticket.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_password_change/should_create_a_password_change_ticket.yml +0 -63
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/create_test_user.yml +0 -68
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/delete_test_user.yml +0 -54
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_permissions/should_add_a_Permissions_for_a_User_successfully.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_roles/should_add_a_Role_to_a_User_successfully.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_User_successfully.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_secondary_User_successfully.yml +0 -60
- 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
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_enrollments/should_get_Enrollments_for_a_User_successfully.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_exactly_1_Permission_for_a_User_successfully.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_the_correct_Permission_for_a_User_successfully.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_roles/should_get_Roles_for_a_User_successfully.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_invalidate_browsers/should_invalidate_MFA_browsers_for_the_User_successfully.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_link_user_account/should_link_two_Users_successfully.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_patch_user/should_patch_the_User_successfully.yml +0 -68
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_permissions/should_remove_a_Permission_from_a_User_successfully.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_roles/should_remove_a_Role_from_a_User_successfully.yml +0 -62
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_unlink_user_account/should_unlink_two_Users_successfully.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_fields_not_indicated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_the_fields_indicated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_include_the_fields_indicated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/should_retrieve_the_created_user.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user_logs/should_get_Logs_for_a_User_successfully.yml +0 -69
- 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
- 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
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_exclude_the_indicated_fields_when_paginated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_include_the_indicated_fields_when_paginated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_not_include_other_fields_when_paginated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_return_the_correct_number_of_results_when_paginated.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/should_have_at_least_one_user.yml +0 -65
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_secondary_test_user.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_api.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_role.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_user.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_api.yml +0 -60
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_role.yml +0 -60
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +0 -120
- data/spec/integration/lib/auth0/api/v2/api_anomaly_spec.rb +0 -17
- data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +0 -27
- data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +0 -75
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +0 -166
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +0 -159
- data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +0 -128
- data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +0 -117
- data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +0 -124
- data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +0 -91
- data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +0 -130
- data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +0 -145
- data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +0 -177
- data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +0 -22
- data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +0 -59
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +0 -59
- data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +0 -73
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +0 -300
- data/spec/integration/lib/auth0/auth0_client_spec.rb +0 -90
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +0 -703
- data/spec/lib/auth0/api/v2/anomaly_spec.rb +0 -26
- data/spec/lib/auth0/api/v2/blacklists_spec.rb +0 -25
- data/spec/lib/auth0/api/v2/client_grants_spec.rb +0 -76
- data/spec/lib/auth0/api/v2/clients_spec.rb +0 -104
- data/spec/lib/auth0/api/v2/connections_spec.rb +0 -140
- data/spec/lib/auth0/api/v2/device_credentials_spec.rb +0 -73
- data/spec/lib/auth0/api/v2/emails_spec.rb +0 -47
- data/spec/lib/auth0/api/v2/guardian_spec.rb +0 -154
- data/spec/lib/auth0/api/v2/jobs_spec.rb +0 -128
- data/spec/lib/auth0/api/v2/log_streams_spec.rb +0 -84
- data/spec/lib/auth0/api/v2/logs_spec.rb +0 -48
- data/spec/lib/auth0/api/v2/prompts_spec.rb +0 -88
- data/spec/lib/auth0/api/v2/resource_servers_spec.rb +0 -86
- data/spec/lib/auth0/api/v2/roles_spec.rb +0 -362
- data/spec/lib/auth0/api/v2/rules_spec.rb +0 -95
- data/spec/lib/auth0/api/v2/stats_spec.rb +0 -22
- data/spec/lib/auth0/api/v2/tenants_spec.rb +0 -26
- data/spec/lib/auth0/api/v2/tickets_spec.rb +0 -63
- data/spec/lib/auth0/api/v2/user_blocks_spec.rb +0 -52
- data/spec/lib/auth0/api/v2/users_by_email_spec.rb +0 -21
- data/spec/lib/auth0/api/v2/users_spec.rb +0 -542
- data/spec/lib/auth0/client_spec.rb +0 -153
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +0 -304
- data/spec/lib/auth0/mixins/initializer_spec.rb +0 -30
- data/spec/lib/auth0/mixins/validation_spec.rb +0 -466
- data/spec/spec_helper.rb +0 -63
- data/spec/support/credentials.rb +0 -30
- data/spec/support/dummy_class.rb +0 -18
- data/spec/support/dummy_class_for_proxy.rb +0 -5
- data/spec/support/dummy_class_for_restclient.rb +0 -2
- data/spec/support/import_users.json +0 -13
- 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
|
data/lib/auth0/api/v2/clients.rb
CHANGED
|
@@ -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
|
|
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
|
|
82
|
-
|
|
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
|
|
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]
|
|
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
|
-
|
|
28
|
-
|
|
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
|
data/lib/auth0/api/v2/jobs.rb
CHANGED
|
@@ -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.
|
|
@@ -81,13 +84,15 @@ module Auth0
|
|
|
81
84
|
# @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
|
|
82
85
|
# * :user_id [string] user_id of the identity.
|
|
83
86
|
# * :provider [string] provider of the identity.
|
|
87
|
+
# @param organization_id [string] organization id
|
|
84
88
|
#
|
|
85
89
|
# @return [json] Returns the job status and properties.
|
|
86
|
-
def send_verification_email(user_id, client_id = nil, identity: nil)
|
|
90
|
+
def send_verification_email(user_id, client_id = nil, identity: nil, organization_id: nil)
|
|
87
91
|
raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
|
|
88
92
|
|
|
89
93
|
request_params = { user_id: user_id }
|
|
90
94
|
request_params[:client_id] = client_id unless client_id.nil?
|
|
95
|
+
request_params[:organization_id] = organization_id unless organization_id.nil?
|
|
91
96
|
|
|
92
97
|
if identity
|
|
93
98
|
unless identity.is_a? Hash
|
|
@@ -107,14 +112,22 @@ module Auth0
|
|
|
107
112
|
@jobs_path ||= '/api/v2/jobs'
|
|
108
113
|
end
|
|
109
114
|
|
|
110
|
-
# Map array of
|
|
111
|
-
# @param fields [array]
|
|
112
|
-
|
|
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.
|
|
113
120
|
# @return [array] Returns the fields mapped as array of objects for the export_users endpoint
|
|
114
121
|
def fields_for_export(fields)
|
|
115
122
|
return nil if fields.to_s.empty?
|
|
116
123
|
|
|
117
|
-
fields.map { |field|
|
|
124
|
+
fields.map { |field|
|
|
125
|
+
if field.is_a? String
|
|
126
|
+
{ name: field }
|
|
127
|
+
else
|
|
128
|
+
field
|
|
129
|
+
end
|
|
130
|
+
}
|
|
118
131
|
end
|
|
119
132
|
end
|
|
120
133
|
end
|