├── .bundle └── config ├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .env.example ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── Bug Report.yml │ ├── Feature Request.yml │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md ├── actions │ ├── get-prerelease │ │ └── action.yml │ ├── get-release-notes │ │ └── action.yml │ ├── get-version │ │ └── action.yml │ ├── release-create │ │ └── action.yml │ ├── rl-scanner │ │ └── action.yml │ ├── rubygems-publish │ │ └── action.yml │ ├── setup │ │ └── action.yml │ └── tag-exists │ │ └── action.yml ├── dependabot.yml ├── stale.yml └── workflows │ ├── codeql.yml │ ├── matrix.json │ ├── release.yml │ ├── rl-scanner.yml │ ├── ruby-release.yml │ ├── semgrep.yml │ ├── snyk.yml │ └── test.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── .rubocop_todo.yml ├── .semgrepignore ├── .shiprc ├── .snyk ├── .version ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── DEPLOYMENT.md ├── DEVELOPMENT.md ├── Dockerfile ├── EXAMPLES.md ├── Gemfile ├── Gemfile.lock ├── Guardfile ├── LICENSE ├── README.md ├── RUBYGEM.md ├── Rakefile ├── auth0.gemspec ├── codecov.yml ├── examples ├── ruby-api │ ├── .env.example │ ├── .gitignore │ ├── Gemfile │ ├── Gemfile.lock │ ├── README.md │ ├── config.ru │ └── main.rb └── ruby-on-rails-api │ ├── .env.example │ ├── .gitignore │ ├── Gemfile │ ├── README.md │ ├── Rakefile │ ├── app │ ├── assets │ │ ├── images │ │ │ └── .keep │ │ ├── javascripts │ │ │ └── application.js │ │ └── stylesheets │ │ │ └── application.css │ ├── controllers │ │ ├── application_controller.rb │ │ ├── concerns │ │ │ └── .keep │ │ ├── ping_controller.rb │ │ └── secured_ping_controller.rb │ ├── helpers │ │ └── application_helper.rb │ ├── mailers │ │ └── .keep │ ├── models │ │ ├── .keep │ │ ├── User.rb │ │ └── concerns │ │ │ └── .keep │ └── views │ │ └── layouts │ │ └── application.html.erb │ ├── bin │ ├── bundle │ ├── rails │ ├── rake │ └── setup │ ├── config.ru │ ├── config │ ├── application.rb │ ├── boot.rb │ ├── database.yml │ ├── environment.rb │ ├── environments │ │ ├── development.rb │ │ ├── production.rb │ │ └── test.rb │ ├── initializers │ │ ├── backtrace_silencers.rb │ │ ├── cookies_serializer.rb │ │ ├── dotenv.rb │ │ ├── filter_parameter_logging.rb │ │ ├── inflections.rb │ │ ├── knock.rb │ │ ├── mime_types.rb │ │ ├── session_store.rb │ │ └── wrap_parameters.rb │ ├── locales │ │ └── en.yml │ ├── routes.rb │ └── secrets.yml │ ├── db │ ├── schema.rb │ └── seeds.rb │ ├── lib │ ├── assets │ │ └── .keep │ └── tasks │ │ └── .keep │ ├── log │ └── .keep │ ├── public │ ├── 404.html │ ├── 422.html │ ├── 500.html │ ├── favicon.ico │ └── robots.txt │ └── test │ ├── controllers │ └── .keep │ ├── fixtures │ └── .keep │ ├── helpers │ └── .keep │ ├── integration │ └── .keep │ ├── mailers │ └── .keep │ ├── models │ └── .keep │ ├── ping_controller_test.rb │ ├── secured_ping_controller_test.rb │ └── test_helper.rb ├── lib ├── auth0.rb ├── auth0 │ ├── algorithm.rb │ ├── api │ │ ├── authentication_endpoints.rb │ │ ├── v2.rb │ │ └── v2 │ │ │ ├── actions.rb │ │ │ ├── anomaly.rb │ │ │ ├── attack_protection.rb │ │ │ ├── blacklists.rb │ │ │ ├── branding.rb │ │ │ ├── client_grants.rb │ │ │ ├── clients.rb │ │ │ ├── connections.rb │ │ │ ├── device_credentials.rb │ │ │ ├── emails.rb │ │ │ ├── grants.rb │ │ │ ├── guardian.rb │ │ │ ├── jobs.rb │ │ │ ├── log_streams.rb │ │ │ ├── logs.rb │ │ │ ├── organizations.rb │ │ │ ├── prompts.rb │ │ │ ├── refresh_tokens.rb │ │ │ ├── resource_servers.rb │ │ │ ├── roles.rb │ │ │ ├── rules.rb │ │ │ ├── sessions.rb │ │ │ ├── stats.rb │ │ │ ├── tenants.rb │ │ │ ├── tickets.rb │ │ │ ├── user_blocks.rb │ │ │ ├── users.rb │ │ │ └── users_by_email.rb │ ├── client.rb │ ├── client_assertion.rb │ ├── exception.rb │ ├── mixins.rb │ ├── mixins │ │ ├── access_token_struct.rb │ │ ├── api_token_struct.rb │ │ ├── headers.rb │ │ ├── httpproxy.rb │ │ ├── initializer.rb │ │ ├── permission_struct.rb │ │ ├── token_management.rb │ │ └── validation.rb │ └── version.rb └── auth0_client.rb ├── opslevel.yml ├── publish_rubygem.sh └── spec ├── fixtures └── vcr_cassettes │ ├── Auth0_Api_AuthenticationEndpoints │ ├── _change_password │ │ └── should_trigger_a_password_reset.yml │ ├── _login_with_resource_owner │ │ ├── should_fail_with_an_incorrect_email.yml │ │ ├── should_fail_with_an_incorrect_password.yml │ │ ├── should_fail_with_an_invalid_audience.yml │ │ ├── should_login_successfully_with_a_custom_audience.yml │ │ └── should_login_successfully_with_a_default_scope.yml │ ├── _saml_metadata │ │ └── should_retrieve_SAML_metadata.yml │ ├── _userinfo │ │ ├── should_fail_as_not_authorized.yml │ │ └── should_return_the_userinfo.yml │ ├── _wsfed_metadata │ │ └── should_retrieve_WSFED_metadata.yml │ ├── create_test_user.yml │ └── delete_test_user.yml │ ├── Auth0_Api_V2_Blacklists │ ├── _add_token_to_blacklist │ │ └── should_add_a_token_to_the_blacklist.yml │ └── _blacklisted_tokens │ │ └── should_get_the_added_token_from_the_blacklist.yml │ ├── Auth0_Api_V2_ClientGrants │ ├── _client_grants │ │ ├── should_return_at_least_1_result.yml │ │ └── should_return_the_test_client_grant.yml │ ├── _delete_client_grant │ │ └── should_delete_the_test_client_grant.yml │ ├── _patch_client_grant │ │ └── should_update_the_test_client_grant.yml │ ├── create_test_client.yml │ ├── create_test_client_grant.yml │ ├── delete_test_client.yml │ └── delete_test_client_grant.yml │ ├── Auth0_Api_V2_Clients │ ├── _client │ │ ├── _filters │ │ │ ├── should_exclude_and_include_fields_properly.yml │ │ │ └── should_include_the_specified_fields.yml │ │ └── should_get_the_test_client.yml │ ├── _clients │ │ ├── _filters │ │ │ ├── should_exclude_fields_not_specified.yml │ │ │ ├── should_exclude_the_specified_fields.yml │ │ │ ├── should_include_the_specified_fields.yml │ │ │ └── should_paginate_results.yml │ │ └── should_get_at_least_one_client.yml │ ├── _delete_client │ │ └── should_delete_the_test_client_without_an_error.yml │ ├── _patch_client │ │ └── should_update_the_client_with_the_correct_attributes.yml │ └── create_test_client.yml │ ├── Auth0_Api_V2_Connections │ ├── _connection │ │ ├── _filters │ │ │ ├── should_exclude_the_fields_indicated.yml │ │ │ └── should_include_the_fields_indicated.yml │ │ └── should_find_the_correct_connection.yml │ ├── _connections │ │ ├── _filters │ │ │ ├── should_include_previously-created_connection_when_filtered.yml │ │ │ ├── should_should_exclude_the_fields_indicated_from_filtered_results.yml │ │ │ └── should_should_include_the_fields_indicated_from_filtered_results.yml │ │ ├── should_include_the_previously_created_connection.yml │ │ └── should_not_be_empty.yml │ ├── _delete_connection │ │ └── should_delete_the_connection.yml │ ├── _delete_connection_user │ │ └── should_delete_the_user_created.yml │ ├── _update_connection │ │ └── should_update_the_connection.yml │ ├── create_test_connection.yml │ └── create_test_user.yml │ ├── Auth0_Api_V2_DeviceCredentials │ ├── create_test_credential.yml │ ├── create_test_user.yml │ └── delete_test_user.yml │ ├── Auth0_Api_V2_Emails │ ├── _configure_provider │ │ └── should_configure_a_new_email_provider.yml │ ├── _delete_provider │ │ ├── should_delete_the_existing_email_provider_without_an_error.yml │ │ └── should_throw_an_error_trying_to_get_the_email_provider.yml │ ├── _get_provider │ │ ├── _filters │ │ │ ├── should_get_the_existing_email_provider_with_specific_fields.yml │ │ │ └── should_get_the_existing_email_provider_without_specific_fields.yml │ │ └── should_get_the_existing_email_provider.yml │ ├── _update_provider │ │ └── should_update_the_existing_email_provider.yml │ └── delete_existing_provider.yml │ ├── Auth0_Api_V2_Jobs │ ├── _export_users_and_get_job │ │ ├── should_create_an_export_users_job_successfully.yml │ │ └── should_get_the_export_users_job.yml │ ├── _import_users_and_get_job │ │ ├── should_create_an_import_users_job_successfully.yml │ │ └── should_get_the_import_users_job.yml │ ├── _send_verification_email_and_get_job │ │ ├── should_create_a_new_verification_email_job.yml │ │ ├── should_get_the_completed_verification_email.yml │ │ └── should_reject_an_invalid_client_id.yml │ ├── delete_imported_user.yml │ └── search_for_connection_id.yml │ ├── Auth0_Api_V2_Logs │ ├── _log │ │ ├── should_match_the_created_log_entry.yml │ │ └── should_not_be_empty.yml │ ├── _logs │ │ ├── _filters │ │ │ ├── should_exclude_fields_not_specified.yml │ │ │ ├── should_exclude_the_specified_fields.yml │ │ │ ├── should_have_one_log_entry.yml │ │ │ └── should_include_the_specified_fields.yml │ │ └── _from │ │ │ └── should_take_one_log_entry.yml │ ├── create_test_user.yml │ ├── delete_test_disabled_rule.yml │ ├── delete_test_enabled_rule.yml │ └── delete_test_user.yml │ ├── Auth0_Api_V2_ResourceServers │ ├── _delete_resource_server │ │ └── should_delete_the_test_server_without_an_error.yml │ ├── _patch_resource_server │ │ └── should_update_the_resource_server_with_the_correct_attributes.yml │ ├── _resource_server │ │ └── should_get_the_test_server.yml │ ├── _resource_servers │ │ ├── should_get_the_test_server.yml │ │ ├── should_return_at_least_1_result.yml │ │ └── should_return_the_first_page_of_one_result.yml │ ├── create_test_server.yml │ └── delete_test_server.yml │ ├── Auth0_Api_V2_Roles │ ├── _add_role_permissions │ │ └── should_add_a_Permission_to_the_Role_successfully.yml │ ├── _add_role_users │ │ └── should_add_a_User_to_the_Role_successfully.yml │ ├── _delete_role │ │ └── should_delete_the_Role_successfully.yml │ ├── _get_role │ │ └── should_get_the_Role_successfully.yml │ ├── _get_role_permissions │ │ ├── should_get_exactly_1_Permission.yml │ │ └── should_get_the_added_Permission_from_the_Role_successfully.yml │ ├── _get_role_users │ │ ├── should_get_exactly_1_User.yml │ │ └── should_get_the_added_User_from_the_Role_successfully.yml │ ├── _get_roles │ │ └── should_get_the_Role_successfully.yml │ ├── _remove_role_permissions │ │ └── should_remove_a_Permission_from_the_Role_successfully.yml │ ├── _update_role │ │ └── should_update_the_Role_successfully.yml │ ├── create_test_api.yml │ ├── create_test_role.yml │ ├── create_test_user.yml │ ├── delete_test_api.yml │ └── delete_test_user.yml │ ├── Auth0_Api_V2_Rules │ ├── _delete_rule │ │ ├── should_delete_the_test_disabled_rule_without_an_error.yml │ │ └── should_delete_the_test_enabled_rule_without_an_error.yml │ ├── _rule │ │ ├── _filters │ │ │ ├── should_exclude_the_fields_not_specified.yml │ │ │ ├── should_exclude_the_specified_fields.yml │ │ │ └── should_include_the_specified_fields.yml │ │ └── should_get_a_specific_rule.yml │ ├── _rules │ │ ├── _filters │ │ │ ├── should_exclude_fields_not_specified.yml │ │ │ ├── should_include_the_specified_fields.yml │ │ │ ├── should_return_at_least_1_disabled_rule.yml │ │ │ ├── should_return_at_least_1_enabled_rule.yml │ │ │ └── should_return_paginated_results.yml │ │ └── should_return_at_least_1_rule.yml │ ├── _update_rule │ │ └── should_update_the_disabled_rule_to_be_enabled.yml │ ├── create_test_disabled_rule.yml │ └── create_test_enabled_rule.yml │ ├── Auth0_Api_V2_Stats │ ├── _active_users │ │ └── should_have_at_least_one_active_user.yml │ └── _daily_stats │ │ └── should_have_at_least_one_stats_entry_for_the_timeframe.yml │ ├── Auth0_Api_V2_Tenants │ ├── _get_tenant_settings │ │ └── should_get_the_tenant_settings.yml │ ├── _get_tenant_settings_with_specific_fields │ │ ├── should_exclude_a_field_not_requested.yml │ │ └── should_include_the_field_requested.yml │ └── _update_tenant_settings │ │ ├── should_revert_the_tenant_name.yml │ │ └── should_update_the_tenant_settings_with_a_new_tenant_name.yml │ ├── Auth0_Api_V2_Tickets │ ├── _post_email_verification │ │ └── should_create_an_email_verification_ticket.yml │ ├── _post_password_change │ │ └── should_create_a_password_change_ticket.yml │ ├── create_test_user.yml │ └── delete_test_user.yml │ └── Auth0_Api_V2_Users │ ├── _add_user_permissions │ └── should_add_a_Permissions_for_a_User_successfully.yml │ ├── _add_user_roles │ └── should_add_a_Role_to_a_User_successfully.yml │ ├── _delete_user │ ├── should_delete_the_User_successfully.yml │ └── should_delete_the_secondary_User_successfully.yml │ ├── _delete_user_provider │ └── should_attempt_to_delete_the_MFA_provider_for_the_User.yml │ ├── _get_enrollments │ └── should_get_Enrollments_for_a_User_successfully.yml │ ├── _get_user_permissions │ ├── should_get_exactly_1_Permission_for_a_User_successfully.yml │ └── should_get_the_correct_Permission_for_a_User_successfully.yml │ ├── _get_user_roles │ └── should_get_Roles_for_a_User_successfully.yml │ ├── _invalidate_browsers │ └── should_invalidate_MFA_browsers_for_the_User_successfully.yml │ ├── _link_user_account │ └── should_link_two_Users_successfully.yml │ ├── _patch_user │ └── should_patch_the_User_successfully.yml │ ├── _remove_user_permissions │ └── should_remove_a_Permission_from_a_User_successfully.yml │ ├── _remove_user_roles │ └── should_remove_a_Role_from_a_User_successfully.yml │ ├── _unlink_user_account │ └── should_unlink_two_Users_successfully.yml │ ├── _user │ ├── _filters │ │ ├── should_exclude_fields_not_indicated.yml │ │ ├── should_exclude_the_fields_indicated.yml │ │ └── should_include_the_fields_indicated.yml │ └── should_retrieve_the_created_user.yml │ ├── _user_logs │ └── should_get_Logs_for_a_User_successfully.yml │ ├── _users │ ├── _filters │ │ ├── is_expected_to_find_a_user_with_a_v2_search_engine_query.yml │ │ ├── is_expected_to_find_a_user_with_a_v3_search_engine_query.yml │ │ ├── should_exclude_the_indicated_fields_when_paginated.yml │ │ ├── should_include_the_indicated_fields_when_paginated.yml │ │ ├── should_not_include_other_fields_when_paginated.yml │ │ └── should_return_the_correct_number_of_results_when_paginated.yml │ └── should_have_at_least_one_user.yml │ ├── create_secondary_test_user.yml │ ├── create_test_api.yml │ ├── create_test_role.yml │ ├── create_test_user.yml │ ├── delete_test_api.yml │ └── delete_test_role.yml ├── integration └── lib │ └── auth0 │ ├── api │ ├── api_authentication_spec.rb │ └── v2 │ │ ├── api_blacklist_spec.rb │ │ ├── api_client_grants_spec.rb │ │ ├── api_clients_spec.rb │ │ ├── api_connections_spec.rb │ │ ├── api_email_spec.rb │ │ ├── api_jobs_spec.rb │ │ ├── api_logs_spec.rb │ │ ├── api_resource_servers_spec.rb │ │ ├── api_roles_spec.rb │ │ ├── api_rules_spec.rb │ │ ├── api_stats_spec.rb │ │ ├── api_tenants_spec.rb │ │ ├── api_tickets_spec.rb │ │ ├── api_user_blocks_spec.rb │ │ └── api_users_spec.rb │ └── auth0_client_spec.rb ├── lib └── auth0 │ ├── api │ ├── authentication_endpoints_spec.rb │ └── v2 │ │ ├── actions_spec.rb │ │ ├── anomaly_spec.rb │ │ ├── attack_protection_spec.rb │ │ ├── blacklists_spec.rb │ │ ├── branding_spec.rb │ │ ├── client_grants_spec.rb │ │ ├── clients_spec.rb │ │ ├── connections_spec.rb │ │ ├── device_credentials_spec.rb │ │ ├── emails_spec.rb │ │ ├── grants_spec.rb │ │ ├── guardian_spec.rb │ │ ├── jobs_spec.rb │ │ ├── log_streams_spec.rb │ │ ├── logs_spec.rb │ │ ├── organizations_spec.rb │ │ ├── prompts_spec.rb │ │ ├── refresh_tokens_spec.rb │ │ ├── resource_servers_spec.rb │ │ ├── roles_spec.rb │ │ ├── rules_spec.rb │ │ ├── sessions_spec.rb │ │ ├── stats_spec.rb │ │ ├── tenants_spec.rb │ │ ├── tickets_spec.rb │ │ ├── user_blocks_spec.rb │ │ ├── users_by_email_spec.rb │ │ └── users_spec.rb │ ├── client_spec.rb │ └── mixins │ ├── httpproxy_spec.rb │ ├── initializer_spec.rb │ ├── token_management_spec.rb │ └── validation_spec.rb ├── spec_helper.rb └── support ├── credentials.rb ├── dummy_class.rb ├── dummy_class_for_proxy.rb ├── dummy_class_for_restclient.rb ├── dummy_class_for_tokens.rb ├── import_users.json └── stub_response.rb /.bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_JOBS: "3" 3 | BUNDLE_BIN: "bin" 4 | BUNDLE_RETRY: "3" -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ruby/.devcontainer/base.Dockerfile 2 | 3 | # [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster 4 | ARG VARIANT="3.2-bullseye" 5 | FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT} 6 | 7 | # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 8 | ARG NODE_VERSION="none" 9 | RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi 10 | 11 | # [Optional] Uncomment this section to install additional OS packages. 12 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 13 | # && apt-get -y install --no-install-recommends 14 | 15 | # [Optional] Uncomment this line to install additional gems. 16 | # RUN gem install 17 | 18 | # [Optional] Uncomment this line to install global node packages. 19 | # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ruby 3 | { 4 | "name": "Ruby", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | "args": { 8 | // Update 'VARIANT' to pick a Ruby version: 3, 3.1, 3.0, 2, 2.7 9 | // Append -bullseye or -buster to pin to an OS version. 10 | // Use -bullseye variants on local on arm64/Apple Silicon. 11 | "VARIANT": "3.2", 12 | // Options 13 | "NODE_VERSION": "lts/*" 14 | } 15 | }, 16 | 17 | // Configure tool-specific properties. 18 | "customizations": { 19 | // Configure properties specific to VS Code. 20 | "vscode": { 21 | // Add the IDs of extensions you want installed when the container is created. 22 | "extensions": [ 23 | "rebornix.Ruby" 24 | ] 25 | } 26 | }, 27 | 28 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 29 | // "forwardPorts": [], 30 | 31 | // Use 'postCreateCommand' to run commands after the container is created. 32 | // "postCreateCommand": "ruby --version", 33 | 34 | // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 35 | "remoteUser": "vscode" 36 | 37 | } 38 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | DOMAIN= 2 | CLIENT_ID= -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @auth0/project-dx-sdks-engineer-codeowner 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Auth0 Community 4 | url: https://community.auth0.com 5 | about: Discuss this SDK in the Auth0 Community forums 6 | - name: SDK API Documentation 7 | url: https://www.rubydoc.info/gems/auth0 8 | about: Read the API documentation for this SDK 9 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Changes 2 | 3 | Please describe both what is changing and why this is important. Include: 4 | 5 | - Endpoints added, deleted, deprecated, or changed 6 | - Classes and methods added, deleted, deprecated, or changed 7 | - Screenshots of new or changed UI, if applicable 8 | - A summary of usage if this is a new feature or change to a public API (this should also be added to relevant documentation once released) 9 | 10 | ### References 11 | 12 | Please include relevant links supporting this change such as a: 13 | 14 | - support ticket 15 | - community post 16 | - StackOverflow post 17 | - support forum thread 18 | 19 | Please note any links that are not publicly accessible. 20 | 21 | ### Testing 22 | 23 | Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors. 24 | 25 | * [ ] This change adds unit test coverage 26 | * [ ] This change adds integration test coverage 27 | * [ ] This change has been tested on the latest version of Ruby 28 | 29 | ### Checklist 30 | 31 | * [ ] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md) 32 | * [ ] I have read the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md) 33 | * [ ] All existing and new tests complete without errors 34 | * [ ] Rubocop passes on all added/modified files 35 | * [ ] All active GitHub checks have passed 36 | -------------------------------------------------------------------------------- /.github/actions/get-prerelease/action.yml: -------------------------------------------------------------------------------- 1 | name: Return a boolean indicating if the version contains prerelease identifiers 2 | 3 | # 4 | # Returns a simple true/false boolean indicating whether the version indicates it's a prerelease or not. 5 | # 6 | # TODO: Remove once the common repo is public. 7 | # 8 | 9 | inputs: 10 | version: 11 | required: true 12 | 13 | outputs: 14 | prerelease: 15 | value: ${{ steps.get_prerelease.outputs.PRERELEASE }} 16 | 17 | runs: 18 | using: composite 19 | 20 | steps: 21 | - id: get_prerelease 22 | shell: bash 23 | run: | 24 | if [[ "${VERSION}" == *"beta"* || "${VERSION}" == *"alpha"* ]]; then 25 | echo "PRERELEASE=true" >> $GITHUB_OUTPUT 26 | else 27 | echo "PRERELEASE=false" >> $GITHUB_OUTPUT 28 | fi 29 | env: 30 | VERSION: ${{ inputs.version }} -------------------------------------------------------------------------------- /.github/actions/get-release-notes/action.yml: -------------------------------------------------------------------------------- 1 | name: Return the release notes extracted from the PR body 2 | 3 | # 4 | # Returns the release notes from the content of a pull request linked to a release branch. It expects the branch name to be in the format release/vX.Y.Z, release/X.Y.Z, release/vX.Y.Z-beta.N. etc. 5 | # 6 | # TODO: Remove once the common repo is public. 7 | # 8 | inputs: 9 | version: 10 | required: true 11 | repo_name: 12 | required: false 13 | repo_owner: 14 | required: true 15 | token: 16 | required: true 17 | 18 | outputs: 19 | release-notes: 20 | value: ${{ steps.get_release_notes.outputs.RELEASE_NOTES }} 21 | 22 | runs: 23 | using: composite 24 | 25 | steps: 26 | - uses: actions/github-script@v7 27 | id: get_release_notes 28 | with: 29 | result-encoding: string 30 | script: | 31 | const { data: pulls } = await github.rest.pulls.list({ 32 | owner: process.env.REPO_OWNER, 33 | repo: process.env.REPO_NAME, 34 | state: 'all', 35 | head: `${process.env.REPO_OWNER}:release/${process.env.VERSION}`, 36 | }); 37 | core.setOutput('RELEASE_NOTES', pulls[0].body); 38 | env: 39 | GITHUB_TOKEN: ${{ inputs.token }} 40 | REPO_OWNER: ${{ inputs.repo_owner }} 41 | REPO_NAME: ${{ inputs.repo_name }} 42 | VERSION: ${{ inputs.version }} -------------------------------------------------------------------------------- /.github/actions/get-version/action.yml: -------------------------------------------------------------------------------- 1 | name: Return the version extracted from the branch name 2 | 3 | # 4 | # Returns the version from the .version file. 5 | # 6 | # TODO: Remove once the common repo is public. 7 | # 8 | 9 | outputs: 10 | version: 11 | value: ${{ steps.get_version.outputs.VERSION }} 12 | 13 | runs: 14 | using: composite 15 | 16 | steps: 17 | - id: get_version 18 | shell: bash 19 | run: | 20 | VERSION=$(head -1 .version) 21 | echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT -------------------------------------------------------------------------------- /.github/actions/release-create/action.yml: -------------------------------------------------------------------------------- 1 | name: Create a GitHub release 2 | 3 | # 4 | # Creates a GitHub release with the given version. 5 | # 6 | # TODO: Remove once the common repo is public. 7 | # 8 | 9 | inputs: 10 | token: 11 | required: true 12 | files: 13 | required: false 14 | name: 15 | required: true 16 | body: 17 | required: true 18 | tag: 19 | required: true 20 | commit: 21 | required: true 22 | draft: 23 | default: false 24 | required: false 25 | prerelease: 26 | default: false 27 | required: false 28 | fail_on_unmatched_files: 29 | default: true 30 | required: false 31 | 32 | runs: 33 | using: composite 34 | 35 | steps: 36 | - uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 37 | with: 38 | body: ${{ inputs.body }} 39 | name: ${{ inputs.name }} 40 | tag_name: ${{ inputs.tag }} 41 | target_commitish: ${{ inputs.commit }} 42 | draft: ${{ inputs.draft }} 43 | prerelease: ${{ inputs.prerelease }} 44 | fail_on_unmatched_files: ${{ inputs.fail_on_unmatched_files }} 45 | files: ${{ inputs.files }} 46 | env: 47 | GITHUB_TOKEN: ${{ inputs.token }} -------------------------------------------------------------------------------- /.github/actions/rubygems-publish/action.yml: -------------------------------------------------------------------------------- 1 | name: Publishes to RubyGems 2 | 3 | # 4 | # Publishes to RubyGems 5 | # 6 | # TODO: Remove once the common repo is public. 7 | # 8 | 9 | inputs: 10 | rubygems-token: 11 | required: true 12 | ruby-version: 13 | required: true 14 | 15 | runs: 16 | using: composite 17 | 18 | steps: 19 | - name: Configure Ruby 20 | uses: ./.github/actions/setup 21 | with: 22 | ruby: ${{ inputs.ruby-version }} 23 | 24 | - name: Publish to RubyGems 25 | shell: bash 26 | run: | 27 | gem build *.gemspec 28 | gem push *.gem 29 | env: 30 | GEM_HOST_API_KEY: ${{ inputs.rubygems-token }} 31 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: Build package 2 | description: Build the SDK package 3 | 4 | inputs: 5 | ruby: 6 | description: The Ruby version to use 7 | required: false 8 | default: 3.2 9 | bundle-path: 10 | description: The path to the bundle cache 11 | required: false 12 | default: vendor/bundle 13 | bundler-cache: 14 | description: Whether to use the bundler cache 15 | required: false 16 | default: true 17 | 18 | runs: 19 | using: composite 20 | 21 | steps: 22 | - name: Configure Ruby 23 | uses: ruby/setup-ruby@v1 24 | with: 25 | ruby-version: ${{ inputs.ruby }} 26 | bundler-cache: ${{ inputs.bundle-cache }} 27 | 28 | - name: Install dependencies 29 | run: bundle check || bundle install 30 | shell: bash 31 | env: 32 | BUNDLE_PATH: ${{ inputs.bundle-path }} 33 | -------------------------------------------------------------------------------- /.github/actions/tag-exists/action.yml: -------------------------------------------------------------------------------- 1 | name: Return a boolean indicating if a tag already exists for the repository 2 | 3 | # 4 | # Returns a simple true/false boolean indicating whether the tag exists or not. 5 | # 6 | # TODO: Remove once the common repo is public. 7 | # 8 | 9 | inputs: 10 | token: 11 | required: true 12 | tag: 13 | required: true 14 | 15 | outputs: 16 | exists: 17 | description: 'Whether the tag exists or not' 18 | value: ${{ steps.tag-exists.outputs.EXISTS }} 19 | 20 | runs: 21 | using: composite 22 | 23 | steps: 24 | - id: tag-exists 25 | shell: bash 26 | run: | 27 | GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/${TAG_NAME}" 28 | http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s -H "Authorization: token ${GITHUB_TOKEN}") 29 | if [ "$http_status_code" -ne "404" ] ; then 30 | echo "EXISTS=true" >> $GITHUB_OUTPUT 31 | else 32 | echo "EXISTS=false" >> $GITHUB_OUTPUT 33 | fi 34 | env: 35 | TAG_NAME: ${{ inputs.tag }} 36 | GITHUB_TOKEN: ${{ inputs.token }} -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "bundler" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | ignore: 8 | - dependency-name: "*" 9 | update-types: ["version-update:semver-major"] 10 | - package-ecosystem: 'github-actions' 11 | directory: '/' 12 | schedule: 13 | interval: 'daily' 14 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an Issue or Pull Request becomes stale 4 | daysUntilStale: 90 5 | 6 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. 7 | daysUntilClose: 7 8 | 9 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable 10 | exemptLabels: [] 11 | 12 | # Set to true to ignore issues with an assignee (defaults to false) 13 | exemptAssignees: true 14 | 15 | # Label to use when marking as stale 16 | staleLabel: closed:stale 17 | 18 | # Comment to post when marking as stale. Set to `false` to disable 19 | markComment: > 20 | This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️ -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: CodeQL 2 | 3 | on: 4 | merge_group: 5 | pull_request: 6 | types: 7 | - opened 8 | - synchronize 9 | push: 10 | branches: 11 | - master 12 | schedule: 13 | - cron: "37 10 * * 2" 14 | 15 | permissions: 16 | actions: read 17 | contents: read 18 | security-events: write 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 22 | cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} 23 | 24 | jobs: 25 | analyze: 26 | name: Check for Vulnerabilities 27 | runs-on: ubuntu-latest 28 | 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | language: [ruby] 33 | 34 | steps: 35 | - if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group' 36 | run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection. 37 | 38 | - name: Checkout 39 | uses: actions/checkout@v4 40 | 41 | - name: Initialize CodeQL 42 | uses: github/codeql-action/init@v3 43 | with: 44 | languages: ${{ matrix.language }} 45 | queries: +security-and-quality 46 | 47 | - name: Autobuild 48 | uses: github/codeql-action/autobuild@v3 49 | 50 | - name: Perform CodeQL Analysis 51 | uses: github/codeql-action/analyze@v3 52 | with: 53 | category: "/language:${{ matrix.language }}" 54 | -------------------------------------------------------------------------------- /.github/workflows/matrix.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [{ "ruby": "3.1" }, { "ruby": "3.2" }, { "ruby": "3.3" }] 3 | } 4 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Create Release 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - closed 7 | workflow_dispatch: 8 | 9 | permissions: 10 | contents: write 11 | id-token: write # This is required for requesting the JWT 12 | 13 | ### TODO: Replace instances of './.github/workflow/' w/ `auth0/dx-sdk-actions/` and append `@latest` after the common `dx-sdk-actions` repo is made public. 14 | ### TODO: Also remove `get-prerelease`, `get-version`, `rubygems-publish`, `release-create`, `tag-create` and `tag-exists` actions from this repo's .github/actions folder and `ruby-release` from `./github/workflows` once the repo is public. 15 | 16 | jobs: 17 | rl-scanner: 18 | uses: ./.github/workflows/rl-scanner.yml 19 | with: 20 | ruby-version: 3.2 21 | secrets: 22 | RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }} 23 | RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }} 24 | SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }} 25 | PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }} 26 | PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }} 27 | PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }} 28 | 29 | release: 30 | uses: ./.github/workflows/ruby-release.yml 31 | needs: rl-scanner 32 | with: 33 | ruby-version: 3.2 34 | secrets: 35 | github-token: ${{ secrets.GITHUB_TOKEN }} 36 | rubygems-token: ${{ secrets.RUBYGEMS_AUTH_TOKEN }} 37 | -------------------------------------------------------------------------------- /.github/workflows/rl-scanner.yml: -------------------------------------------------------------------------------- 1 | name: RL-Secure Workflow 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | ruby-version: 7 | required: true 8 | type: string 9 | secrets: 10 | RLSECURE_LICENSE: 11 | required: true 12 | RLSECURE_SITE_KEY: 13 | required: true 14 | SIGNAL_HANDLER_TOKEN: 15 | required: true 16 | PRODSEC_TOOLS_USER: 17 | required: true 18 | PRODSEC_TOOLS_TOKEN: 19 | required: true 20 | PRODSEC_TOOLS_ARN: 21 | required: true 22 | 23 | jobs: 24 | rl-scanner: 25 | if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')) 26 | runs-on: ubuntu-latest 27 | outputs: 28 | scan-status: ${{ steps.rl-scan-conclusion.outcome }} 29 | 30 | steps: 31 | - name: Checkout code 32 | uses: actions/checkout@v4 33 | 34 | - name: Configure Ruby 35 | uses: ./.github/actions/setup 36 | with: 37 | ruby-version: ${{ inputs.ruby-version }} 38 | 39 | - name: Build RubyGems 40 | shell: bash 41 | run: | 42 | gem build *.gemspec 43 | export GEM_FILE=$(ls *.gem) 44 | echo "gem_file=$GEM_FILE" >> $GITHUB_ENV 45 | 46 | - name: Get Artifact Version 47 | id: get_version 48 | uses: ./.github/actions/get-version 49 | 50 | - name: Run RL Scanner 51 | id: rl-scan-conclusion 52 | uses: ./.github/actions/rl-scanner 53 | with: 54 | artifact-path: "$(pwd)/${{ env.gem_file }}" 55 | version: "${{ steps.get_version.outputs.version }}" 56 | env: 57 | RLSECURE_LICENSE: ${{ secrets.RLSECURE_LICENSE }} 58 | RLSECURE_SITE_KEY: ${{ secrets.RLSECURE_SITE_KEY }} 59 | SIGNAL_HANDLER_TOKEN: ${{ secrets.SIGNAL_HANDLER_TOKEN }} 60 | PRODSEC_TOOLS_USER: ${{ secrets.PRODSEC_TOOLS_USER }} 61 | PRODSEC_TOOLS_TOKEN: ${{ secrets.PRODSEC_TOOLS_TOKEN }} 62 | PRODSEC_TOOLS_ARN: ${{ secrets.PRODSEC_TOOLS_ARN }} 63 | 64 | - name: Output scan result 65 | run: echo "scan-status=${{ steps.rl-scan-conclusion.outcome }}" >> $GITHUB_ENV -------------------------------------------------------------------------------- /.github/workflows/semgrep.yml: -------------------------------------------------------------------------------- 1 | name: Semgrep 2 | 3 | on: 4 | merge_group: 5 | pull_request: 6 | types: 7 | - opened 8 | - synchronize 9 | push: 10 | branches: 11 | - master 12 | schedule: 13 | - cron: '30 0 1,15 * *' 14 | 15 | permissions: 16 | contents: read 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 20 | cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} 21 | 22 | jobs: 23 | run: 24 | name: Check for Vulnerabilities 25 | runs-on: ubuntu-latest 26 | 27 | container: 28 | image: returntocorp/semgrep 29 | 30 | steps: 31 | - if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group' 32 | run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection. 33 | 34 | - uses: actions/checkout@v4 35 | with: 36 | ref: ${{ github.event.pull_request.head.sha || github.ref }} 37 | 38 | - run: semgrep ci 39 | env: 40 | SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 41 | -------------------------------------------------------------------------------- /.github/workflows/snyk.yml: -------------------------------------------------------------------------------- 1 | name: Snyk 2 | 3 | on: 4 | merge_group: 5 | workflow_dispatch: 6 | pull_request: 7 | types: 8 | - opened 9 | - synchronize 10 | push: 11 | branches: 12 | - master 13 | schedule: 14 | - cron: "30 0 1,15 * *" 15 | 16 | permissions: 17 | contents: read 18 | 19 | concurrency: 20 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 21 | cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} 22 | 23 | jobs: 24 | check: 25 | name: Check for Vulnerabilities 26 | runs-on: ubuntu-latest 27 | 28 | steps: 29 | - if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group' 30 | run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection. 31 | 32 | - uses: actions/checkout@v4 33 | with: 34 | ref: ${{ github.event.pull_request.head.sha || github.ref }} 35 | 36 | - run: npm install -g snyk 37 | 38 | - run: snyk test 39 | env: 40 | SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} 41 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test 2 | 3 | on: 4 | merge_group: 5 | workflow_dispatch: 6 | pull_request: 7 | branches: 8 | - master 9 | push: 10 | branches: 11 | - master 12 | 13 | permissions: 14 | contents: read 15 | 16 | concurrency: 17 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 18 | cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} 19 | 20 | env: 21 | CACHE_KEY: "${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}" 22 | 23 | jobs: 24 | configure: 25 | name: Configure Build Matrix 26 | runs-on: ubuntu-latest 27 | 28 | outputs: 29 | matrix: ${{ steps.set-matrix.outputs.matrix }} 30 | 31 | steps: 32 | - uses: actions/checkout@v4 33 | with: 34 | ref: ${{ github.event.pull_request.head.sha || github.ref }} 35 | 36 | - id: set-matrix 37 | run: echo "matrix=$(jq -c . < ./.github/workflows/matrix.json)" >> $GITHUB_OUTPUT 38 | 39 | unit: 40 | needs: configure 41 | 42 | name: Run Unit Tests 43 | runs-on: ubuntu-latest 44 | 45 | strategy: 46 | matrix: ${{ fromJson(needs.configure.outputs.matrix) }} 47 | 48 | env: 49 | DOMAIN: example.auth0.dev 50 | CLIENT_ID: example-client 51 | CLIENT_SECRET: example-secret 52 | MASTER_JWT: example-jwt 53 | BUNDLE_PATH: vendor/bundle 54 | 55 | steps: 56 | - name: Checkout code 57 | uses: actions/checkout@v4 58 | 59 | - name: Configure Ruby 60 | uses: ./.github/actions/setup 61 | with: 62 | ruby: ${{ matrix.ruby }} 63 | 64 | - name: Run tests 65 | run: bundle exec rake test 66 | 67 | - name: Upload coverage 68 | if: matrix.ruby == '3.2' || matrix.ruby == '3.3' 69 | uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # pin@3.1.5 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | !examples/ruby-on-rails-api/bin/ 3 | vendor/ 4 | doc/ 5 | .DS_Store 6 | .ruby-version 7 | coverage 8 | *.gem 9 | .ruby-gemset 10 | *.swp 11 | *.swo 12 | spec/auth0.yml 13 | .env 14 | /.yardoc/checksums 15 | /.yardoc/complete 16 | /.yardoc/object_types 17 | /.yardoc/objects/root.dat 18 | /.yardoc/proxy_types 19 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format Fuubar 3 | --color -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: .rubocop_todo.yml 2 | require: 3 | - rubocop-rails 4 | Rails: 5 | Enabled: true 6 | AllCops: 7 | Exclude: 8 | - bin/**/* 9 | - vendor/**/* 10 | - auth0.gemspec 11 | -------------------------------------------------------------------------------- /.rubocop_todo.yml: -------------------------------------------------------------------------------- 1 | Metrics/MethodLength: 2 | Max: 15 3 | 4 | Metrics/LineLength: 5 | Max: 121 6 | -------------------------------------------------------------------------------- /.semgrepignore: -------------------------------------------------------------------------------- 1 | .bundle/ 2 | .circleci/ 3 | .devcontainer/ 4 | .github/ 5 | examples/ 6 | spec/ 7 | -------------------------------------------------------------------------------- /.shiprc: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "lib/auth0/version.rb": [], 4 | ".version": [] 5 | }, 6 | "prebump": "bundle install && bundle exec rake test", 7 | "postbump": "bundle update" 8 | } -------------------------------------------------------------------------------- /.snyk: -------------------------------------------------------------------------------- 1 | ignore: 2 | SNYK-RUBY-RACK-1061917: 3 | - rubocop-rails > rack: 4 | reason: No direct upgrade available 5 | expires: "2023-11-02T12:00:00.000Z" 6 | - dotenv-rails > railties > actionpack > rack: 7 | reason: No direct upgrade available 8 | expires: "2023-11-02T12:00:00.000Z" 9 | - dotenv-rails > railties > actionpack > rack-test: 10 | reason: No direct upgrade available 11 | expires: "2023-11-02T12:00:00.000Z" 12 | -------------------------------------------------------------------------------- /.version: -------------------------------------------------------------------------------- 1 | v5.18.0 -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Please see [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md) for information on contributing to this repo. 4 | -------------------------------------------------------------------------------- /DEPLOYMENT.md: -------------------------------------------------------------------------------- 1 | # Releasing the gem 2 | 3 | ## Credentials set up 4 | 5 | Make sure you have access in https://rubygems.org/gems/auth0/ and that your Ruby Gems tokens are set in `~/.gem/credentials`. 6 | 7 | In order to generate the required changelog entry, define an environment variable `GITHUB_READ_TOKEN` with a Github API token that has READ access to `repo:public_repo`. You can generate a Github API Token [here](https://github.com/settings/tokens/new?description=GitHub%20Changelog%20Generator%20token). 8 | 9 | Create a new Github Milestone with the version name prefixed with `v`. i.e. `v4.10.2`. Assign every Issue and Pull Request to be included on this release to that Milestone, and tag them with the `CH:xxxxxx` labels, depending on the type of change fixed or introduced there. 10 | 11 | Finally, follow the next steps: 12 | 13 | ```bash 14 | # Install gems for exec commands 15 | bundle install 16 | 17 | # Run all tests 18 | bundle exec rake test 19 | 20 | # Create a release branch 21 | git checkout master 22 | git pull 23 | git checkout -b release-X.X.X 24 | git push --set-upstream origin release-X.X.X 25 | 26 | # Update the version number 27 | # This will create a commit with the new version 28 | bundle exec gem bump --version X.X.X 29 | 30 | # Make sure the Gemfile.lock is up-to-date 31 | bundle update 32 | git commit -am "Update gems" 33 | 34 | # Generate the changelog 35 | github_changelog_generator -t $GITHUB_READ_TOKEN 36 | # ... or similar. 37 | # Review the changelog 38 | # Remove "unreleased" section 39 | # Make sure the tags are ordered 40 | 41 | # Commit, push, and create a PR for this release 42 | git commit -am "Update CHANGELOG.md" 43 | git push 44 | 45 | # Add related milestone 46 | # Create PR on GitHub and assign for review 47 | # Merge/rebase and delete branch once approved 48 | 49 | # Create and add a tag 50 | git checkout master 51 | git pull 52 | bundle exec gem tag 53 | git push origin vX.X.X 54 | # Create a new release from this tag on GitHub using markdown from the changelog 55 | 56 | # Make sure you are an author for this gem here https://rubygems.org/gems/auth0/ 57 | # Rubygems token can be updated in ~/.gem/credentials 58 | bundle exec gem release 59 | ``` 60 | 61 | The steps above were tested with Ruby `v2.5.7`. 62 | -------------------------------------------------------------------------------- /DEVELOPMENT.md: -------------------------------------------------------------------------------- 1 | # Development 2 | 3 | In order to set up the local environment you'd have to have Ruby installed and a few global gems used to run and record the unit tests. A working Ruby version can be taken from the [CI script](/.circleci/config.yml). At the moment of this writting we're using Ruby `2.5.7`. 4 | 5 | > It is expected that every Pull Request introducing a fix, change or feature contains enough test coverage to assert the new behavior. 6 | 7 | ## Running the tests 8 | 9 | Install the gems required for this project. 10 | 11 | ```bash 12 | bundle install 13 | ``` 14 | 15 | Finally, run the tests. 16 | 17 | ```bash 18 | bundle exec rake test 19 | ``` 20 | 21 | ### Running only unit tests 22 | 23 | You can run only the unit tests and ignore the integration tests by running the following: 24 | 25 | ```bash 26 | bundle exec rake spec 27 | ``` 28 | 29 | ### Running only integration tests 30 | 31 | You can run only the unit tests and ignore the integration tests by running the following: 32 | 33 | ```bash 34 | bundle exec rake integration 35 | ``` 36 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5 2 | 3 | WORKDIR /home/app 4 | 5 | COPY . /home/app 6 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in auth0.gemspec 4 | gemspec 5 | 6 | group :development do 7 | gem 'terminal-notifier-guard', require: false unless ENV['CIRCLECI'] 8 | gem 'coveralls', require: false 9 | gem 'rubocop', require: false 10 | gem 'rubocop-rails', require: false 11 | gem 'irb', require: false 12 | end 13 | 14 | group :test do 15 | gem 'webmock', require: false 16 | gem 'vcr', require: false 17 | gem 'simplecov-cobertura' 18 | gem 'timecop', require: false 19 | gem 'pp' 20 | end 21 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | scope group: :unit_test 2 | 3 | group :unit_test do 4 | guard 'rspec', cmd: 5 | "bundle exec rspec -P \"spec/lib/auth0/**/*#{ENV['PATTERN']}*_spec.rb\"--drb --format Fuubar --color" do 6 | # run every updated spec file 7 | watch(%r{^spec/.+_spec\.rb$}) 8 | # run the lib specs when a file in lib/ changes 9 | watch(%r{^lib/(.+)\.rb$}) { 'spec' } 10 | # run all test for helper changes 11 | watch('spec/spec_helper.rb') { 'spec' } 12 | end 13 | end 14 | 15 | group :integration do 16 | guard 'rspec', cmd: 17 | "MODE=full bundle exec rspec -P \"spec/integration/**/*#{ENV['PATTERN']}*_spec.rb\" --drb --format Fuubar --color" do 18 | # run every updated spec file 19 | watch(%r{^spec/.+_spec\.rb$}) 20 | # run the lib specs when a file in lib/ changes 21 | watch(%r{^lib/(.+)\.rb$}) { 'spec' } 22 | # run all test for helper changes 23 | watch('spec/spec_helper.rb') { 'spec' } 24 | end 25 | end 26 | 27 | group :full do 28 | guard 'rspec', cmd: 29 | 'MODE=full bundle exec rspec --drb --format Fuubar --color' do 30 | # run every updated spec file 31 | watch(%r{^spec/.+_spec\.rb$}) 32 | # run the lib specs when a file in lib/ changes 33 | watch(%r{^lib/(.+)\.rb$}) { 'spec' } 34 | # run all test for helper changes 35 | watch('spec/spec_helper.rb') { 'spec' } 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Auth0, Inc. (http://auth0.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RUBYGEM.md: -------------------------------------------------------------------------------- 1 | # Publish the Gem on RubyGems.org 2 | 3 | To publish the gem set `RUBYGEMS_EMAIL` and `RUBYGEMS_PASSWORD` environment variables with your email and password from your RubyGems account respectively. 4 | Then run the following [Docker](https://docs.docker.com/engine/installation/) commands in the terminal to build and publish the gem. 5 | 6 | ```bash 7 | docker build -t auth0-publish-rubygem . 8 | docker run --rm -e RUBYGEMS_EMAIL="$RUBYGEMS_EMAIL" -e RUBYGEMS_PASSWORD="$RUBYGEMS_PASSWORD" -it auth0-publish-rubygem /bin/sh publish_rubygem.sh 9 | ``` 10 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | require 'bundler/gem_tasks' 3 | 4 | begin 5 | require 'rubocop/rake_task' 6 | 7 | require 'rspec/core/rake_task' 8 | 9 | desc 'Run Rubocop' 10 | RuboCop::RakeTask.new(:rubocop) 11 | 12 | desc 'Run Integration Tests' 13 | RSpec::Core::RakeTask.new(:integration) do |t| 14 | t.pattern = FileList["spec/integration/**/*#{ENV['PATTERN']}*_spec.rb"] 15 | end 16 | 17 | desc 'Run Unit Tests' 18 | RSpec::Core::RakeTask.new(:spec) do |t| 19 | t.pattern = FileList["spec/lib/auth0/**/*#{ENV['PATTERN']}*_spec.rb"] 20 | end 21 | 22 | desc 'Run All Suites' 23 | RSpec::Core::RakeTask.new(:all) 24 | 25 | desc 'Run unit and integration tests' 26 | task test: [:spec, :integration] 27 | 28 | task default: [:rubocop, :test] 29 | rescue LoadError 30 | puts 'Load Error - No RSpec' 31 | end 32 | -------------------------------------------------------------------------------- /auth0.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $LOAD_PATH.push File.expand_path('../lib', __FILE__) 3 | require 'auth0/version' 4 | 5 | Gem::Specification.new do |s| 6 | s.name = 'auth0' 7 | s.version = Auth0::VERSION 8 | s.authors = ['Auth0', 'Jose Romaniello', 'Ivan Petroe', 'Patrik Ragnarsson'] 9 | s.email = ['support@auth0.com'] 10 | s.homepage = 'https://github.com/auth0/ruby-auth0' 11 | s.summary = 'Auth0 API Client' 12 | s.description = 'Ruby toolkit for Auth0 API https://auth0.com.' 13 | 14 | s.files = `git ls-files`.split("\n") 15 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 16 | s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } 17 | s.require_paths = ['lib'] 18 | 19 | s.add_runtime_dependency 'rest-client', '~> 2.1' 20 | s.add_runtime_dependency 'jwt', '~> 2.7' 21 | s.add_runtime_dependency 'zache', '~> 0.12' 22 | s.add_runtime_dependency 'addressable', '~> 2.8' 23 | s.add_runtime_dependency 'retryable', '~> 3.0' 24 | 25 | s.add_development_dependency 'bundler' 26 | s.add_development_dependency 'rake', '~> 13.0' 27 | s.add_development_dependency 'fuubar', '~> 2.0' 28 | s.add_development_dependency 'guard-rspec', '~> 4.5' unless ENV['CIRCLECI'] 29 | s.add_development_dependency 'dotenv-rails', '~> 2.0' 30 | s.add_development_dependency 'rspec', '~> 3.11' 31 | s.add_development_dependency 'simplecov', '~> 0.9' 32 | s.add_development_dependency 'faker', '~> 2.0' 33 | s.license = 'MIT' 34 | end 35 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: "60...100" 5 | status: 6 | project: 7 | default: 8 | enabled: true 9 | target: auto 10 | threshold: 5% 11 | if_no_uploads: error 12 | patch: 13 | default: 14 | enabled: true 15 | target: 80% 16 | threshold: 30% 17 | if_no_uploads: error 18 | changes: 19 | default: 20 | enabled: true 21 | if_no_uploads: error 22 | comment: false -------------------------------------------------------------------------------- /examples/ruby-api/.env.example: -------------------------------------------------------------------------------- 1 | AUTH0_CLIENT_ID={CLIENT_ID} 2 | AUTH0_CLIENT_SECRET={CLIENT_SECRET} 3 | -------------------------------------------------------------------------------- /examples/ruby-api/.gitignore: -------------------------------------------------------------------------------- 1 | ### Ruby template 2 | *.gem 3 | *.rbc 4 | /.config 5 | /coverage/ 6 | /InstalledFiles 7 | /pkg/ 8 | /spec/reports/ 9 | /spec/examples.txt 10 | /test/tmp/ 11 | /test/version_tmp/ 12 | /tmp/ 13 | 14 | ## Specific to RubyMotion: 15 | .dat* 16 | .repl_history 17 | build/ 18 | 19 | ## Environment normalisation: 20 | /.bundle/ 21 | /vendor/bundle 22 | /lib/bundler/man/ 23 | 24 | # for a library or gem, you might want to ignore these files since the code is 25 | # intended to run in multiple environments; otherwise, check them in: 26 | # Gemfile.lock 27 | # .ruby-version 28 | # .ruby-gemset 29 | 30 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 31 | .rvmrc 32 | ### JetBrains template 33 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 34 | 35 | *.iml 36 | 37 | ## Directory-based project format: 38 | .idea/ 39 | # if you remove the above rule, at least ignore the following: 40 | 41 | # User-specific stuff: 42 | # .idea/workspace.xml 43 | # .idea/tasks.xml 44 | # .idea/dictionaries 45 | 46 | # Sensitive or high-churn files: 47 | # .idea/dataSources.ids 48 | # .idea/dataSources.xml 49 | # .idea/sqlDataSources.xml 50 | # .idea/dynamic.xml 51 | # .idea/uiDesigner.xml 52 | 53 | # Gradle: 54 | # .idea/gradle.xml 55 | # .idea/libraries 56 | 57 | # Mongo Explorer plugin: 58 | # .idea/mongoSettings.xml 59 | 60 | ## File-based project format: 61 | *.ipr 62 | *.iws 63 | 64 | ## Plugin-specific files: 65 | 66 | # IntelliJ 67 | /out/ 68 | 69 | # mpeltonen/sbt-idea plugin 70 | .idea_modules/ 71 | 72 | # JIRA plugin 73 | atlassian-ide-plugin.xml 74 | 75 | # Crashlytics plugin (for Android Studio and IntelliJ) 76 | com_crashlytics_export_strings.xml 77 | crashlytics.properties 78 | crashlytics-build.properties 79 | 80 | .env -------------------------------------------------------------------------------- /examples/ruby-api/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # A sample Gemfile 3 | source 'http://rubygems.org' 4 | 5 | # gem "rails" 6 | gem 'sinatra', '~> 2.2' 7 | gem 'jwt', '~> 2.5' 8 | gem 'dotenv' 9 | gem 'puma' 10 | -------------------------------------------------------------------------------- /examples/ruby-api/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | dotenv (2.8.1) 5 | jwt (2.5.0) 6 | mustermann (2.0.2) 7 | ruby2_keywords (~> 0.0.1) 8 | nio4r (2.7.3) 9 | puma (5.6.9) 10 | nio4r (~> 2.0) 11 | rack (2.2.9) 12 | rack-protection (2.2.3) 13 | rack 14 | ruby2_keywords (0.0.5) 15 | sinatra (2.2.3) 16 | mustermann (~> 2.0) 17 | rack (~> 2.2) 18 | rack-protection (= 2.2.3) 19 | tilt (~> 2.0) 20 | tilt (2.0.11) 21 | 22 | PLATFORMS 23 | aarch64-linux 24 | x86_64-linux 25 | 26 | DEPENDENCIES 27 | dotenv 28 | jwt (~> 2.5) 29 | puma 30 | sinatra (~> 2.2) 31 | 32 | BUNDLED WITH 33 | 2.3.7 34 | -------------------------------------------------------------------------------- /examples/ruby-api/README.md: -------------------------------------------------------------------------------- 1 | # Auth0 + Ruby API Seed 2 | 3 | This is the seed project you need to use if you're going to create a Ruby API. You'll mostly use this API either for a SPA or a Mobile app. 4 | 5 | # Running the example 6 | 7 | In order to run the example you need to have ruby installed. 8 | 9 | You also need to set the ClientSecret and ClientId for your Auth0 app as enviroment variables with the following names respectively: AUTH0_CLIENT_SECRET and AUTH0_CLIENT_ID. 10 | 11 | For that, if you just create a file named .env in the directory and set the values like the following, the app will just work: 12 | 13 | ````bash 14 | # .env file 15 | AUTH0_CLIENT_SECRET=myCoolSecret 16 | AUTH0_CLIENT_ID=myCoolClientId 17 | ```` 18 | 19 | Once you've set those 2 enviroment variables, run `bundle install`, then run `rackup -p 3001` and try calling [http://localhost:3001/ping](http://localhost:3001/ping) 20 | 21 | You can then try to do a GET to [http://localhost:3001/secured/ping](http://localhost:3001/secured/ping) which will throw an error if you don't send the JWT in the header. 22 | 23 | __Note:__ if you need to enable cross-origin resource sharing, check out the [sinatra-cors_origin]( 24 | https://github.com/britg/sinatra-cross_origin) gem. 25 | -------------------------------------------------------------------------------- /examples/ruby-api/config.ru: -------------------------------------------------------------------------------- 1 | require './main' 2 | run Sinatra::Application 3 | -------------------------------------------------------------------------------- /examples/ruby-api/main.rb: -------------------------------------------------------------------------------- 1 | require 'dotenv' 2 | require 'jwt' 3 | require 'sinatra' 4 | Dotenv.load '.env' 5 | set :show_exceptions, false 6 | 7 | class InvalidTokenError < StandardError 8 | end 9 | 10 | def validate_token(env) 11 | auth0_client_id = ENV['AUTH0_CLIENT_ID'] 12 | auth0_client_secret = ENV['AUTH0_CLIENT_SECRET'] 13 | authorization = env['HTTP_AUTHORIZATION'] 14 | raise InvalidTokenError if authorization.nil? 15 | decoded_token = JWT.decode(authorization.split(' ').last, JWT.base64url_decode(auth0_client_secret)) 16 | raise InvalidTokenError if auth0_client_id != decoded_token[0]['aud'] 17 | 'You get this only if authenticated' 18 | rescue JWT::DecodeError 19 | raise InvalidTokenError 20 | end 21 | 22 | error InvalidTokenError do 23 | 'Invalid token' 24 | end 25 | 26 | get '/secured/ping' do 27 | validate_token env 28 | 'All good. You can see it because token is valid' 29 | end 30 | 31 | get '/ping' do 32 | 'ping' 33 | end 34 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/.env.example: -------------------------------------------------------------------------------- 1 | AUTH0_CLIENT_ID={CLIENT_ID} 2 | AUTH0_CLIENT_SECRET={CLIENT_SECRET} 3 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/*.log 16 | /tmp 17 | 18 | .env 19 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 4 | gem 'rails', '5.0.0.1' 5 | # Use sqlite3 as the database for Active Record 6 | gem 'sqlite3', groups: [:development, :test] 7 | 8 | gem 'pg' 9 | # Use SCSS for stylesheets 10 | gem 'sass-rails', '~> 5.0.6' 11 | # Use Uglifier as compressor for JavaScript assets 12 | gem 'uglifier', '>= 3.0.3' 13 | # Use CoffeeScript for .js.coffee assets and views 14 | gem 'coffee-rails', '~> 4.2.1' 15 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 16 | # gem 'therubyracer', platforms: :ruby 17 | 18 | # Use jquery as the JavaScript library 19 | gem 'jquery-rails' 20 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 21 | gem 'turbolinks' 22 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 23 | gem 'jbuilder', '~> 2.6.0' 24 | # bundle exec rake doc:rails generates the API under doc/api. 25 | gem 'sdoc', '~> 0.4.2', group: :doc 26 | # knock dependency 27 | gem 'knock', '~> 2.0' 28 | 29 | # Dot env 30 | gem 'dotenv-rails', groups: [:development, :test] 31 | 32 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 33 | gem 'spring', group: :development 34 | 35 | gem 'pry', group: [:development, :test] 36 | 37 | # Use ActiveModel has_secure_password 38 | # gem 'bcrypt', '~> 3.1.7' 39 | 40 | # Use unicorn as the app server 41 | # gem 'unicorn' 42 | 43 | # Use Capistrano for deployment 44 | # gem 'capistrano-rails', group: :development 45 | 46 | # Use debugger 47 | # gem 'debugger', group: [:development, :test] 48 | gem 'tzinfo-data' 49 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/README.md: -------------------------------------------------------------------------------- 1 | #Auth0 + Ruby on Rails API Seed 2 | 3 | This is the seed project you need to use if you're going to create a Ruby on Rails API. You'll mostly use this API either for a SPA or a Mobile app. If you just want to create a Regular Ruby on Rails WebApp, please check this [other seed project](https://github.com/auth0/omniauth-auth0) 4 | 5 | #Running the example 6 | 7 | In order to run the example you need to have ruby installed. 8 | 9 | You also need to set the ClientSecret and ClientId for your Auth0 app as enviroment variables with the following names respectively: AUTH0_CLIENT_SECRET and AUTH0_CLIENT_ID. 10 | 11 | For that, if you just create a file named .env in the directory and set the values like the following, the app will just work: 12 | 13 | ````bash 14 | # .env file 15 | AUTH0_CLIENT_SECRET=myCoolSecret 16 | AUTH0_CLIENT_ID=myCoolClientId 17 | ```` 18 | 19 | Once you've set those 2 enviroment variables, run `bundle install`, then run `rails s` and try calling [http://localhost:3000/ping](http://localhost:3000/ping) 20 | 21 | You can then try to do a GET to [http://localhost:3000/secured/ping](http://localhost:3000/secured/ping) which will throw an error if you don't send the JWT in the header. 22 | 23 | __Note:__ if you need to enable cross-origin resource sharing, check out the [rack-cors](https://github.com/cyu/rack-cors) gem. 24 | 25 | __Note:__ if you are using Windows, add the `tzinfo-data` gem to the gemfile. 26 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/app/assets/images/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # Application Controller 2 | class ApplicationController < ActionController::Base 3 | include Knock::Authenticable 4 | 5 | # Prevent CSRF attacks by raising an exception. 6 | # For APIs, you may want to use :null_session instead. 7 | protect_from_forgery with: :null_session 8 | end 9 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/controllers/ping_controller.rb: -------------------------------------------------------------------------------- 1 | # Ping Controller 2 | class PingController < ApplicationController 3 | def ping 4 | render text: "All good. You don't need to be authenticated to call this" 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb: -------------------------------------------------------------------------------- 1 | # Secured ping Controller 2 | class SecuredPingController < ApplicationController 3 | before_action :authenticate_user 4 | 5 | def ping 6 | render json: { 7 | message: "All good. You only get this message if you're authenticated.", 8 | user: current_user 9 | } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # Application Helper 2 | module ApplicationHelper 3 | end 4 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/app/mailers/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/app/models/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/models/User.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | def self.from_token_payload payload 3 | payload["sub"] 4 | end 5 | end -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/app/models/concerns/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Auth0RorapiSample 5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby.exe 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts '== Installing dependencies ==' 12 | system 'gem install bundler --conservative' 13 | system 'bundle check || bundle install' 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system 'bin/rake db:setup' 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system 'rm -f log/*' 25 | system 'rm -rf tmp/cache' 26 | 27 | puts "\n== Restarting application server ==" 28 | system 'touch tmp/restart.txt' 29 | end 30 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Auth0RorapiSample 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | adapter: postgresql 25 | database: my_database_production 26 | pool: 5 27 | timeout: 5000 28 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Adds additional error checking when serving assets at runtime. 31 | # Checks for improperly declared sprockets dependencies. 32 | # Raises helpful error messages. 33 | config.assets.raise_runtime_errors = true 34 | 35 | # Raises error for missing translations 36 | # config.action_view.raise_on_missing_translations = true 37 | end 38 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static asset server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Print deprecation notices to the stderr. 35 | config.active_support.deprecation = :stderr 36 | 37 | # Raises error for missing translations 38 | # config.action_view.raise_on_missing_translations = true 39 | 40 | config.active_support.test_order = :sorted 41 | end 42 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/dotenv.rb: -------------------------------------------------------------------------------- 1 | if Rails.env.development? || Rails.env.test? 2 | require 'dotenv' 3 | Dotenv.load 4 | end 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/knock.rb: -------------------------------------------------------------------------------- 1 | require 'base64' 2 | Knock.setup do |config| 3 | 4 | ## Expiration claim 5 | ## ---------------- 6 | ## 7 | ## How long before a token is expired. 8 | ## 9 | ## Default: 10 | # config.token_lifetime = 1.day 11 | 12 | ## Audience claim 13 | ## -------------- 14 | ## 15 | ## Configure the audience claim to indentify the recipients that the token 16 | ## is intended for. 17 | ## 18 | ## Default: 19 | # config.token_audience = nil 20 | 21 | ## If using Auth0, uncomment the line below 22 | config.token_audience = -> { Rails.application.secrets.auth0_client_id } 23 | 24 | ## Signature key 25 | ## ------------- 26 | ## 27 | ## Configure the key used to sign tokens. 28 | ## 29 | ## Default: 30 | # config.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base } 31 | 32 | ## If using Auth0, uncomment the line below 33 | config.token_secret_signature_key = -> { JWT.base64url_decode Rails.application.secrets.auth0_client_secret } 34 | 35 | end 36 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_auth0-rorapi-sample_session' 4 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | get 'ping' => 'ping#ping' 3 | get 'secured/ping' => 'secured_ping#ping' 4 | # The priority is based upon order of creation: first created -> highest priority. 5 | # See how all your routes lay out with "rake routes". 6 | 7 | # You can have the root of your site routed with "root" 8 | # root 'welcome#index' 9 | 10 | # Example of regular route: 11 | # get 'products/:id' => 'catalog#view' 12 | 13 | # Example of named route that can be invoked with purchase_url(id: product.id) 14 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 15 | 16 | # Example resource route (maps HTTP verbs to controller actions automatically): 17 | # resources :products 18 | 19 | # Example resource route with options: 20 | # resources :products do 21 | # member do 22 | # get 'short' 23 | # post 'toggle' 24 | # end 25 | # 26 | # collection do 27 | # get 'sold' 28 | # end 29 | # end 30 | 31 | # Example resource route with sub-resources: 32 | # resources :products do 33 | # resources :comments, :sales 34 | # resource :seller 35 | # end 36 | 37 | # Example resource route with more complex sub-resources: 38 | # resources :products do 39 | # resources :comments 40 | # resources :sales do 41 | # get 'recent', on: :collection 42 | # end 43 | # end 44 | 45 | # Example resource route with concerns: 46 | # concern :toggleable do 47 | # post 'toggle' 48 | # end 49 | # resources :posts, concerns: :toggleable 50 | # resources :photos, concerns: :toggleable 51 | 52 | # Example resource route within a namespace: 53 | # namespace :admin do 54 | # # Directs /admin/products/* to Admin::ProductsController 55 | # # (app/controllers/admin/products_controller.rb) 56 | # resources :products 57 | # end 58 | end 59 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 3342e9faedd8fe9ea360c0af568d00a46917923791c23e144d66849b272d2ff63e743f9bb209dab7d6e732bb5f919e46e3fe552b8919140805bb89c346e68876, 15 | auth0_client_id: <%= ENV["AUTH0_CLIENT_ID"] %> 16 | auth0_client_secret: <%= ENV["AUTH0_CLIENT_SECRET"] %> 17 | 18 | test: 19 | secret_key_base: 8e3352b5ca46c3362f54b183ee64ff4281f298eee2f5ec8154031c8e1610eab54f868d937725209d49b41534ddbc98fabb7b1a2f74bde5f0ee311a529baf3e08 20 | auth0_client_id: <%= ENV["AUTH0_CLIENT_ID"] %> 21 | auth0_client_secret: <%= ENV["AUTH0_CLIENT_SECRET"] %> 22 | 23 | # Do not keep production secrets in the repository, 24 | # instead read values from the environment. 25 | production: 26 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 27 | auth0_client_id: <%= ENV["AUTH0_CLIENT_ID"] %> 28 | auth0_client_secret: <%= ENV["AUTH0_CLIENT_SECRET"] %> 29 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 0) do 15 | end 16 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/lib/assets/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/lib/tasks/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/log/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/public/favicon.ico -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/test/controllers/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/test/fixtures/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/test/helpers/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/test/integration/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/test/mailers/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0/ruby-auth0/aed1d67f9c9213b99a13f371e10ef8feebe7fee0/examples/ruby-on-rails-api/test/models/.keep -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/ping_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | # Ping Controller Tests 3 | class PingControllerTest < ActionController::TestCase 4 | test 'responds with success' do 5 | get :ping 6 | assert_response :success 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/secured_ping_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | # Secure Ping Controller Test 3 | class SecuredPingControllerTest < ActionController::TestCase 4 | def with_a_valid_token 5 | @user = { id: 1 } 6 | @token = Knock::AuthToken.new(payload: { sub: @user[:id] }).token 7 | @request.env['HTTP_AUTHORIZATION'] = "Bearer #{@token}" 8 | end 9 | 10 | test 'responds with unauthorized' do 11 | get :ping 12 | assert_response :unauthorized 13 | end 14 | 15 | test 'responds with success when passing a valid token' do 16 | with_a_valid_token 17 | get :ping 18 | assert_response :success 19 | end 20 | 21 | test '@current_user is set when passing a valid token' do 22 | with_a_valid_token 23 | get :ping 24 | assert_equal @user[:id], @controller.current_user[:id] 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /examples/ruby-on-rails-api/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | # Active Support 5 | class ActiveSupport 6 | # Test Case 7 | class TestCase 8 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 9 | # 10 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 11 | # -- they do not yet inherit this setting 12 | fixtures :all 13 | 14 | # Add more helper methods to be used by all tests here... 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/auth0.rb: -------------------------------------------------------------------------------- 1 | require 'auth0/version' 2 | require 'auth0/mixins' 3 | require 'auth0/exception' 4 | require 'auth0/algorithm' 5 | require 'auth0/client' 6 | require 'auth0_client' 7 | # Namespace for ruby-auth0 logic 8 | module Auth0 9 | end 10 | -------------------------------------------------------------------------------- /lib/auth0/algorithm.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Algorithm 3 | include Auth0::Mixins::Validation::Algorithm 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/anomaly.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Api 3 | module V2 4 | # Methods to use the anomaly endpoints 5 | module Anomaly 6 | # Use this route to determine if a given IP is currently blocked 7 | # by the failed login to multiple user accounts trigger. 8 | # @see https://auth0.com/docs/api/management/v2#!/Anomaly/get_ips_by_id 9 | # @param ip [string] The IP to check. 10 | def check_if_ip_is_blocked(ip) 11 | raise Auth0::InvalidParameter, 'Must specify an IP' if ip.to_s.empty? 12 | 13 | path = "#{anomaly_path}/#{ip}" 14 | get(path) 15 | end 16 | 17 | # Resets an IP that is currently blocked by the failed login to multiple user accounts trigger. 18 | # @see https://auth0.com/docs/api/management/v2#!/Anomaly/delete_ips_by_id 19 | # @param ip [string] The IP to remove block. 20 | def remove_ip_block(ip) 21 | raise Auth0::InvalidParameter, 'Must specify an IP' if ip.to_s.empty? 22 | 23 | path = "#{anomaly_path}/#{ip}" 24 | delete(path) 25 | end 26 | 27 | private 28 | 29 | # Anomaly API path 30 | def anomaly_path 31 | @anomaly_path ||= '/api/v2/anomaly/blocks/ips' 32 | end 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/blacklists.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Api 3 | module V2 4 | # Methods to use the blacklist endpoints 5 | module Blacklists 6 | attr_reader :blacklists_path 7 | 8 | # Retrieves the jti and aud of all tokens in the blacklist. 9 | # @see https://auth0.com/docs/api/v2#!/Blacklists/get_tokens 10 | # @param aud [string] The JWT's aud claim. The client_id of the client for which it was issued 11 | # 12 | # @return [json] Returns the blacklisted tokens 13 | # 14 | def blacklisted_tokens(aud = nil) 15 | request_params = { 16 | aud: aud 17 | } 18 | get(blacklists_path, request_params) 19 | end 20 | 21 | # Adds the token identified by the jti to a blacklist for the tenant. 22 | # @see https://auth0.com/docs/api/v2#!/blacklists/post_tokens 23 | # @param jti [string] The jti of the JWT to blacklist 24 | # @param aud [string] The JWT's aud claim. The client_id of the client for which it was issued 25 | # @return [json] Returns the blacklisted token 26 | # 27 | def add_token_to_blacklist(jti, aud = nil) 28 | raise Auth0::MissingParameter, 'Must specify a valid JTI' if jti.to_s.empty? 29 | request_params = { 30 | jti: jti, 31 | aud: aud 32 | } 33 | post(blacklists_path, request_params) 34 | end 35 | 36 | private 37 | 38 | # Blacklists API path 39 | def blacklists_path 40 | @blacklists_path ||= '/api/v2/blacklists/tokens' 41 | end 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/emails.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Api 3 | module V2 4 | # Methods to use the connections endpoints 5 | module Emails 6 | attr_reader :email_path 7 | 8 | # Get all the email providers. 9 | # @see https://auth0.com/docs/api/v2#!/Emails/get_provider 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 | # 13 | # @return [json] Returns the existing email providers. 14 | def get_provider(fields: nil, include_fields: nil) 15 | request_params = { 16 | fields: fields, 17 | include_fields: include_fields 18 | } 19 | get(email_path, request_params) 20 | end 21 | 22 | # Configure a new email provider. 23 | # @see https://auth0.com/docs/api/v2#!/Emails/post_provider 24 | # @param body [hash] The Hash options used to specify the email provider's properties. 25 | def configure_provider(body) 26 | raise Auth0::InvalidParameter, 'Must supply a valid body to create an email provider' if body.to_s.empty? 27 | post(email_path, body) 28 | end 29 | 30 | # Deletes the configured email provider. 31 | # @see https://auth0.com/docs/api/v2#!/Emails/delete_provider 32 | # 33 | # @return [json] Returns the created email provider. 34 | def delete_provider 35 | delete(email_path) 36 | end 37 | 38 | # Updates the configured email provider. 39 | # @see https://auth0.com/docs/api/v2#!/Emails/patch_provider 40 | # @param body [hash] The Hash options used to specify the email provider's properties. 41 | # 42 | # @return [json] Returns the updated email provider. 43 | def update_provider(body) 44 | raise Auth0::InvalidParameter, 'Must supply a valid body to update an email provider' if body.to_s.empty? 45 | patch(email_path, body) 46 | end 47 | 48 | private 49 | 50 | def email_path 51 | @email_path ||= '/api/v2/emails/provider' 52 | end 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/grants.rb: -------------------------------------------------------------------------------- 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 50 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/refresh_tokens.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Auth0 4 | module Api 5 | module V2 6 | # Methods to use the Refresh Token endpoints 7 | module RefreshTokens 8 | # Retrieve refresh token information. 9 | # @see https://auth0.com/docs/api/management/v2/refresh-tokens/get-refresh-token 10 | # @param id [string] The id of the refresh token to retrieve 11 | def refresh_token(id) 12 | raise Auth0::InvalidParameter, 'Must supply a valid id' if id.to_s.empty? 13 | 14 | get "#{resource_path}/#{id}" 15 | end 16 | 17 | # Delete a refresh token by its ID. 18 | # @see https://auth0.com/docs/api/management/v2/refresh-tokens/delete-refresh-token 19 | # @param id [string] The id of the refresh token to delete 20 | def delete_refresh_token(id) 21 | raise Auth0::InvalidParameter, 'Must supply a valid id' if id.to_s.empty? 22 | 23 | delete "#{resource_path}/#{id}" 24 | end 25 | 26 | private 27 | 28 | def resource_path 29 | @resource_path ||= '/api/v2/refresh-tokens' 30 | end 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/sessions.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Auth0 4 | module Api 5 | module V2 6 | # Methods to use the Session endpoints 7 | module Sessions 8 | # Retrieve session information by id 9 | # @see https://auth0.com/docs/api/management/v2/sessions/get-session 10 | # @param id [string] The id of the session to retrieve. 11 | def session(session_id) 12 | raise Auth0::InvalidParameter, 'Must supply a valid session_id' if session_id.to_s.empty? 13 | 14 | get "#{sessions_path}/#{session_id}" 15 | end 16 | 17 | # Deletes a session by id 18 | # @see https://auth0.com/docs/api/management/v2/sessions/delete-session 19 | # @param id [string] The id of the session to delete. 20 | def delete_session(session_id) 21 | raise Auth0::InvalidParameter, 'Must supply a valid session_id' if session_id.to_s.empty? 22 | 23 | delete "#{sessions_path}/#{session_id}" 24 | end 25 | 26 | # Revokes a session by ID and all associated refresh tokens 27 | # @see https://auth0.com/docs/api/management/v2/sessions/revoke-session 28 | # @param id [string] The ID of the session to revoke 29 | def revoke_session(session_id) 30 | raise Auth0::InvalidParameter, 'Must supply a valid session_id' if session_id.to_s.empty? 31 | 32 | post "#{sessions_path}/#{session_id}/revoke" 33 | end 34 | 35 | private 36 | 37 | def sessions_path 38 | @sessions_path ||= '/api/v2/sessions' 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/stats.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Api 3 | module V2 4 | # Methods to use the stats endpoints 5 | module Stats 6 | attr_reader :stats_path 7 | 8 | # Gets the active users count (logged in during the last 30 days). 9 | # @see https://auth0.com/docs/api/v2#!/Stats/get_active_users 10 | # 11 | # @return [integer] Returns the active users count. 12 | def active_users 13 | path = "#{stats_path}/active-users" 14 | get(path) 15 | end 16 | 17 | # Gets the daily stats for a particular period. 18 | # @see https://auth0.com/docs/api/v2#!/Stats/get_daily 19 | # @param from [string] The first day of the period (inclusive) in YYYYMMDD format. 20 | # @param to [string] The last day of the period (inclusive) in YYYYMMDD format. 21 | # 22 | # @return [json] Returns the daily stats. 23 | def daily_stats(from, to) 24 | path = "#{stats_path}/daily" 25 | request_params = { 26 | from: from, 27 | to: to 28 | } 29 | get(path, request_params) 30 | end 31 | 32 | private 33 | 34 | # Stats API path 35 | def stats_path 36 | @stats_path ||= '/api/v2/stats' 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/tenants.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Api 3 | module V2 4 | # Methods to use the Tenants endpoints 5 | module Tenants 6 | attr_reader :tenant_path 7 | 8 | # Gets tenants settings. 9 | # @see https://auth0.com/docs/api/v2#!/Tenants/get_settings 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 | # 13 | # @return [json] Returns tenants settings. 14 | def get_tenant_settings(fields: nil, include_fields: true) 15 | request_params = { 16 | fields: fields, 17 | include_fields: include_fields 18 | } 19 | get(tenant_path, request_params) 20 | end 21 | 22 | # Updates tenants settings. 23 | # @see https://auth0.com/docs/api/v2#!/Tenants/patch_settings 24 | # @param body [hash] The Hash body used to define the tenant settings' values. 25 | # 26 | # @return [json] Returns the updated tenant settings. 27 | def update_tenant_settings(body) 28 | raise Auth0::InvalidParameter, 'Must supply a valid body to update tenant settings' if body.to_s.empty? 29 | patch(tenant_path, body) 30 | end 31 | 32 | private 33 | 34 | # Tenants settings API path 35 | def tenant_path 36 | @tenant_path ||= '/api/v2/tenants/settings' 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/auth0/api/v2/users_by_email.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Api 3 | module V2 4 | # Methods to use the Users By Email endpoints 5 | module UsersByEmail 6 | attr_reader :users_by_email_path 7 | 8 | # Retrieves a list of existing users by their email. 9 | # @see https://auth0.com/docs/api/v2#!/Users/get_users 10 | # @see https://auth0.com/docs/api/management/v2#!/Users_By_Email/get_users_by_email 11 | # @param email [string] E-mail to be searched 12 | # @param options [hash] 13 | # * :fields [string] A comma separated list of fields to include or exclude from the result. 14 | # * :include_fields [boolean] True if the fields specified are to be included in the result, false otherwise. 15 | # 16 | # @return [json] Returns the list of existing users. 17 | def users_by_email(email, options = {}) 18 | raise Auth0::InvalidParameter, 'Must supply a valid email' if email.to_s.empty? 19 | request_params = { 20 | fields: options.fetch(:fields, nil), 21 | include_fields: options.fetch(:include_fields, nil) 22 | } 23 | request_params[:email] = email 24 | get(users_by_email_path, request_params) 25 | end 26 | 27 | private 28 | 29 | # Users By Emails API path 30 | def users_by_email_path 31 | @users_by_email_path ||= '/api/v2/users-by-email' 32 | end 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/auth0/client.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | # Main class 3 | # All Api calls are supposed to return hashes, but delete actions return strings. 4 | class Client 5 | include Auth0::Mixins 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/auth0/client_assertion.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'jwt' 4 | 5 | module Auth0 6 | module ClientAssertion 7 | CLIENT_ASSERTION_TYPE = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'.freeze 8 | 9 | # Adds keys into the supplied hash for either the client secret, or client assertion. If `client_assertion_signing_key` is not nil, 10 | # it takes precedence over `client_secret`. 11 | # @param [hash] The hash to add the keys to 12 | # @param client_id [string] The client ID 13 | # @param client_secret [string] The client secret 14 | # @param client_assertion_signing_key [PKey] The key used to sign the client assertion JWT 15 | # @param client_assertion_signing_alg [string] The algorithm used when signing the client assertion JWT 16 | def populate_client_assertion_or_secret(hash, 17 | domain: @domain, 18 | client_id: @client_id, 19 | client_secret: @client_secret, 20 | client_assertion_signing_key: @client_assertion_signing_key, 21 | client_assertion_signing_alg: @client_assertion_signing_alg) 22 | 23 | if !client_assertion_signing_key.nil? 24 | # Create JWT 25 | now = Time.now.to_i 26 | 27 | payload = { 28 | iss: client_id, 29 | sub: client_id, 30 | aud: "https://#{domain}/", 31 | iat: now, 32 | exp: now + 180, 33 | jti: SecureRandom.uuid 34 | } 35 | 36 | jwt = JWT.encode payload, client_assertion_signing_key, client_assertion_signing_alg 37 | 38 | hash[:client_assertion] = jwt 39 | hash[:client_assertion_type] = Auth0::ClientAssertion::CLIENT_ASSERTION_TYPE 40 | else 41 | hash[:client_secret] = client_secret 42 | end 43 | end 44 | end 45 | end -------------------------------------------------------------------------------- /lib/auth0/mixins.rb: -------------------------------------------------------------------------------- 1 | require 'base64' 2 | require 'rest-client' 3 | require 'uri' 4 | 5 | require 'auth0/mixins/access_token_struct' 6 | require 'auth0/mixins/api_token_struct' 7 | require 'auth0/mixins/headers' 8 | require 'auth0/mixins/httpproxy' 9 | require 'auth0/mixins/initializer' 10 | require 'auth0/mixins/permission_struct' 11 | require 'auth0/mixins/validation' 12 | require 'auth0/mixins/token_management' 13 | 14 | require 'auth0/api/authentication_endpoints' 15 | require 'auth0/api/v2' 16 | 17 | module Auth0 18 | # Collecting dependencies here 19 | module Mixins 20 | include Auth0::Mixins::Headers 21 | include Auth0::Mixins::TokenManagement 22 | include Auth0::Mixins::HTTPProxy 23 | include Auth0::Mixins::Initializer 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/auth0/mixins/access_token_struct.rb: -------------------------------------------------------------------------------- 1 | Auth0::AccessToken = Struct.new( 2 | :access_token, 3 | :expires_in, 4 | :refresh_token, 5 | :id_token 6 | ) do 7 | 8 | def self.from_response(response) 9 | new( 10 | response['access_token'], 11 | response['expires_in'], 12 | response['refresh_token'], 13 | response['id_token'] 14 | ) 15 | end 16 | 17 | def token 18 | access_token 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/auth0/mixins/api_token_struct.rb: -------------------------------------------------------------------------------- 1 | Auth0::ApiToken = Struct.new :access_token, :scope, :expires_in do 2 | def token 3 | access_token 4 | end 5 | 6 | def scopes 7 | scope.split 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/auth0/mixins/headers.rb: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | module Auth0 4 | module Mixins 5 | # Module to provide necessary headers for API requests. 6 | module Headers 7 | def telemetry 8 | telemetry_hash = { 9 | name: 'ruby-auth0', 10 | version: Auth0::VERSION, 11 | env: { 12 | ruby: RUBY_VERSION 13 | } 14 | } 15 | 16 | if Gem.loaded_specs['rails'].respond_to? :version 17 | telemetry_hash[:env][:rails] = Gem.loaded_specs['rails'].version.to_s 18 | end 19 | 20 | telemetry_hash 21 | end 22 | 23 | def telemetry_encoded 24 | Base64.urlsafe_encode64(JSON.dump(telemetry)) 25 | end 26 | 27 | def client_headers 28 | { 29 | 'Content-Type' => 'application/json', 30 | 'Auth0-Client' => telemetry_encoded 31 | } 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /lib/auth0/mixins/permission_struct.rb: -------------------------------------------------------------------------------- 1 | Auth0::Permission = Struct.new :permission_name, :resource_server_identifier do 2 | 3 | end 4 | -------------------------------------------------------------------------------- /lib/auth0/mixins/token_management.rb: -------------------------------------------------------------------------------- 1 | module Auth0 2 | module Mixins 3 | module TokenManagement 4 | 5 | private 6 | 7 | def initialize_token(options) 8 | @token = options[:access_token] || options[:token] 9 | # default expiry to an hour if a token was given but no expires_at 10 | @token_expires_at = @token ? options[:token_expires_at] || Time.now.to_i + 3600 : nil 11 | 12 | @audience = options[:api_identifier] || "https://#{@domain}/api/v2/" 13 | get_token() if @token.nil? 14 | end 15 | 16 | def get_token 17 | # pp @token_expires_at 18 | has_expired = @token && @token_expires_at ? @token_expires_at < (Time.now.to_i + 10) : false 19 | 20 | if (@token.nil? || has_expired) && @client_id && (@client_secret || @client_assertion_signing_key) 21 | response = api_token(audience: @audience) 22 | @token = response.token 23 | @token_expires_at = response.expires_in ? Time.now.to_i + response.expires_in : nil 24 | 25 | @token 26 | else 27 | @token 28 | end 29 | end 30 | end 31 | end 32 | end -------------------------------------------------------------------------------- /lib/auth0/version.rb: -------------------------------------------------------------------------------- 1 | # current version of gem 2 | module Auth0 3 | VERSION = '5.18.0'.freeze 4 | end 5 | -------------------------------------------------------------------------------- /lib/auth0_client.rb: -------------------------------------------------------------------------------- 1 | # This class is made for backward compatibility of gem 2 | class Auth0Client < Auth0::Client 3 | end 4 | -------------------------------------------------------------------------------- /opslevel.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1 3 | repository: 4 | owner: dx_sdks 5 | tags: 6 | -------------------------------------------------------------------------------- /publish_rubygem.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Create directory for rubygems credentials 4 | mkdir /root/.gem 5 | # Get API key from rubygems.org 6 | curl -u "$RUBYGEMS_EMAIL":"$RUBYGEMS_PASSWORD" https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials 7 | # Build Gem 8 | gem build auth0.gemspec 9 | # Publish Gem 10 | gem push auth0-*.gem 11 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/delete_test_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C6132828a407ec6006935a858 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:14 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7997c2a3609-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7997c2a3609 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 1fd625fa368da82f 53 | Ot-Tracer-Traceid: 54 | - 239112363e8b8a0a 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700175' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:14 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Blacklists/_add_token_to_blacklist/should_add_a_token_to_the_blacklist.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/blacklists/tokens 6 | body: 7 | encoding: UTF-8 8 | string: '{"jti":"faketoken","aud":"2cnWuug6zaFX1j0ge1P99jAUn0F4XSuI"}' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Content-Length: 21 | - '60' 22 | Accept-Encoding: 23 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 24 | Host: 25 | - auth0-sdk-tests.auth0.com 26 | response: 27 | status: 28 | code: 204 29 | message: No Content 30 | headers: 31 | Date: 32 | - Fri, 03 Sep 2021 20:16:14 GMT 33 | Content-Type: 34 | - application/json; charset=utf-8 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a79b2d730d50-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a79b2d730d50 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 7ad121b85ac87789 55 | Ot-Tracer-Traceid: 56 | - 42b446981bf821d1 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700175' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: UTF-8 72 | string: '' 73 | recorded_at: Fri, 03 Sep 2021 20:16:14 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/_delete_client_grant/should_delete_the_test_client_grant.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/client-grants/cgr_j6Sld05vF0Sxr2Le 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:16 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7a6ced7ebc1-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7a6ced7ebc1 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 64d80a07711edb8b 53 | Ot-Tracer-Traceid: 54 | - 48ce7fbd2ff15944 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700177' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:16 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/clients/qVx7qDuyruWWCfkTrxeNT74FI6mJc4Vy 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:16 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7a7edf352cb-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7a7edf352cb 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 732e9442637ae4b8 53 | Ot-Tracer-Traceid: 54 | - 1800a0e44b1043dc 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700177' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:16 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_ClientGrants/delete_test_client_grant.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/client-grants/cgr_j6Sld05vF0Sxr2Le 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:17 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7a949250503-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7a949250503 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 0557cbf4350d96e4 53 | Ot-Tracer-Traceid: 54 | - 42ea9a27427f41df 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700177' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:16 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Clients/_delete_client/should_delete_the_test_client_without_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/clients/SftKo9ySyHnMPezQUFd0C70GBoNFM21F 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:19 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7bb0d945257-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7bb0d945257 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 6a6126bb4de85816 53 | Ot-Tracer-Traceid: 54 | - 1b97a22f2cefdbc4 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700180' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:19 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/connections/con_WltM0fv20JCnxOuY 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 202 27 | message: Accepted 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:22 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a7ce7af2052c-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a7ce7af2052c 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 5e040aee662eb6da 55 | Ot-Tracer-Traceid: 56 | - 7de2d5e5556f108f 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700183' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: '{"deleted_at":"2021-09-03T20:16:22.894Z"}' 73 | recorded_at: Fri, 03 Sep 2021 20:16:22 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_DeviceCredentials/delete_test_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C61328297148a95006b37e566 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:23 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7d47b4752cb-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7d47b4752cb 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 03b0cc5165592ec0 53 | Ot-Tracer-Traceid: 54 | - 22272a78067d9147 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700184' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:23 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_delete_the_existing_email_provider_without_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/emails/provider 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:25 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7de08df31f7-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7de08df31f7 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 7c70a5476d10fe0f 53 | Ot-Tracer-Traceid: 54 | - 53c95658264e34c8 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700186' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:25 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_delete_provider/should_throw_an_error_trying_to_get_the_email_provider.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/emails/provider 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 404 27 | message: Not Found 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:25 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a7df4c5c0560-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a7df4c5c0560 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 74fc05ca4d6aa66b 55 | Ot-Tracer-Traceid: 56 | - 63c00f200d7118ef 57 | X-Content-Type-Options: 58 | - nosniff 59 | Server: 60 | - cloudflare 61 | Alt-Svc: 62 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 63 | ma=86400 64 | body: 65 | encoding: ASCII-8BIT 66 | string: '{"statusCode":404,"error":"Not Found","message":"There is not a configured 67 | email provider","errorCode":"inexistent_email_provider"}' 68 | recorded_at: Fri, 03 Sep 2021 20:16:25 GMT 69 | recorded_with: VCR 6.0.0 70 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_with_specific_fields.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/emails/provider?fields=name,enabled,credentials&include_fields=true 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 404 27 | message: Not Found 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:24 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a7d9ce6deafc-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a7d9ce6deafc 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 2983e6f000da4c5d 55 | Ot-Tracer-Traceid: 56 | - 5956e42c07a1fe99 57 | X-Content-Type-Options: 58 | - nosniff 59 | Server: 60 | - cloudflare 61 | Alt-Svc: 62 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 63 | ma=86400 64 | body: 65 | encoding: ASCII-8BIT 66 | string: '{"statusCode":404,"error":"Not Found","message":"There is not a configured 67 | email provider","errorCode":"inexistent_email_provider"}' 68 | recorded_at: Fri, 03 Sep 2021 20:16:24 GMT 69 | recorded_with: VCR 6.0.0 70 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/_filters/should_get_the_existing_email_provider_without_specific_fields.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/emails/provider?fields=enabled&include_fields=false 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 404 27 | message: Not Found 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:24 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a7db2d7131a9-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a7db2d7131a9 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 25024cae34589261 55 | Ot-Tracer-Traceid: 56 | - 52a2344221986d73 57 | X-Content-Type-Options: 58 | - nosniff 59 | Server: 60 | - cloudflare 61 | Alt-Svc: 62 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 63 | ma=86400 64 | body: 65 | encoding: ASCII-8BIT 66 | string: '{"statusCode":404,"error":"Not Found","message":"There is not a configured 67 | email provider","errorCode":"inexistent_email_provider"}' 68 | recorded_at: Fri, 03 Sep 2021 20:16:24 GMT 69 | recorded_with: VCR 6.0.0 70 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/_get_provider/should_get_the_existing_email_provider.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/emails/provider 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 404 27 | message: Not Found 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:24 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a7d86fc70ccf-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a7d86fc70ccf 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 7b835b853570c2b1 55 | Ot-Tracer-Traceid: 56 | - 512051831643dd79 57 | X-Content-Type-Options: 58 | - nosniff 59 | Server: 60 | - cloudflare 61 | Alt-Svc: 62 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 63 | ma=86400 64 | body: 65 | encoding: ASCII-8BIT 66 | string: '{"statusCode":404,"error":"Not Found","message":"There is not a configured 67 | email provider","errorCode":"inexistent_email_provider"}' 68 | recorded_at: Fri, 03 Sep 2021 20:16:24 GMT 69 | recorded_with: VCR 6.0.0 70 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Emails/delete_existing_provider.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/emails/provider 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:24 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a7d648b542de-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a7d648b542de 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 141aa9ba0c14fc15 53 | Ot-Tracer-Traceid: 54 | - 257cccd812df9b6e 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700185' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:24 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/_logs/_filters/should_exclude_fields_not_specified.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/logs?fields=date&per_page=1 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:32 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a8083e930d44-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a8083e930d44 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 639ce38179efd5f5 55 | Ot-Tracer-Traceid: 56 | - 43e3fc4b1f4ce3b2 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700193' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: '[{"date":"2021-09-03T20:16:31.489Z","_id":"90020210903201631818782996667425639096985949517551501378"}]' 73 | recorded_at: Fri, 03 Sep 2021 20:16:32 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_disabled_rule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/rules/rul_bsg64xEPZz4WOkXz 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:42 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a849e97504fb-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a849e97504fb 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 210e552b33a3d742 53 | Ot-Tracer-Traceid: 54 | - '06190f9e4d18c18e' 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700203' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:42 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_enabled_rule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/rules/rul_bsg64xEPZz4WOkXz 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:42 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a848ab5f365b-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a848ab5f365b 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 7f59155e3210ab7a 53 | Ot-Tracer-Traceid: 54 | - 2044af490f955ccc 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700203' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:42 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Logs/delete_test_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C6132829f7b569700698af992 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:33 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a8135ef352f5-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a8135ef352f5 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 6acdfcdc02baf16f 53 | Ot-Tracer-Traceid: 54 | - 24a2abeb2024eaa1 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700194' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:33 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/_delete_resource_server/should_delete_the_test_server_without_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/resource-servers/613282a2cdbe5d00408561ea 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:35 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a81c68cdeb61-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a81c68cdeb61 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 161b0f1762bee301 53 | Ot-Tracer-Traceid: 54 | - 6e5aa6540bbd8a30 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700196' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:35 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_ResourceServers/delete_test_server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/resource-servers/613282a2cdbe5d00408561ea 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:35 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a81ddbf754e7-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a81ddbf754e7 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 738fb101088c9d2d 53 | Ot-Tracer-Traceid: 54 | - 1c752dc7113248d4 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700196' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:35 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_delete_role/should_delete_the_Role_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/roles/rol_09CHZmuc9AHc48Ie 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:38 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a8303a9031d3-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a8303a9031d3 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 41702c1b5bdc8826 55 | Ot-Tracer-Traceid: 56 | - 456ab47109e99f8d 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700199' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: "{}" 73 | recorded_at: Fri, 03 Sep 2021 20:16:38 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/_get_roles/should_get_the_Role_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/roles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:36 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a8247e863684-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a8247e863684 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 0b5779782d859f45 55 | Ot-Tracer-Traceid: 56 | - 346330447bd98196 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700197' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: '[{"id":"rol_09CHZmuc9AHc48Ie","name":"rubytest-210908-test-role","description":"Test 73 | role description"}]' 74 | recorded_at: Fri, 03 Sep 2021 20:16:36 GMT 75 | recorded_with: VCR 6.0.0 76 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_api.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/resource-servers/613282a4fb0a8d0042bd7496 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:39 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a8337be50d1c-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a8337be50d1c 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 702bdc1354ee50b3 53 | Ot-Tracer-Traceid: 54 | - 04c3ddce7dc206c5 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700200' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:39 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Roles/delete_test_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282a3c2d480007114acbb 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:38 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a831ee410cdf-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a831ee410cdf 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 49013fa013276abe 53 | Ot-Tracer-Traceid: 54 | - 6cb56b51047df86a 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700199' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:38 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_disabled_rule_without_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/rules/rul_bsg64xEPZz4WOkXz 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:42 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a8479b873616-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a8479b873616 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 5f437b4a2e74bcb6 53 | Ot-Tracer-Traceid: 54 | - 2ec7aa7b2a13f4f7 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700203' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:42 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Rules/_delete_rule/should_delete_the_test_enabled_rule_without_an_error.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/rules/rul_jczlrqACfJJEzyYn 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:42 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a84688ef361f-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a84688ef361f 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 06bfc82c618edea7 53 | Ot-Tracer-Traceid: 54 | - 24c75ba8342f4ec8 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700203' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:42 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Stats/_active_users/should_have_at_least_one_active_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/stats/active-users 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:42 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a84b0dfc318b-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a84b0dfc318b 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 0166b93f79b8729d 55 | Ot-Tracer-Traceid: 56 | - 555d8ff1352fed41 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700203' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: '1' 73 | recorded_at: Fri, 03 Sep 2021 20:16:42 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Tickets/delete_test_user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282ac6c364200701fbc1d 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:45 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a85859fa04cc-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a85859fa04cc 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 3d57743200f5cdef 53 | Ot-Tracer-Traceid: 54 | - 1138b36634fa56bb 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700205' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:44 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_add_user_roles/should_add_a_Role_to_a_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/roles 6 | body: 7 | encoding: UTF-8 8 | string: '{"roles":["rol_2VZOCes8HgBar3Tp"]}' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Content-Length: 21 | - '34' 22 | Accept-Encoding: 23 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 24 | Host: 25 | - auth0-sdk-tests.auth0.com 26 | response: 27 | status: 28 | code: 204 29 | message: No Content 30 | headers: 31 | Date: 32 | - Fri, 03 Sep 2021 20:16:49 GMT 33 | Content-Type: 34 | - application/json; charset=utf-8 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a8774b4e5287-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a8774b4e5287 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 770d3c643b69b524 55 | Ot-Tracer-Traceid: 56 | - 679502c821fe6251 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700210' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: UTF-8 72 | string: '' 73 | recorded_at: Fri, 03 Sep 2021 20:16:49 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:51 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a883a8775307-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a883a8775307 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 4dfb36f77a81b128 53 | Ot-Tracer-Traceid: 54 | - 6d003e5a5b2384fb 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700212' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:51 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user/should_delete_the_secondary_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282ad45244d0069782b56 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:52 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a884eede362b-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a884eede362b 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 53affc4954100cc9 53 | Ot-Tracer-Traceid: 54 | - 15e49650635ff8ec 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700213' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:52 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_delete_user_provider/should_attempt_to_delete_the_MFA_provider_for_the_User.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/multifactor/google-authenticator 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:49 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a8723e8f0599-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a8723e8f0599 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 6993747e52bad920 53 | Ot-Tracer-Traceid: 54 | - 1c6c19294b9e95e2 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700210' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:49 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_enrollments/should_get_Enrollments_for_a_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/enrollments 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:50 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a87b48fe52e9-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a87b48fe52e9 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 0cc495772346eb6b 55 | Ot-Tracer-Traceid: 56 | - 6a5288d823f0dcd5 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700211' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: "[]" 73 | recorded_at: Fri, 03 Sep 2021 20:16:50 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_exactly_1_Permission_for_a_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/permissions 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:50 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a87e2b753610-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a87e2b753610 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 4a8adf2149d56ef7 55 | Ot-Tracer-Traceid: 56 | - 5b0210147f7c43f8 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700211' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: "[]" 73 | recorded_at: Fri, 03 Sep 2021 20:16:50 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_get_user_permissions/should_get_the_correct_Permission_for_a_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/permissions 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:51 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a87f4c27eacb-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a87f4c27eacb 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 36ccc46c10e5e468 55 | Ot-Tracer-Traceid: 56 | - 16d51a891522e6ca 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700212' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: "[]" 73 | recorded_at: Fri, 03 Sep 2021 20:16:51 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_invalidate_browsers/should_invalidate_MFA_browsers_for_the_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/multifactor/actions/invalidate-remember-browser 6 | body: 7 | encoding: UTF-8 8 | string: "{}" 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Content-Length: 21 | - '2' 22 | Accept-Encoding: 23 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 24 | Host: 25 | - auth0-sdk-tests.auth0.com 26 | response: 27 | status: 28 | code: 204 29 | message: No Content 30 | headers: 31 | Date: 32 | - Fri, 03 Sep 2021 20:16:51 GMT 33 | Content-Type: 34 | - application/json; charset=utf-8 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a8827bb631c7-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a8827bb631c7 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 30357af001557539 55 | Ot-Tracer-Traceid: 56 | - 1a45d9de52283799 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700212' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: UTF-8 72 | string: '' 73 | recorded_at: Fri, 03 Sep 2021 20:16:51 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_remove_user_roles/should_remove_a_Role_from_a_User_successfully.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users/auth0%7C613282adac819400692c0dd9/roles 6 | body: 7 | encoding: UTF-8 8 | string: '{"roles":["rol_2VZOCes8HgBar3Tp"]}' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Content-Length: 21 | - '34' 22 | Accept-Encoding: 23 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 24 | Host: 25 | - auth0-sdk-tests.auth0.com 26 | response: 27 | status: 28 | code: 204 29 | message: No Content 30 | headers: 31 | Date: 32 | - Fri, 03 Sep 2021 20:16:50 GMT 33 | Content-Type: 34 | - application/json; charset=utf-8 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a87a3d4c3191-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a87a3d4c3191 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 6306dab15f653025 55 | Ot-Tracer-Traceid: 56 | - 194af4432d81298e 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700211' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: UTF-8 72 | string: '' 73 | recorded_at: Fri, 03 Sep 2021 20:16:50 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/_users/_filters/should_not_include_other_fields_when_paginated.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/users?fields=email&per_page=1 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:47 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a86569700507-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a86569700507 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 49bc931636378617 55 | Ot-Tracer-Traceid: 56 | - 486e215b75759a24 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700208' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: '[{"email":"rubytest-210903-username-1@auth0.com"}]' 73 | recorded_at: Fri, 03 Sep 2021 20:16:47 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_api.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/resource-servers/613282ad5a606500490b4915 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 204 27 | message: No Content 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:52 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Connection: 34 | - keep-alive 35 | Cf-Ray: 36 | - 6891a885fa423125-LAX 37 | Cache-Control: 38 | - no-cache 39 | Strict-Transport-Security: 40 | - max-age=31536000 41 | Vary: 42 | - origin,accept-encoding 43 | Cf-Cache-Status: 44 | - DYNAMIC 45 | Expect-Ct: 46 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 47 | Ot-Baggage-Auth0-Request-Id: 48 | - 6891a885fa423125 49 | Ot-Tracer-Sampled: 50 | - 'true' 51 | Ot-Tracer-Spanid: 52 | - 6d85504963064dd8 53 | Ot-Tracer-Traceid: 54 | - 5254312b1ae38963 55 | X-Content-Type-Options: 56 | - nosniff 57 | X-Ratelimit-Limit: 58 | - '50' 59 | X-Ratelimit-Remaining: 60 | - '49' 61 | X-Ratelimit-Reset: 62 | - '1630700213' 63 | Server: 64 | - cloudflare 65 | Alt-Svc: 66 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 67 | ma=86400 68 | body: 69 | encoding: UTF-8 70 | string: '' 71 | recorded_at: Fri, 03 Sep 2021 20:16:52 GMT 72 | recorded_with: VCR 6.0.0 73 | -------------------------------------------------------------------------------- /spec/fixtures/vcr_cassettes/Auth0_Api_V2_Users/delete_test_role.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: delete 5 | uri: https://auth0-sdk-tests.auth0.com/api/v2/roles/rol_2VZOCes8HgBar3Tp 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Accept: 11 | - "*/*" 12 | User-Agent: 13 | - rest-client/2.1.0 (darwin19.6.0 x86_64) ruby/2.7.0p0 14 | Content-Type: 15 | - application/json 16 | Auth0-Client: 17 | - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjUuMCIsImVudiI6eyJydWJ5IjoiMi43LjAifX0= 18 | Authorization: 19 | - Bearer API_TOKEN 20 | Accept-Encoding: 21 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 22 | Host: 23 | - auth0-sdk-tests.auth0.com 24 | response: 25 | status: 26 | code: 200 27 | message: OK 28 | headers: 29 | Date: 30 | - Fri, 03 Sep 2021 20:16:52 GMT 31 | Content-Type: 32 | - application/json; charset=utf-8 33 | Transfer-Encoding: 34 | - chunked 35 | Connection: 36 | - keep-alive 37 | Cf-Ray: 38 | - 6891a8879ed90d5c-LAX 39 | Cache-Control: 40 | - no-cache 41 | Strict-Transport-Security: 42 | - max-age=31536000 43 | Vary: 44 | - origin,accept-encoding 45 | Cf-Cache-Status: 46 | - DYNAMIC 47 | Expect-Ct: 48 | - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 49 | Ot-Baggage-Auth0-Request-Id: 50 | - 6891a8879ed90d5c 51 | Ot-Tracer-Sampled: 52 | - 'true' 53 | Ot-Tracer-Spanid: 54 | - 4de9efab03fc8f7f 55 | Ot-Tracer-Traceid: 56 | - 68f917530e572e3f 57 | X-Content-Type-Options: 58 | - nosniff 59 | X-Ratelimit-Limit: 60 | - '50' 61 | X-Ratelimit-Remaining: 62 | - '49' 63 | X-Ratelimit-Reset: 64 | - '1630700213' 65 | Server: 66 | - cloudflare 67 | Alt-Svc: 68 | - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; 69 | ma=86400 70 | body: 71 | encoding: ASCII-8BIT 72 | string: "{}" 73 | recorded_at: Fri, 03 Sep 2021 20:16:52 GMT 74 | recorded_with: VCR 6.0.0 75 | -------------------------------------------------------------------------------- /spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Blacklists do 3 | let(:client) { Auth0Client.new(v2_creds) } 4 | let(:token) { 'faketoken' } 5 | 6 | describe '.add_token_to_blacklist', vcr: true do 7 | it 'should add a token to the blacklist' do 8 | expect do 9 | client.add_token_to_blacklist( 10 | token, 11 | v2_creds[:client_id] 12 | ) 13 | end.to_not raise_error 14 | end 15 | end 16 | 17 | describe '.blacklisted_tokens', vcr: true do 18 | it 'should get the added token from the blacklist' do 19 | expect(client.blacklisted_tokens.first).to( 20 | include( 21 | 'aud' => v2_creds[:client_id], 22 | 'jti' => token 23 | ) 24 | ) 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::ClientGrants do 3 | attr_reader :client, :test_client_grant, :test_client 4 | 5 | before(:all) do 6 | @client = Auth0Client.new(v2_creds) 7 | 8 | VCR.use_cassette('Auth0_Api_V2_ClientGrants/create_test_client') do 9 | @test_client = client.create_client( 10 | "ClientGrantTestClient-#{entity_suffix}" 11 | ) 12 | end 13 | 14 | VCR.use_cassette('Auth0_Api_V2_ClientGrants/create_test_client_grant') do 15 | @test_client_grant = client.create_client_grant( 16 | 'client_id' => test_client['client_id'], 17 | 'audience' => "https://#{test_client['tenant']}.auth0.com/api/v2/", 18 | 'scope' => ['test:scope'] 19 | ) 20 | end 21 | 22 | end 23 | 24 | after(:all) do 25 | VCR.use_cassette('Auth0_Api_V2_ClientGrants/delete_test_client') do 26 | client.delete_client(test_client['client_id']) 27 | end 28 | 29 | VCR.use_cassette('Auth0_Api_V2_ClientGrants/delete_test_client_grant') do 30 | client.delete_client_grant(test_client_grant['id']) 31 | end 32 | end 33 | 34 | describe '.client_grants', vcr: true do 35 | let(:client_grants) do 36 | client.client_grants 37 | end 38 | 39 | it 'should return at least 1 result' do 40 | expect(client_grants.size).to be > 0 41 | end 42 | 43 | it 'should return the test client grant' do 44 | expect(client_grants).to include(test_client_grant) 45 | end 46 | end 47 | 48 | describe '.patch_client_grant', vcr: true do 49 | it 'should update the test client grant' do 50 | expect( 51 | client.patch_client_grant( 52 | test_client_grant['id'], 53 | 'scope' => ['new:scope'] 54 | ) 55 | ).to(include('scope' => ['new:scope'])) 56 | end 57 | end 58 | 59 | describe '.delete_client_grant', vcr: true do 60 | it 'should delete the test client grant' do 61 | expect do 62 | client.delete_client_grant(test_client_grant['id']) 63 | end.to_not raise_error 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /spec/integration/lib/auth0/api/v2/api_stats_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Stats do 3 | let(:client) { Auth0Client.new(v2_creds) } 4 | 5 | describe '.active_users', vcr: true do 6 | it 'should have at least one active user' do 7 | expect(Integer(client.active_users)).to be >= 0 8 | end 9 | end 10 | 11 | # rubocop:disable Date 12 | describe '.daily_stats', vcr: true do 13 | it 'should have at least one stats entry for the timeframe' do 14 | expect( 15 | client.daily_stats( 16 | Date.new(2017, 1, 1).strftime('%Y%m%d'), 17 | Date.new(2018, 1, 1).strftime('%Y%m%d') 18 | ).size 19 | ).to be > 0 20 | end 21 | end 22 | end -------------------------------------------------------------------------------- /spec/integration/lib/auth0/api/v2/api_tenants_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Tenants do 3 | attr_reader :client 4 | 5 | before(:all) do 6 | @client = Auth0Client.new(v2_creds) 7 | end 8 | 9 | let(:default_tenant_name) { 'Auth0' } 10 | 11 | describe '.get_tenant_settings', vcr: true do 12 | it 'should get the tenant settings' do 13 | expect( 14 | client.get_tenant_settings 15 | ).to include( 16 | 'friendly_name' => default_tenant_name, 17 | 'support_email' => 'support@auth0.org' 18 | ) 19 | end 20 | end 21 | 22 | describe '.get_tenant_settings with specific fields', vcr: true do 23 | let(:tenant_setting_fields) do 24 | client.get_tenant_settings(fields: 'support_email') 25 | end 26 | 27 | it 'should include the field requested' do 28 | expect( 29 | tenant_setting_fields 30 | ).to include('support_email') 31 | end 32 | 33 | it 'should exclude a field not requested' do 34 | expect( 35 | tenant_setting_fields 36 | ).to_not include('friendly_name') 37 | end 38 | end 39 | 40 | describe '.update_tenant_settings', vcr: true do 41 | let(:changed_tenant_name) { "#{default_tenant_name}-CHANGED" } 42 | 43 | it 'should update the tenant settings with a new tenant name' do 44 | expect( 45 | client.update_tenant_settings( 46 | { friendly_name: changed_tenant_name } 47 | )['friendly_name'] 48 | ).to include(changed_tenant_name) 49 | end 50 | 51 | it 'should revert the tenant name' do 52 | expect( 53 | client.update_tenant_settings( 54 | { friendly_name: default_tenant_name } 55 | )['friendly_name'] 56 | ).to include(default_tenant_name) 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /spec/integration/lib/auth0/api/v2/api_tickets_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Tickets do 3 | attr_reader :client, :test_user 4 | 5 | before(:all) do 6 | @client = Auth0Client.new(v2_creds) 7 | test_user_name = "#{entity_suffix}-username" 8 | 9 | VCR.use_cassette('Auth0_Api_V2_Tickets/create_test_user') do 10 | @test_user = client.create_user( 11 | Auth0::Api::AuthenticationEndpoints::UP_AUTH, 12 | name: test_user_name, 13 | email: "#{entity_suffix}-#{test_user_name}@auth0.com", 14 | password: Faker::Internet.password 15 | ) 16 | end 17 | end 18 | 19 | after(:all) do 20 | VCR.use_cassette('Auth0_Api_V2_Tickets/delete_test_user') do 21 | client.delete_user(test_user['user_id']) 22 | end 23 | end 24 | 25 | describe '.post_email_verification', vcr: true do 26 | it 'should create an email verification ticket' do 27 | expect( 28 | client.post_email_verification( 29 | test_user['user_id'], 30 | result_url: 'https://auth0.com/callback' 31 | ) 32 | ).to include('ticket') 33 | end 34 | 35 | it 'should raise an error if the user id is empty' do 36 | expect do 37 | client.post_email_verification( '' ) 38 | end.to raise_error Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification' 39 | end 40 | 41 | it 'should raise an error if the identity supplied is not a Hash' do 42 | expect do 43 | client.post_email_verification( '', identity: 'not a hash') 44 | end.to raise_error Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification' 45 | end 46 | end 47 | 48 | describe '.post_password_change', vcr: true do 49 | it 'should create a password change ticket' do 50 | expect( 51 | client.post_password_change( 52 | new_password: 'secret', 53 | user_id: test_user['user_id'], 54 | result_url: 'https://auth0.com/callback' 55 | ) 56 | ).to include('ticket') 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/anomaly_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Anomaly do 3 | before :all do 4 | dummy_instance = DummyClass.new 5 | dummy_instance.extend(Auth0::Api::V2::Anomaly) 6 | @instance = dummy_instance 7 | end 8 | 9 | context '.check_if_ip_is_blocked' do 10 | it { expect(@instance).to respond_to(:check_if_ip_is_blocked) } 11 | it 'expect client to send get to /api/v2/anomaly/blocks/ips/192.0.2.0' do 12 | expect(@instance).to receive(:get).with('/api/v2/anomaly/blocks/ips/192.0.2.0') 13 | expect { @instance.check_if_ip_is_blocked('192.0.2.0') }.not_to raise_error 14 | end 15 | it { expect { @instance.check_if_ip_is_blocked('') }.to raise_error('Must specify an IP') } 16 | end 17 | 18 | context '.remove_ip_block' do 19 | it { expect(@instance).to respond_to(:remove_ip_block) } 20 | it 'expect client to send delete to /api/v2/anomaly/blocks/ips/192.0.2.0' do 21 | expect(@instance).to receive(:delete).with('/api/v2/anomaly/blocks/ips/192.0.2.0') 22 | expect { @instance.remove_ip_block('192.0.2.0') }.not_to raise_error 23 | end 24 | it { expect { @instance.remove_ip_block('') }.to raise_error('Must specify an IP') } 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/blacklists_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Blacklists do 3 | before :all do 4 | dummy_instance = DummyClass.new 5 | dummy_instance.extend(Auth0::Api::V2::Blacklists) 6 | @instance = dummy_instance 7 | end 8 | 9 | context '.blacklisted_tokens' do 10 | it { expect(@instance).to respond_to(:blacklisted_tokens) } 11 | it 'is expected to call /api/v2/blacklists/tokens' do 12 | expect(@instance).to receive(:get).with('/api/v2/blacklists/tokens', { aud: nil }) 13 | expect { @instance.blacklisted_tokens }.not_to raise_error 14 | end 15 | end 16 | 17 | context '.add_token.to_blacklist' do 18 | it { expect(@instance).to respond_to(:add_token_to_blacklist) } 19 | it 'is expected to call post to /api/v2/blacklists/tokens' do 20 | expect(@instance).to receive(:post).with('/api/v2/blacklists/tokens', { aud: 'aud', jti: 'jti' }) 21 | @instance.add_token_to_blacklist('jti', 'aud') 22 | end 23 | it { expect { @instance.add_token_to_blacklist('', '') }.to raise_error 'Must specify a valid JTI' } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/logs_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Logs do 3 | before :all do 4 | dummy_instance = DummyClass.new 5 | dummy_instance.extend(Auth0::Api::V2::Logs) 6 | @instance = dummy_instance 7 | end 8 | 9 | context '.logs' do 10 | it { expect(@instance).to respond_to(:logs) } 11 | it { expect(@instance).to respond_to(:get_logs) } 12 | it 'is expected to call /api/v2/logs' do 13 | expect(@instance).to receive(:get).with( 14 | '/api/v2/logs', { 15 | q: nil, 16 | page: nil, 17 | per_page: nil, 18 | sort: nil, 19 | fields: nil, 20 | include_fields: nil, 21 | include_totals: nil, 22 | from: nil, 23 | take: nil 24 | }) 25 | expect { @instance.logs }.not_to raise_error 26 | end 27 | it 'is expect to rise an error when take is higher than 100' do 28 | expect { @instance.logs(take: rand(101..2000)) }.to raise_error( 29 | 'The total amount of entries to retrieve should be less than 100' 30 | ) 31 | end 32 | it 'is expect to rise an error when per_page is higher than 100' do 33 | expect { @instance.logs(per_page: rand(101..2000)) }.to raise_error( 34 | 'The total amount of entries per page should be less than 100' 35 | ) 36 | end 37 | end 38 | 39 | context '.log' do 40 | it { expect(@instance).to respond_to(:log) } 41 | it { expect(@instance).to respond_to(:get_logs_by_id) } 42 | it 'is expected to call get request to /api/v2/logs/LOG_ID' do 43 | expect(@instance).to receive(:get).with('/api/v2/logs/LOG_ID') 44 | expect { @instance.log('LOG_ID') }.not_to raise_error 45 | end 46 | it { expect { @instance.log(nil) }.to raise_error('Must supply a valid log_id') } 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/refresh_tokens_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe Auth0::Api::V2::RefreshTokens do 6 | before :all do 7 | dummy_instance = DummyClass.new 8 | dummy_instance.extend(Auth0::Api::V2::RefreshTokens) 9 | @instance = dummy_instance 10 | end 11 | 12 | describe '.refresh_token' do 13 | it 'is expected to respond to a refresh_token method' do 14 | expect(@instance).to respond_to(:refresh_token) 15 | end 16 | 17 | it 'is expected to GET a refresh_token' do 18 | expect(@instance).to receive(:get).with( 19 | '/api/v2/refresh-tokens/REFRESH_TOKEN_ID' 20 | ) 21 | 22 | expect do 23 | @instance.refresh_token('REFRESH_TOKEN_ID') 24 | end.not_to raise_error 25 | end 26 | 27 | it 'is expected to raise an exception when the id is empty' do 28 | expect { @instance.refresh_token(nil) }.to raise_error('Must supply a valid id') 29 | end 30 | end 31 | 32 | describe '.delete_refresh_token' do 33 | it 'is expected to respond to a delete_refresh_token method' do 34 | expect(@instance).to respond_to(:delete_refresh_token) 35 | end 36 | 37 | it 'is expected to DELETE a refresh_token' do 38 | expect(@instance).to receive(:delete).with( 39 | '/api/v2/refresh-tokens/REFRESH_TOKEN_ID' 40 | ) 41 | 42 | expect do 43 | @instance.delete_refresh_token('REFRESH_TOKEN_ID') 44 | end.not_to raise_error 45 | end 46 | 47 | it 'is expected to raise an exception when the id is empty' do 48 | expect { @instance.delete_refresh_token(nil) }.to raise_error('Must supply a valid id') 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/sessions_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe Auth0::Api::V2::Sessions do 6 | before :all do 7 | dummy_instance = DummyClass.new 8 | dummy_instance.extend(Auth0::Api::V2::Sessions) 9 | @instance = dummy_instance 10 | end 11 | 12 | context '.session' do 13 | it 'is expected to respond to a session method' do 14 | expect(@instance).to respond_to(:session) 15 | end 16 | 17 | it 'is expected to GET a session' do 18 | expect(@instance).to receive(:get).with( 19 | '/api/v2/sessions/SESSION_ID' 20 | ) 21 | 22 | expect do 23 | @instance.session('SESSION_ID') 24 | end.not_to raise_error 25 | end 26 | 27 | it 'is expected to raise an exception when the session ID is empty' do 28 | expect { @instance.session(nil) }.to raise_error('Must supply a valid session_id') 29 | end 30 | end 31 | 32 | context '.delete_session' do 33 | it 'is expected to respond to a delete_session method' do 34 | expect(@instance).to respond_to(:delete_session) 35 | end 36 | 37 | it 'is expected to DELETE a session' do 38 | expect(@instance).to receive(:delete).with( 39 | '/api/v2/sessions/SESSION_ID' 40 | ) 41 | 42 | expect do 43 | @instance.delete_session('SESSION_ID') 44 | end.not_to raise_error 45 | end 46 | 47 | it 'is expected to raise an exception when the session ID is empty' do 48 | expect { @instance.delete_session(nil) }.to raise_error('Must supply a valid session_id') 49 | end 50 | end 51 | 52 | context '.revoke_session' do 53 | it 'is expected to respond to a revoke_session method' do 54 | expect(@instance).to respond_to(:revoke_session) 55 | end 56 | 57 | it 'is expected to POST to /api/v2/sessions/{id}/revoke' do 58 | expect(@instance).to receive(:post).with( 59 | '/api/v2/sessions/SESSION_ID/revoke' 60 | ) 61 | 62 | expect do 63 | @instance.revoke_session('SESSION_ID') 64 | end.not_to raise_error 65 | end 66 | 67 | it 'is expected to raise an exception when the session ID is empty' do 68 | expect { @instance.revoke_session(nil) }.to raise_error('Must supply a valid session_id') 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/stats_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Stats do 3 | before :all do 4 | dummy_instance = DummyClass.new 5 | dummy_instance.extend(Auth0::Api::V2::Stats) 6 | @instance = dummy_instance 7 | end 8 | context '.active_users' do 9 | it { expect(@instance).to respond_to(:active_users) } 10 | it 'expect client to send get to /api/v2/stats/active-users' do 11 | expect(@instance).to receive(:get).with('/api/v2/stats/active-users') 12 | expect { @instance.active_users }.not_to raise_error 13 | end 14 | end 15 | context '.daily_stats' do 16 | it { expect(@instance).to respond_to(:daily_stats) } 17 | it 'expect client to send get to /api/v2/stats/daily' do 18 | expect(@instance).to receive(:get).with('/api/v2/stats/daily', { from: '20120222', to: '20151222' }) 19 | expect { @instance.daily_stats('20120222', '20151222') }.not_to raise_error 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/tenants_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::Tenants do 3 | before :all do 4 | @instance = DummyClass.new.extend(Auth0::Api::V2::Tenants) 5 | end 6 | 7 | context '.get_tenant_settings' do 8 | it { expect(@instance).to respond_to(:get_tenant_settings) } 9 | it 'expect client to send post to /api/v2/tenants/settings with fields' do 10 | expect(@instance).to receive(:get).with('/api/v2/tenants/settings', { fields: 'field', include_fields: true }) 11 | expect { @instance.get_tenant_settings(fields: 'field') }.not_to raise_error 12 | end 13 | end 14 | context '.update_tenant_settings' do 15 | it { expect(@instance).to respond_to(:update_tenant_settings) } 16 | it 'expect client to send post to /api/v2/tenants/settings with body' do 17 | expect(@instance).to receive(:patch).with('/api/v2/tenants/settings', 'test body') 18 | expect { @instance.update_tenant_settings('test body') }.not_to raise_error 19 | end 20 | it 'expect client to rasie error when calling with empty body' do 21 | expect { @instance.update_tenant_settings(nil) }.to raise_error( 22 | 'Must supply a valid body to update tenant settings' 23 | ) 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /spec/lib/auth0/api/v2/users_by_email_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe Auth0::Api::V2::UsersByEmail do 3 | before :all do 4 | dummy_instance = DummyClass.new 5 | dummy_instance.extend(Auth0::Api::V2::UsersByEmail) 6 | @instance = dummy_instance 7 | end 8 | 9 | context '.users_by_email' do 10 | it { expect(@instance).to respond_to(:users_by_email) } 11 | it 'is expected to call /api/v2/users-by-email' do 12 | expect(@instance).to receive(:get).with( 13 | '/api/v2/users-by-email', { 14 | fields: nil, 15 | include_fields: nil, 16 | email: 'email' 17 | }) 18 | expect { @instance.users_by_email('email') }.not_to raise_error 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'faker' 2 | require 'json' 3 | require 'auth0' 4 | 5 | if RUBY_VERSION >= '2.7.2' 6 | # NOTE: https://bugs.ruby-lang.org/issues/17000 7 | Warning[:deprecated] = true 8 | end 9 | 10 | require 'simplecov' 11 | SimpleCov.start 12 | 13 | if ENV['CI'] == 'true' 14 | require 'simplecov-cobertura' 15 | SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter 16 | end 17 | 18 | require 'dotenv' 19 | Dotenv.load 20 | 21 | require 'webmock/rspec' 22 | WebMock.allow_net_connect! 23 | 24 | require 'vcr' 25 | VCR.configure do |config| 26 | # Uncomment the line below to record new VCR cassettes. 27 | # When this is commented out, VCR will reject all outbound HTTP calls. 28 | config.allow_http_connections_when_no_cassette = true 29 | config.cassette_library_dir = 'spec/fixtures/vcr_cassettes' 30 | config.configure_rspec_metadata! 31 | config.hook_into :webmock 32 | config.filter_sensitive_data('CLIENT_SECRET') { ENV['CLIENT_SECRET'] } 33 | config.filter_sensitive_data('API_TOKEN') { ENV['MASTER_JWT'] } 34 | 35 | ENV['DOMAIN'] = 'auth0-sdk-tests.auth0.com' 36 | ENV['CLIENT_ID'] = '2cnWuug6zaFX1j0ge1P99jAUn0F4XSuI' 37 | end 38 | 39 | $LOAD_PATH.unshift File.expand_path('..', __FILE__) 40 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 41 | 42 | Dir['./lib/*.rb'].each { |f| require f } 43 | Dir['./lib/api/**/*.rb'].each { |f| require f } 44 | Dir['./spec/support/**/*.rb'].each { |f| require f } 45 | Dir['./spec/support/*.rb'].each { |f| require f } 46 | 47 | require 'rspec' 48 | RSpec.configure do |config| 49 | config.filter_run focus: true 50 | config.run_all_when_everything_filtered = true 51 | config.include Credentials 52 | 53 | config.expect_with :rspec do |c| 54 | c.max_formatted_output_length = 1000000 55 | end 56 | end 57 | 58 | def wait(time, increment = 5, elapsed_time = 0, &block) 59 | yield 60 | rescue RSpec::Expectations::ExpectationNotMetError => e 61 | raise e if elapsed_time >= time 62 | sleep increment 63 | wait(time, increment, elapsed_time + increment, &block) 64 | end 65 | 66 | def entity_suffix 67 | 'rubytest-210908' 68 | end 69 | 70 | puts "Entity suffix is #{entity_suffix}" 71 | -------------------------------------------------------------------------------- /spec/support/credentials.rb: -------------------------------------------------------------------------------- 1 | module Credentials 2 | module_function 3 | def v2_creds 4 | { 5 | domain: ENV.fetch( 'DOMAIN', 'DOMAIN' ), 6 | client_id: ENV.fetch( 'CLIENT_ID', 'CLIENT_ID' ), 7 | client_secret: ENV.fetch( 'CLIENT_SECRET', 'TEST_CLIENT_SECRET' ), 8 | token: ENV.fetch( 'MASTER_JWT', 'TEST_MASTER_JWT' ) 9 | } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/support/dummy_class.rb: -------------------------------------------------------------------------------- 1 | class DummyClass 2 | include Auth0::Mixins::Headers 3 | 4 | attr_reader :domain, :client_id, :client_secret, :audience 5 | 6 | def initialize 7 | @domain = 'test.auth0.com' 8 | @client_id = '__test_client_id__' 9 | @client_secret = '__test_client_secret__' 10 | @audience = "https://#{@domain}/api/v2/" 11 | end 12 | 13 | %i(get post put patch delete delete_with_body).each do |method| 14 | define_method(method) do |_path, _body = {}| 15 | true 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/support/dummy_class_for_proxy.rb: -------------------------------------------------------------------------------- 1 | class DummyClassForProxy 2 | include Auth0::Mixins::HTTPProxy 3 | include Auth0::Mixins::Headers 4 | include Auth0::Mixins::TokenManagement 5 | end -------------------------------------------------------------------------------- /spec/support/dummy_class_for_restclient.rb: -------------------------------------------------------------------------------- 1 | class DummyClassForRestClient < RestClient::Exception 2 | end 3 | -------------------------------------------------------------------------------- /spec/support/dummy_class_for_tokens.rb: -------------------------------------------------------------------------------- 1 | class DummyClassForTokens 2 | include Auth0::Mixins::HTTPProxy 3 | include Auth0::Mixins::Headers 4 | include Auth0::Mixins::TokenManagement 5 | include Auth0::Mixins::Initializer 6 | 7 | def initialize(config) 8 | extend Auth0::Api::AuthenticationEndpoints 9 | @client_id = config[:client_id] 10 | @client_secret = config[:client_secret] 11 | @audience = config[:api_identifier] 12 | @domain = config[:domain] 13 | @base_uri = "https://#{@domain}" 14 | @token = config[:token] 15 | @token_expires_at = config[:token_expires_at] 16 | @client_assertion_signing_key = config[:client_assertion_signing_key] 17 | @client_assertion_signing_alg = config[:client_assertion_signing_alg] || 'RS256' 18 | @headers ||= {} 19 | end 20 | end -------------------------------------------------------------------------------- /spec/support/import_users.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "email": "john.doe@contoso.com", 4 | "email_verified": false, 5 | "app_metadata": { 6 | "roles": ["admin"], 7 | "plan": "premium" 8 | }, 9 | "user_metadata": { 10 | "theme": "light" 11 | } 12 | } 13 | ] 14 | -------------------------------------------------------------------------------- /spec/support/stub_response.rb: -------------------------------------------------------------------------------- 1 | StubResponse = Struct.new(:body, :success?, :code, :headers) 2 | --------------------------------------------------------------------------------