auth0 4.4.0 → 5.1.2
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/.bundle/config +3 -2
- data/.circleci/config.yml +44 -0
- data/.env.example +2 -0
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/config.yml +8 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +39 -0
- data/.github/ISSUE_TEMPLATE/report_a_bug.md +55 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +35 -0
- data/.github/stale.yml +20 -0
- data/.gitignore +1 -2
- data/.rubocop.yml +2 -0
- data/.yardoc/checksums +22 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/CHANGELOG.md +334 -19
- data/CODE_OF_CONDUCT.md +3 -0
- data/DEPLOYMENT.md +56 -9
- data/Gemfile +10 -3
- data/README.md +260 -37
- data/Rakefile +4 -23
- data/auth0.gemspec +10 -9
- data/codecov.yml +22 -0
- data/examples/ruby-api/.gitignore +0 -6
- data/lib/auth0/algorithm.rb +5 -0
- data/lib/auth0/api/authentication_endpoints.rb +244 -237
- data/lib/auth0/api/v2/anomaly.rb +36 -0
- data/lib/auth0/api/v2/branding.rb +66 -0
- data/lib/auth0/api/v2/client_grants.rb +14 -5
- data/lib/auth0/api/v2/clients.rb +9 -6
- data/lib/auth0/api/v2/connections.rb +19 -7
- data/lib/auth0/api/v2/device_credentials.rb +5 -4
- data/lib/auth0/api/v2/guardian.rb +142 -0
- data/lib/auth0/api/v2/jobs.rb +77 -13
- data/lib/auth0/api/v2/log_streams.rb +78 -0
- data/lib/auth0/api/v2/logs.rb +11 -11
- data/lib/auth0/api/v2/organizations.rb +335 -0
- data/lib/auth0/api/v2/prompts.rb +70 -0
- data/lib/auth0/api/v2/resource_servers.rb +32 -8
- data/lib/auth0/api/v2/roles.rb +172 -0
- data/lib/auth0/api/v2/rules.rb +6 -2
- data/lib/auth0/api/v2/tickets.rb +55 -8
- data/lib/auth0/api/v2/users.rb +168 -28
- data/lib/auth0/api/v2/users_by_email.rb +3 -2
- data/lib/auth0/api/v2.rb +16 -2
- data/lib/auth0/client.rb +1 -1
- data/lib/auth0/exception.rb +34 -9
- data/lib/auth0/mixins/access_token_struct.rb +20 -0
- data/lib/auth0/mixins/api_token_struct.rb +10 -0
- data/lib/auth0/mixins/headers.rb +35 -0
- data/lib/auth0/mixins/httpproxy.rb +37 -14
- data/lib/auth0/mixins/initializer.rb +10 -26
- data/lib/auth0/mixins/permission_struct.rb +3 -0
- data/lib/auth0/mixins/validation.rb +346 -0
- data/lib/auth0/mixins.rb +9 -1
- data/lib/auth0/version.rb +1 -1
- data/lib/auth0.rb +1 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_change_password/should_trigger_a_password_reset.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_email.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_password.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_invalid_audience.yml +55 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_custom_audience.yml +117 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_login_successfully_with_a_default_scope.yml +119 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_saml_metadata/should_retrieve_SAML_metadata.yml +57 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_fail_as_not_authorized.yml +55 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_userinfo/should_return_the_userinfo.yml +118 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_wsfed_metadata/should_retrieve_WSFED_metadata.yml +55 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/create_test_user.yml +58 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/delete_test_user.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_check_if_ip_is_blocked/should_return_200_response_code.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Anomaly/_remove_ip_block/should_remove_an_IP_successfully.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_add_token_to_blacklist/should_add_a_token_to_the_blacklist.yml +56 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_blacklisted_tokens/should_get_the_added_token_from_the_blacklist.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_at_least_1_result.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_first_page_of_one_result.yml +66 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_client_grants/should_return_the_test_client_grant.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_delete_client_grant/should_delete_the_test_client_grant.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_patch_client_grant/should_update_the_test_client_grant.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client.yml +118 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/create_test_client_grant.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client_grant.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_exclude_and_include_fields_properly.yml +91 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/_filters/should_include_the_specified_fields.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_client/should_get_the_test_client.yml +92 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_fields_not_specified.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_exclude_the_specified_fields.yml +132 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_include_the_specified_fields.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/_filters/should_paginate_results.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_clients/should_get_at_least_one_client.yml +132 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_delete_client/should_delete_the_test_client_without_an_error.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_patch_client/should_update_the_client_with_the_correct_attributes.yml +94 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/create_test_client.yml +118 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +110 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +66 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_user.yml +68 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_delete_device_credential/should_delete_the_test_credential_without_an_error.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/_filter_by_type/should_exclude_the_test_credential.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_have_at_least_1_entry.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/_device_credentials/should_include_the_test_credential.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_credential.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/create_test_user.yml +68 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_credential.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_user.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_configure_provider/should_configure_a_new_email_provider.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_delete_the_existing_email_provider_without_an_error.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_throw_an_error_trying_to_get_the_email_provider.yml +51 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_with_specific_fields.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_without_specific_fields.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/should_get_the_existing_email_provider.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_update_provider/should_update_the_existing_email_provider.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/delete_existing_provider.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_create_an_export_users_job_successfully.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_export_users_and_get_job/should_get_the_export_users_job.yml +117 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_create_an_import_users_job_successfully.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_import_users_and_get_job/should_get_the_import_users_job.yml +116 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_create_a_new_verification_email_job.yml +119 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_get_the_completed_verification_email.yml +175 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/_send_verification_email_and_get_job/should_reject_an_invalid_client_id.yml +109 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/delete_imported_user.yml +110 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Jobs/search_for_connection_id.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_match_the_created_log_entry.yml +265 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_log/should_not_be_empty.yml +265 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_fields_not_specified.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_the_specified_fields.yml +75 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_have_one_log_entry.yml +76 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_include_the_specified_fields.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_from/should_take_one_log_entry.yml +258 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/create_test_user.yml +68 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_disabled_rule.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_enabled_rule.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_user.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_delete_resource_server/should_delete_the_test_server_without_an_error.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_patch_resource_server/should_update_the_resource_server_with_the_correct_attributes.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_server/should_get_the_test_server.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_get_the_test_server.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_at_least_1_result.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_resource_servers/should_return_the_first_page_of_one_result.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/create_test_server.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/delete_test_server.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_permissions/should_add_a_Permission_to_the_Role_successfully.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_add_role_users/should_add_a_User_to_the_Role_successfully.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_delete_role/should_delete_the_Role_successfully.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role/should_get_the_Role_successfully.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_exactly_1_Permission.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_permissions/should_get_the_added_Permission_from_the_Role_successfully.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_exactly_1_User.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_role_users/should_get_the_added_User_from_the_Role_successfully.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_roles/should_get_the_Role_successfully.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_remove_role_permissions/should_remove_a_Permission_from_the_Role_successfully.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_update_role/should_update_the_Role_successfully.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_api.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_role.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/create_test_user.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_api.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_user.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_disabled_rule_without_an_error.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_enabled_rule_without_an_error.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_fields_not_specified.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_exclude_the_specified_fields.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/_filters/should_include_the_specified_fields.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rule/should_get_a_specific_rule.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_exclude_fields_not_specified.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_include_the_specified_fields.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_disabled_rule.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_at_least_1_enabled_rule.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/_filters/should_return_paginated_results.yml +128 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_rules/should_return_at_least_1_rule.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_update_rule/should_update_the_disabled_rule_to_be_enabled.yml +64 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_disabled_rule.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/create_test_enabled_rule.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_active_users/should_have_at_least_one_active_user.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_daily_stats/should_have_at_least_one_stats_entry_for_the_timeframe.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings/should_get_the_tenant_settings.yml +95 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_exclude_a_field_not_requested.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_get_tenant_settings_with_specific_fields/should_include_the_field_requested.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_revert_the_tenant_name.yml +96 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tenants/_update_tenant_settings/should_update_the_tenant_settings_with_a_new_tenant_name.yml +96 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_email_verification/should_create_an_email_verification_ticket.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/_post_password_change/should_create_a_password_change_ticket.yml +63 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/create_test_user.yml +68 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/delete_test_user.yml +54 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_permissions/should_add_a_Permissions_for_a_User_successfully.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_roles/should_add_a_Role_to_a_User_successfully.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_User_successfully.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_secondary_User_successfully.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user_provider/should_attempt_to_delete_the_MFA_provider_for_the_User.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_enrollments/should_get_Enrollments_for_a_User_successfully.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_exactly_1_Permission_for_a_User_successfully.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_the_correct_Permission_for_a_User_successfully.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_roles/should_get_Roles_for_a_User_successfully.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_invalidate_browsers/should_invalidate_MFA_browsers_for_the_User_successfully.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_link_user_account/should_link_two_Users_successfully.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_patch_user/should_patch_the_User_successfully.yml +68 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_permissions/should_remove_a_Permission_from_a_User_successfully.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_roles/should_remove_a_Role_from_a_User_successfully.yml +62 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_unlink_user_account/should_unlink_two_Users_successfully.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_fields_not_indicated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_exclude_the_fields_indicated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/_filters/should_include_the_fields_indicated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user/should_retrieve_the_created_user.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_user_logs/should_get_Logs_for_a_User_successfully.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/is_expected_to_find_a_user_with_a_v2_search_engine_query.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/is_expected_to_find_a_user_with_a_v3_search_engine_query.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_exclude_the_indicated_fields_when_paginated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_include_the_indicated_fields_when_paginated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_not_include_other_fields_when_paginated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_return_the_correct_number_of_results_when_paginated.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/should_have_at_least_one_user.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_secondary_test_user.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_api.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_role.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/create_test_user.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_api.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_role.yml +60 -0
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +96 -54
- data/spec/integration/lib/auth0/api/v2/api_anomaly_spec.rb +17 -0
- data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +18 -5
- data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +46 -33
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +115 -61
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +117 -103
- data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +101 -58
- data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +72 -77
- data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +113 -60
- data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +46 -38
- data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +110 -40
- data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +145 -0
- data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +119 -62
- data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +11 -14
- data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +40 -34
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +42 -28
- data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +252 -120
- data/spec/integration/lib/auth0/auth0_client_spec.rb +32 -26
- data/spec/lib/auth0/api/v2/anomaly_spec.rb +26 -0
- data/spec/lib/auth0/api/v2/branding_spec.rb +70 -0
- data/spec/lib/auth0/api/v2/client_grants_spec.rb +34 -2
- data/spec/lib/auth0/api/v2/clients_spec.rb +50 -5
- data/spec/lib/auth0/api/v2/connections_spec.rb +49 -1
- data/spec/lib/auth0/api/v2/guardian_spec.rb +154 -0
- data/spec/lib/auth0/api/v2/jobs_spec.rb +109 -6
- data/spec/lib/auth0/api/v2/log_streams_spec.rb +84 -0
- data/spec/lib/auth0/api/v2/organizations_spec.rb +593 -0
- data/spec/lib/auth0/api/v2/prompts_spec.rb +88 -0
- data/spec/lib/auth0/api/v2/resource_servers_spec.rb +23 -0
- data/spec/lib/auth0/api/v2/roles_spec.rb +362 -0
- data/spec/lib/auth0/api/v2/rules_spec.rb +23 -1
- data/spec/lib/auth0/api/v2/tickets_spec.rb +95 -5
- data/spec/lib/auth0/api/v2/users_spec.rb +465 -61
- data/spec/lib/auth0/client_spec.rb +196 -18
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +83 -4
- data/spec/lib/auth0/mixins/initializer_spec.rb +1 -0
- data/spec/lib/auth0/mixins/validation_spec.rb +498 -0
- data/spec/spec_helper.rb +54 -11
- data/spec/support/credentials.rb +6 -18
- data/spec/support/dummy_class.rb +7 -3
- data/spec/support/dummy_class_for_proxy.rb +1 -0
- data/spec/support/stub_response.rb +1 -1
- metadata +497 -53
- data/.travis.yml +0 -18
- data/build_travis.sh +0 -7
- 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/lib/auth0/api/v1/clients.rb +0 -48
- data/lib/auth0/api/v1/connections.rb +0 -53
- data/lib/auth0/api/v1/logs.rb +0 -34
- data/lib/auth0/api/v1/rules.rb +0 -45
- data/lib/auth0/api/v1/users.rb +0 -164
- data/lib/auth0/api/v1.rb +0 -19
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +0 -348
- data/spec/spec_helper_full.rb +0 -45
- data/spec/spec_helper_unit.rb +0 -3
@@ -0,0 +1,66 @@
|
|
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
|
+
# @param rule_id [string] The id of the rule to delete.
|
39
|
+
def delete_branding_templates_for_universal_login
|
40
|
+
delete(templates_path)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Set template for New Universal Login Experience
|
44
|
+
# @see https://auth0.com/docs/api/management/v2/#!/Branding/put_universal_login
|
45
|
+
# @param body [hash] the branding settings to update
|
46
|
+
#
|
47
|
+
# @return [json] Returns branding settings.
|
48
|
+
def put_branding_templates_for_universal_login(body = {})
|
49
|
+
put(templates_path, body)
|
50
|
+
end
|
51
|
+
alias set_branding_templates_for_universal_login put_branding_templates_for_universal_login
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# Branding API path
|
56
|
+
def branding_path
|
57
|
+
@branding_path ||= '/api/v2/branding'
|
58
|
+
end
|
59
|
+
|
60
|
+
def templates_path
|
61
|
+
@templates_path ||= "#{branding_path}/templates/universal-login"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -7,10 +7,19 @@ module Auth0
|
|
7
7
|
|
8
8
|
# Retrieves a list of all client grants.
|
9
9
|
# @see https://auth0.com/docs/api/management/v2#!/client_grants/get_client_grants
|
10
|
-
#
|
10
|
+
# @param client_id [string] The client_id of the client grant to retrieve.
|
11
|
+
# @param audience [string] The audience of the client grant to retrieve.
|
12
|
+
# @param page [int] Page number to get, 0-based.
|
13
|
+
# @param per_page [int] Results per page if also passing a page number.
|
11
14
|
# @return [json] Returns the client grants.
|
12
|
-
def client_grants
|
13
|
-
|
15
|
+
def client_grants (client_id: nil, audience: nil, page: nil, per_page: nil)
|
16
|
+
request_params = {
|
17
|
+
client_id: client_id,
|
18
|
+
audience: audience,
|
19
|
+
page: page,
|
20
|
+
per_page: per_page
|
21
|
+
}
|
22
|
+
get(client_grants_path, request_params)
|
14
23
|
end
|
15
24
|
alias get_all_client_grants client_grants
|
16
25
|
|
@@ -26,7 +35,7 @@ module Auth0
|
|
26
35
|
|
27
36
|
# Deletes a client grant given its id.
|
28
37
|
# @see https://auth0.com/docs/api/management/v2#!/client_grants/delete_client_grants_by_id
|
29
|
-
# @param
|
38
|
+
# @param client_grant_id [string] The id of the client grant to delete.
|
30
39
|
def delete_client_grant(client_grant_id)
|
31
40
|
raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty?
|
32
41
|
path = "#{client_grants_path}/#{client_grant_id}"
|
@@ -35,7 +44,7 @@ module Auth0
|
|
35
44
|
|
36
45
|
# Updates a client grant.
|
37
46
|
# @see https://auth0.com/docs/api/management/v2#!/client_grants/patch_client_grants_by_id
|
38
|
-
# @param
|
47
|
+
# @param client_grant_id [string] The id of the client grant to update.
|
39
48
|
# @param options [hash] The Hash options used to define the client grant's properties.
|
40
49
|
def patch_client_grant(client_grant_id, options)
|
41
50
|
raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty?
|
data/lib/auth0/api/v2/clients.rb
CHANGED
@@ -6,16 +6,19 @@ module Auth0
|
|
6
6
|
attr_reader :clients_path
|
7
7
|
|
8
8
|
# Retrieves a list of all client applications. Accepts a list of fields to include or exclude.
|
9
|
-
# @see https://auth0.com/docs/api/v2#!/
|
10
|
-
# @param fields [string] A comma separated list
|
9
|
+
# @see https://auth0.com/docs/api/management/v2#!/Clients/get_clients
|
10
|
+
# @param fields [string|Array] A comma separated list or an array of fields.
|
11
11
|
# @param include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
|
12
|
-
#
|
12
|
+
# @param page [int] Page number to get, 0-based.
|
13
|
+
# @param per_page [int] Results per page if also passing a page number.
|
13
14
|
# @return [json] Returns the clients applications.
|
14
|
-
def clients(fields: nil, include_fields: nil)
|
15
|
+
def clients(fields: nil, include_fields: nil, page: nil, per_page: nil)
|
15
16
|
include_fields = true if !fields.nil? && include_fields.nil?
|
16
17
|
request_params = {
|
17
|
-
fields: fields,
|
18
|
-
include_fields: include_fields
|
18
|
+
fields: fields.is_a?(Array) ? fields.join(',') : fields,
|
19
|
+
include_fields: include_fields,
|
20
|
+
page: !page.nil? ? page.to_i : nil,
|
21
|
+
per_page: !page.nil? && !per_page.nil? ? per_page.to_i : nil
|
19
22
|
}
|
20
23
|
get(clients_path, request_params)
|
21
24
|
end
|
@@ -7,18 +7,30 @@ module Auth0
|
|
7
7
|
|
8
8
|
# Retrieves every connection matching the specified strategy. All connections are retrieved if no strategy is
|
9
9
|
# being specified. Accepts a list of fields to include or exclude in the resulting list of connection objects.
|
10
|
-
# @see https://auth0.com/docs/api/v2#!/Connections/get_connections
|
11
|
-
# @param strategy [string]
|
12
|
-
#
|
10
|
+
# @see https://auth0.com/docs/api/management/v2#!/Connections/get_connections
|
11
|
+
# @param strategy [string] Strategy to filter connection results.
|
12
|
+
# @param name [string] Name to filter connection results.
|
13
13
|
# @param fields [string] A comma separated list of fields to include or exclude from the result.
|
14
14
|
# @param include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
|
15
|
-
#
|
15
|
+
# @param page [int] Page number to get, 0-based.
|
16
|
+
# @param per_page [int] Results per page if also passing a page number.
|
16
17
|
# @return [json] Returns the existing connections matching the strategy.
|
17
|
-
def connections(
|
18
|
+
def connections(
|
19
|
+
strategy: nil,
|
20
|
+
name: nil,
|
21
|
+
fields: nil,
|
22
|
+
include_fields: nil,
|
23
|
+
page: nil,
|
24
|
+
per_page: nil
|
25
|
+
)
|
26
|
+
include_fields = true if !fields.nil? && include_fields.nil?
|
18
27
|
request_params = {
|
19
28
|
strategy: strategy,
|
20
|
-
|
21
|
-
|
29
|
+
name: name,
|
30
|
+
fields: fields.is_a?(Array) ? fields.join(',') : fields,
|
31
|
+
include_fields: include_fields,
|
32
|
+
page: !page.nil? ? page.to_i : nil,
|
33
|
+
per_page: !page.nil? && !per_page.nil? ? per_page.to_i : nil
|
22
34
|
}
|
23
35
|
get(connections_path, request_params)
|
24
36
|
end
|
@@ -7,11 +7,12 @@ module Auth0
|
|
7
7
|
|
8
8
|
# Retrieves log entries that match the specified search criteria.
|
9
9
|
# @see https://auth0.com/docs/api/v2#!/device_credentials/get_device_credentials
|
10
|
-
# @param fields [string] A comma separated list of fields to include or exclude from the result.
|
11
|
-
# @param include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
|
12
|
-
# @param user_id [string] The user_id of the devices to retrieve.
|
13
10
|
# @param client_id [string] The client_id of the devices to retrieve.
|
14
|
-
# @param
|
11
|
+
# @param options [hash]
|
12
|
+
# * :fields [string] A comma separated list of fields to include or exclude from the result.
|
13
|
+
# * :include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
|
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
16
|
#
|
16
17
|
# @return [json] Returns the list of existing devices for the specified client_id.
|
17
18
|
# rubocop:disable Metrics/AbcSize
|
@@ -0,0 +1,142 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
# Methods to use the guardian endpoints
|
5
|
+
module Guardian
|
6
|
+
include Auth0::Mixins::Validation
|
7
|
+
|
8
|
+
# Retrieves a list of Guardian factors.
|
9
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/get_factors
|
10
|
+
# @return [json] Returns the list of all Guardian factors.
|
11
|
+
def guardian_factors
|
12
|
+
get(guardian_factors_path)
|
13
|
+
end
|
14
|
+
alias get_guardian_factors guardian_factors
|
15
|
+
|
16
|
+
# Retrieves a single Guardian enrollment.
|
17
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/get_enrollments_by_id
|
18
|
+
# @param enrollment_id [string] The enrollment_id of the Guardian enrollment to delete.
|
19
|
+
# @return [json] Returns details of the Guardian enrollment.
|
20
|
+
def guardian_enrollment(enrollment_id)
|
21
|
+
raise Auth0::MissingParameter, 'Must supply a valid enrollment_id' if enrollment_id.to_s.empty?
|
22
|
+
|
23
|
+
path = "#{guardian_enrollments_path}/#{enrollment_id}"
|
24
|
+
get(path)
|
25
|
+
end
|
26
|
+
alias get_guardian_enrollment guardian_enrollment
|
27
|
+
|
28
|
+
# Deletes a single Guardian enrollment given its id.
|
29
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/delete_enrollments_by_id
|
30
|
+
# @param enrollment_id [string] The enrollment_id of the Guardian enrollment to delete.
|
31
|
+
def delete_guardian_enrollment(enrollment_id)
|
32
|
+
raise Auth0::MissingParameter, 'Must supply a valid enrollment_id' if enrollment_id.to_s.empty?
|
33
|
+
|
34
|
+
path = "#{guardian_enrollments_path}/#{enrollment_id}"
|
35
|
+
delete(path)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Retrieves SMS enrollment and verification templates.
|
39
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/get_templates
|
40
|
+
# @return [json] Returns enrollment and verification templates.
|
41
|
+
def guardian_sms_templates
|
42
|
+
path = "#{guardian_factors_path}/sms/templates"
|
43
|
+
get(path)
|
44
|
+
end
|
45
|
+
alias get_guardian_sms_templates guardian_sms_templates
|
46
|
+
|
47
|
+
# Updates SMS enrollment and verification SMS templates.
|
48
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/put_templates
|
49
|
+
# @param body [hash] The parameters to update.
|
50
|
+
#
|
51
|
+
# @return [json] Returns updated SMS enrollment and verification templates.
|
52
|
+
def guardian_update_enrollment_verification_templates(body)
|
53
|
+
raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?
|
54
|
+
|
55
|
+
path = "#{guardian_factors_path}/sms/templates"
|
56
|
+
put(path, body)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Retrieves provider configuration for AWS SNS.
|
60
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/get_sns
|
61
|
+
# @return [json] Returns provider configuration for AWS SNS.
|
62
|
+
def guardian_sns_provider_config
|
63
|
+
path = "#{guardian_factors_path}/push-notification/providers/sns"
|
64
|
+
get(path)
|
65
|
+
end
|
66
|
+
alias get_guardian_sns_provider_config guardian_sns_provider_config
|
67
|
+
|
68
|
+
# Updates provider configuration for AWS SNS.
|
69
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/put_sns
|
70
|
+
# @param body [hash] The parameters to update.
|
71
|
+
#
|
72
|
+
# @return [json] Returns updated provider configuration for AWS SNS.
|
73
|
+
def guardian_update_sns_provider_config(body)
|
74
|
+
raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?
|
75
|
+
|
76
|
+
path = "#{guardian_factors_path}/push-notification/providers/sns"
|
77
|
+
put(path, body)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Retrieves provider configuration for Twilio.
|
81
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/get_twilio
|
82
|
+
# @return [json] Returns provider configuration for Twilio.
|
83
|
+
def guardian_twillo_provider_config
|
84
|
+
path = "#{guardian_factors_path}/sms/providers/twilio"
|
85
|
+
get(path)
|
86
|
+
end
|
87
|
+
alias get_guardian_twillo_provider_config guardian_twillo_provider_config
|
88
|
+
|
89
|
+
# Updates provider configuration for Twilio.
|
90
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/put_twilio
|
91
|
+
# @param body [hash] The parameters to update.
|
92
|
+
#
|
93
|
+
# @return [json] Returns updated provider configuration for Twilio.
|
94
|
+
def guardian_update_twillo_provider_config(body)
|
95
|
+
raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?
|
96
|
+
|
97
|
+
path = "#{guardian_factors_path}/sms/providers/twilio"
|
98
|
+
put(path, body)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Creates a Guardian enrollment ticket.
|
102
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/post_ticket
|
103
|
+
# @param body [hash] User details to create enrollment ticket for.
|
104
|
+
# @return [json] Returns details of created enrollment ticket.
|
105
|
+
def guardian_create_enrollment_ticket(body)
|
106
|
+
raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?
|
107
|
+
|
108
|
+
path = "#{guardian_enrollments_path}/ticket"
|
109
|
+
post(path, body)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Updates a Guardian factor.
|
113
|
+
# @see https://auth0.com/docs/api/management/v2#!/Guardian/put_factors_by_name
|
114
|
+
# @param name [string] Name of Guardian factor to update.
|
115
|
+
# @param body [hash] The parameters to update.
|
116
|
+
# @return [json] Returns details of updated Guardian factor.
|
117
|
+
def guardian_update_factor(name, body)
|
118
|
+
raise Auth0::MissingParameter, 'Must supply a valid name' if name.to_s.empty?
|
119
|
+
raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?
|
120
|
+
|
121
|
+
path = "#{guardian_factors_path}/#{name}"
|
122
|
+
put(path, body)
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
# Guardian API path
|
128
|
+
def guardian_path
|
129
|
+
@guardian_path ||= '/api/v2/guardian'
|
130
|
+
end
|
131
|
+
|
132
|
+
def guardian_enrollments_path
|
133
|
+
@guardian_enrollments_path ||= "#{guardian_path}/enrollments"
|
134
|
+
end
|
135
|
+
|
136
|
+
def guardian_factors_path
|
137
|
+
@guardian_factors_path ||= "#{guardian_path}/factors"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
data/lib/auth0/api/v2/jobs.rb
CHANGED
@@ -3,47 +3,101 @@ module Auth0
|
|
3
3
|
module V2
|
4
4
|
# Methods to use the jobs endpoints
|
5
5
|
module Jobs
|
6
|
-
attr_reader :jobs_path
|
7
|
-
|
8
6
|
# Retrieves a job. Useful to check its status.
|
9
7
|
# @see https://auth0.com/docs/api/v2#!/Jobs/get_jobs_by_job_id
|
10
|
-
# @param job_id [string] The
|
8
|
+
# @param job_id [string] The ID of the job.
|
11
9
|
#
|
12
10
|
# @return [json] Returns the job status and properties.
|
13
11
|
def get_job(job_id)
|
14
12
|
raise Auth0::InvalidParameter, 'Must specify a job id' if job_id.to_s.empty?
|
13
|
+
|
15
14
|
path = "#{jobs_path}/#{job_id}"
|
16
15
|
get(path)
|
17
16
|
end
|
18
17
|
|
18
|
+
# Retrieve error details based on the id of the job. Useful to check its status.
|
19
|
+
# @see https://auth0.com/docs/api/management/v2#!/Jobs/get_errors
|
20
|
+
# @param job_id [string] The ID of the job.
|
21
|
+
#
|
22
|
+
# @return [json] Returns the job error details.
|
23
|
+
def get_job_errors(job_id)
|
24
|
+
raise Auth0::InvalidParameter, 'Must specify a job id' if job_id.to_s.empty?
|
25
|
+
|
26
|
+
path = "#{jobs_path}/#{job_id}/errors"
|
27
|
+
get(path)
|
28
|
+
end
|
29
|
+
|
19
30
|
# Imports users to a connection from a file using a long running job.
|
20
|
-
#
|
31
|
+
# Documentation for the file format: https://docs.auth0.com/bulk-import
|
21
32
|
# @see https://auth0.com/docs/api/v2#!/Jobs/post_users_imports
|
22
33
|
# @param users_file [file] A file containing the users to import.
|
23
|
-
# @param connection_id [string]
|
24
|
-
#
|
34
|
+
# @param connection_id [string] Database connection ID to import to.
|
35
|
+
# @param options [hash]
|
36
|
+
# * :upsert [boolean] Update the user if already exists. False by default.
|
37
|
+
# * :external_id [string] Customer defined id
|
38
|
+
# * :send_completion_email [boolean] If true,
|
39
|
+
# send the completion email to all tenant owners when the job is finished. True by default.
|
25
40
|
# @return [json] Returns the job status and properties.
|
26
|
-
def import_users(users_file, connection_id)
|
41
|
+
def import_users(users_file, connection_id, options = {})
|
27
42
|
raise Auth0::InvalidParameter, 'Must specify a valid file' if users_file.to_s.empty?
|
28
43
|
raise Auth0::InvalidParameter, 'Must specify a connection_id' if connection_id.to_s.empty?
|
44
|
+
|
29
45
|
request_params = {
|
30
46
|
users: users_file,
|
31
|
-
connection_id: connection_id
|
47
|
+
connection_id: connection_id,
|
48
|
+
upsert: options.fetch(:upsert, false),
|
49
|
+
external_id: options.fetch(:external_id, nil),
|
50
|
+
send_completion_email: options.fetch(:send_completion_email, true)
|
32
51
|
}
|
33
52
|
path = "#{jobs_path}/users-imports"
|
34
53
|
post_file(path, request_params)
|
35
54
|
end
|
36
55
|
|
56
|
+
# Export all users to a file using a long running job.
|
57
|
+
# @see https://auth0.com/docs/api/v2#!/Jobs/post_users_exports
|
58
|
+
# @param options [hash] The options used to configure the output file.
|
59
|
+
# :connection_id [string] Database connection ID to export from.
|
60
|
+
# :format [string] The format of the file. Valid values are: "json" and "csv".
|
61
|
+
# :limit [integer] Limit the number of users to export.
|
62
|
+
# :fields [array] A list of fields to be included in the CSV.
|
63
|
+
# If omitted, a set of predefined fields will be exported.
|
64
|
+
#
|
65
|
+
# @return [json] Returns the job status and properties.
|
66
|
+
def export_users(options = {})
|
67
|
+
request_params = {
|
68
|
+
connection_id: options.fetch(:connection_id, nil),
|
69
|
+
format: options.fetch(:format, nil),
|
70
|
+
limit: options.fetch(:limit, nil),
|
71
|
+
fields: fields_for_export(options.fetch(:fields, nil))
|
72
|
+
}
|
73
|
+
path = "#{jobs_path}/users-exports"
|
74
|
+
post(path, request_params)
|
75
|
+
end
|
76
|
+
|
37
77
|
# Send an email to the specified user that asks them to click a link to verify their email address.
|
38
|
-
# @see https://auth0.com/docs/api/v2#!/Jobs/post_verification_email
|
78
|
+
# @see https://auth0.com/docs/api/management/v2#!/Jobs/post_verification_email
|
39
79
|
# @param user_id [string] The user_id of the user to whom the email will be sent.
|
80
|
+
# @param client_id [string] Client ID to send an Application-specific email.
|
81
|
+
# @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
|
82
|
+
# * :user_id [string] user_id of the identity.
|
83
|
+
# * :provider [string] provider of the identity.
|
84
|
+
# @param organization_id [string] organization id
|
40
85
|
#
|
41
86
|
# @return [json] Returns the job status and properties.
|
42
|
-
def send_verification_email(user_id)
|
87
|
+
def send_verification_email(user_id, client_id = nil, identity: nil, organization_id: nil)
|
43
88
|
raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
|
44
|
-
|
45
|
-
|
46
|
-
|
89
|
+
|
90
|
+
request_params = { user_id: user_id }
|
91
|
+
request_params[:client_id] = client_id unless client_id.nil?
|
92
|
+
request_params[:organization_id] = organization_id unless organization_id.nil?
|
93
|
+
|
94
|
+
if identity
|
95
|
+
unless identity.is_a? Hash
|
96
|
+
raise Auth0::InvalidParameter, 'Identity must be a hash send an email verification'
|
97
|
+
end
|
98
|
+
request_params[:identity] = identity
|
99
|
+
end
|
100
|
+
|
47
101
|
path = "#{jobs_path}/verification-email"
|
48
102
|
post(path, request_params)
|
49
103
|
end
|
@@ -54,6 +108,16 @@ module Auth0
|
|
54
108
|
def jobs_path
|
55
109
|
@jobs_path ||= '/api/v2/jobs'
|
56
110
|
end
|
111
|
+
|
112
|
+
# Map array of field names for export to array of objects
|
113
|
+
# @param fields [array] Field names to be included in the export
|
114
|
+
|
115
|
+
# @return [array] Returns the fields mapped as array of objects for the export_users endpoint
|
116
|
+
def fields_for_export(fields)
|
117
|
+
return nil if fields.to_s.empty?
|
118
|
+
|
119
|
+
fields.map { |field| { name: field } }
|
120
|
+
end
|
57
121
|
end
|
58
122
|
end
|
59
123
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
# Methods to use the log streams endpoints
|
5
|
+
module LogStreams
|
6
|
+
attr_reader :log_streams_path
|
7
|
+
|
8
|
+
# Retrieves a list of all log streams.
|
9
|
+
# @see https://auth0.com/docs/api/management/v2#!/Log_Streams/get_log_streams
|
10
|
+
# @return [json] Returns the log streams.
|
11
|
+
def log_streams()
|
12
|
+
get(log_streams_path)
|
13
|
+
end
|
14
|
+
alias get_log_streams log_streams
|
15
|
+
|
16
|
+
# Retrieves a log stream by its ID.
|
17
|
+
# @see https://auth0.com/docs/api/management/v2#!/Log_Streams/get_log_streams_by_id
|
18
|
+
# @param id [string] The id of the log stream to retrieve.
|
19
|
+
#
|
20
|
+
# @return [json] Returns the log stream.
|
21
|
+
def log_stream(id)
|
22
|
+
raise Auth0::InvalidParameter, 'Must supply a valid log stream id' if id.to_s.empty?
|
23
|
+
path = "#{log_streams_path}/#{id}"
|
24
|
+
get(path)
|
25
|
+
end
|
26
|
+
alias get_log_stream log_stream
|
27
|
+
|
28
|
+
# Creates a new log stream according to the JSON object received in body.
|
29
|
+
# @see https://auth0.com/docs/api/management/v2#!/Log_Streams/post_log_streams
|
30
|
+
# @param name [string] The name of the log stream.
|
31
|
+
# @param type [string] The type of log stream
|
32
|
+
# @param options [hash] The Hash options used to define the log streams's properties.
|
33
|
+
#
|
34
|
+
# @return [json] Returns the log stream.
|
35
|
+
def create_log_stream(name, type, options)
|
36
|
+
raise Auth0::InvalidParameter, 'Name must contain at least one character' if name.to_s.empty?
|
37
|
+
raise Auth0::InvalidParameter, 'Must specify a valid type' if type.to_s.empty?
|
38
|
+
raise Auth0::InvalidParameter, 'Must supply a valid hash for options' unless options.is_a? Hash
|
39
|
+
|
40
|
+
request_params = {}
|
41
|
+
request_params[:name] = name
|
42
|
+
request_params[:type] = type
|
43
|
+
request_params[:sink] = options
|
44
|
+
post(log_streams_path, request_params)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Deletes a log stream by its ID.
|
48
|
+
# @see https://auth0.com/docs/api/management/v2#!/Log_Streams/delete_log_streams_by_id
|
49
|
+
# @param id [string] The id of the log stream to delete.
|
50
|
+
def delete_log_stream(id)
|
51
|
+
raise Auth0::InvalidParameter, 'Must supply a valid log stream id' if id.to_s.empty?
|
52
|
+
path = "#{log_streams_path}/#{id}"
|
53
|
+
delete(path)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Updates a log stream.
|
57
|
+
# @see https://auth0.com/docs/api/management/v2#!/Log_Streams/patch_log_streams_by_id
|
58
|
+
# @param id [string] The id or audience of the log stream to update.
|
59
|
+
# @param status [string] The Hash options used to define the log streams's properties.
|
60
|
+
def patch_log_stream(id, status)
|
61
|
+
raise Auth0::InvalidParameter, 'Must specify a log stream id' if id.to_s.empty?
|
62
|
+
raise Auth0::InvalidParameter, 'Must specify a valid status' if status.to_s.empty?
|
63
|
+
|
64
|
+
request_params = {}
|
65
|
+
request_params[:status] = status
|
66
|
+
path = "#{log_streams_path}/#{id}"
|
67
|
+
patch(path, request_params)
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
# Log Streams API path
|
72
|
+
def log_streams_path
|
73
|
+
@log_streams_path ||= '/api/v2/log-streams'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/auth0/api/v2/logs.rb
CHANGED
@@ -8,16 +8,16 @@ module Auth0
|
|
8
8
|
|
9
9
|
# Retrieves log entries that match the specified search criteria.
|
10
10
|
# @see https://auth0.com/docs/api/v2#!/Logs/get_logs
|
11
|
-
# @param
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# parameter.
|
20
|
-
#
|
11
|
+
# @param options [hash]
|
12
|
+
# * :q [string] Query in Lucene query string syntax.
|
13
|
+
# * :page [integer] The page number. Zero based.
|
14
|
+
# * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
|
15
|
+
# * :sort [string] The field to use for sorting. 1 == ascending and -1 == descending.
|
16
|
+
# * :fields [string] A comma separated list of fields to include or exclude from the result.
|
17
|
+
# * :include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
|
18
|
+
# * :include_totals [string] True if a query summary must be included in the result, false otherwise.
|
19
|
+
# * :from [string] Log Event Id to start retrieving logs. You can limit the amount of logs using the take parameter.
|
20
|
+
# * :take [integer] The total amount of entries to retrieve when using the from parameter.
|
21
21
|
# Default: 50. Max value: 100.
|
22
22
|
#
|
23
23
|
# @return [json] Returns the list of existing log entries.
|
@@ -45,7 +45,7 @@ module Auth0
|
|
45
45
|
|
46
46
|
# Retrieves log entries that match the specified search criteria.
|
47
47
|
# @see https://auth0.com/docs/api/v2#!/Logs/get_logs_by_id
|
48
|
-
# @param
|
48
|
+
# @param log_id [string] The log_id of the log to retrieve.
|
49
49
|
#
|
50
50
|
# @return [json] Returns the log with the given id if exists.
|
51
51
|
def log(log_id)
|