auth0 4.1.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +38 -0
  3. data/DEPLOYMENT.md +10 -1
  4. data/Dockerfile +5 -0
  5. data/README.md +14 -17
  6. data/RUBYGEM.md +9 -0
  7. data/auth0.gemspec +2 -2
  8. data/examples/ruby-api/.env.example +2 -0
  9. data/examples/ruby-on-rails-api/.env.example +2 -0
  10. data/examples/ruby-on-rails-api/Gemfile +7 -7
  11. data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +2 -2
  12. data/examples/ruby-on-rails-api/app/models/User.rb +5 -0
  13. data/examples/ruby-on-rails-api/config/initializers/knock.rb +2 -20
  14. data/lib/auth0/api/authentication_endpoints.rb +10 -9
  15. data/lib/auth0/api/v2.rb +2 -0
  16. data/lib/auth0/api/v2/users.rb +1 -0
  17. data/lib/auth0/api/v2/users_by_email.rb +35 -0
  18. data/lib/auth0/exception.rb +2 -0
  19. data/lib/auth0/mixins/httpproxy.rb +6 -1
  20. data/lib/auth0/version.rb +1 -1
  21. data/publish_rubygem.sh +10 -0
  22. data/spec/integration/lib/auth0/api/api_authentication_spec.rb +3 -43
  23. data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +26 -17
  24. data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +45 -9
  25. data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +58 -13
  26. data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +22 -4
  27. data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +66 -22
  28. data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +38 -24
  29. data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +15 -2
  30. data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +52 -16
  31. data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +12 -3
  32. data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +21 -5
  33. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +15 -3
  34. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +58 -37
  35. data/spec/integration/lib/auth0/auth0_client_spec.rb +1 -1
  36. data/spec/lib/auth0/api/authentication_endpoints_spec.rb +5 -3
  37. data/spec/lib/auth0/api/v2/users_by_email_spec.rb +21 -0
  38. data/spec/lib/auth0/client_spec.rb +0 -61
  39. data/spec/spec_helper.rb +23 -0
  40. data/spec/spec_helper_full.rb +8 -19
  41. data/spec/spec_helper_unit.rb +0 -9
  42. data/spec/support/credentials.rb +2 -0
  43. data/spec/support/dummy_class.rb +1 -1
  44. metadata +55 -107
  45. data/spec/integration/lib/auth0/api/v1/api_clients_spec.rb +0 -12
  46. data/spec/integration/lib/auth0/api/v1/api_users_spec.rb +0 -52
  47. data/spec/lib/auth0/api/v1/clients_spec.rb +0 -61
  48. data/spec/lib/auth0/api/v1/connections_spec.rb +0 -66
  49. data/spec/lib/auth0/api/v1/logs_spec.rb +0 -46
  50. data/spec/lib/auth0/api/v1/rules_spec.rb +0 -42
  51. data/spec/lib/auth0/api/v1/users_spec.rb +0 -248
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5662a97be797b89462c17138a8f056908bbd1bd9
4
- data.tar.gz: 9973f4c3a23a12e1888c9da0751030def1259601
2
+ SHA256:
3
+ metadata.gz: 50bf71ae1695273ad9f86de42239cff42c681c8c0841fde4f2002c1e045940b0
4
+ data.tar.gz: 4956b4307c7c2d93fd1d8e955c2f77fc1c6fdd57232674c1dc50a1d95507097b
5
5
  SHA512:
6
- metadata.gz: 972202c41cb9e9f479f50479075daeaa33af13a3ac88ce94bff273267bad13b1f5ef56f03f300f9cd2845f576be9c91204c23dccac11f9a9dd51f5d1639cf316
7
- data.tar.gz: cde76230c835cdf52f2e963edbd28bc794efb769c892739bfd70029954b6ad23c25a62b8a10285d21839d7c0fc09a300f005d6ab3cf2fd6147be2413b8761dcb
6
+ metadata.gz: 7cdbe3de507568e75af632efdd47c005c71425f0c884fb66863d63325ac5f4d162e0d129d648c306ad5747bb6d6634819431cd566420e06b87611b384f91b632
7
+ data.tar.gz: cc4d1e11073b11d8412615bf57586e3f173d649ae48f47b212104de5aaca6b294d86f06eeb3bbb7f13c3016a3ef4a2f57d5e6b87b08db776e730e36e9eb1a566
@@ -1,5 +1,43 @@
1
1
  # Change Log
2
2
 
3
+ ## [v4.4.0](https://github.com/auth0/ruby-auth0/tree/v4.4.0) (2018-02-19)
4
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.2.0...v4.4.0)
5
+
6
+ Note: If you are using the `login` endpoint, you will need to enable the [Resource Owner Password Grant](https://auth0.com/docs/clients/client-grant-types).
7
+
8
+ **Closed issues:**
9
+
10
+ - Vulnerable dependency: yard. [\#99]
11
+ https://github.com/auth0/ruby-auth0/issues/99
12
+
13
+ - Unsupported on latest ruby version. [\#83]
14
+ https://github.com/auth0/ruby-auth0/issues/83
15
+
16
+ - Outdated dependencies in ror-api example. [\#75]
17
+ https://github.com/auth0/ruby-auth0/issues/75
18
+
19
+ - Authentication Login is using `/oauth/ro` [\#89]
20
+ https://github.com/auth0/ruby-auth0/issues/89
21
+
22
+ **Merged pull requests:**
23
+
24
+ - Add support to /api/v2/users-by-email [\#105](https://github.com/auth0/ruby-auth0/pull/105) ([edgurgel](https://github.com/edgurgel))
25
+
26
+ ## [v4.2.0](https://github.com/auth0/ruby-auth0/tree/v4.2.0) (2018-02-15)
27
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.1.0...v4.2.0)
28
+
29
+ **Closed issues:**
30
+
31
+ - Vulnerable dependency: yard. [\#99]
32
+ https://github.com/auth0/ruby-auth0/issues/99
33
+
34
+ - Unsupported on latest ruby version. [\#83]
35
+ https://github.com/auth0/ruby-auth0/issues/83
36
+
37
+ - Outdated dependencies in ror-api example. [\#75]
38
+ https://github.com/auth0/ruby-auth0/issues/75
39
+
40
+
3
41
  ## [v4.1.0](https://github.com/auth0/ruby-auth0/tree/v4.1.0) (2016-07-25)
4
42
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.0.0...v4.1.0)
5
43
 
@@ -1,5 +1,14 @@
1
1
  ```
2
2
  bundle install
3
3
  bundle exec rake spec
4
- gem push auth0-X.Y.Z.gem
4
+ bundle exec gem bump --version x.y.z
5
+ bundle exec gem tag
6
+ github_changelog_generator -t <YOUR TOKEN>
7
+ bundle exec gem release
5
8
  ```
9
+
10
+ > Note for the changelog:
11
+ * Review the changelog.
12
+ * Remove "unreleased" section.
13
+ * Make sure the tags are ordered.
14
+ * Commit / push the changelog to master.
@@ -0,0 +1,5 @@
1
+ FROM ruby:2.5
2
+
3
+ WORKDIR /home/app
4
+
5
+ COPY . /home/app
data/README.md CHANGED
@@ -4,6 +4,7 @@ Ruby api client for [Auth0](https://auth0.com) platform
4
4
  [![Gem Version](https://badge.fury.io/rb/auth0.svg)](http://badge.fury.io/rb/auth0)
5
5
  [![Coverage Status](https://coveralls.io/repos/auth0/ruby-auth0/badge.svg?branch=master)](https://coveralls.io/r/auth0/ruby-auth0?branch=master)
6
6
  [![Dependency Status](https://gemnasium.com/auth0/ruby-auth0.svg)](https://gemnasium.com/auth0/ruby-auth0)
7
+ [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/auth0/ruby-auth0/master/frames)
7
8
 
8
9
  ## Installation
9
10
 
@@ -25,45 +26,41 @@ Using [APIv2](https://auth0.com/docs/api/v2)
25
26
  require "auth0"
26
27
 
27
28
  auth0 = Auth0Client.new(
28
- :client_id => "YOUR CLIENT ID"
29
+ :client_id => "YOUR CLIENT ID",
29
30
  :token => "YOUR JWT HERE",
30
- :domain => "<YOUR ACCOUNT>.auth0.com"
31
+ :domain => "<YOUR ACCOUNT>.auth0.com",
32
+ :api_version => 2
31
33
  )
32
34
 
33
35
  puts auth0.get_users
34
36
  ```
35
37
 
36
- Using [APIv1](https://auth0.com/docs/api/v1)
38
+ ### Timeout
39
+ You can setup a custom timeout in the Auth0Client. By default it is set to 10 seconds.
37
40
 
38
41
  ```ruby
39
42
  require "auth0"
40
43
 
41
44
  auth0 = Auth0Client.new(
42
45
  :client_id => "YOUR CLIENT ID",
43
- :client_secret => "YOUR CLIENT SECRET",
46
+ :token => "YOUR JWT HERE",
44
47
  :domain => "<YOUR ACCOUNT>.auth0.com",
45
- :api_version => "1"
48
+ :timeout => 15
46
49
  )
47
50
 
48
51
  puts auth0.get_users
49
52
  ```
50
53
 
51
- ### Timeout
52
- You can setup a custom timeout in the Auth0Client. By default it is set to 10 minutes.
54
+ ## API Documentation
53
55
 
54
- ```ruby
55
- require "auth0"
56
+ Build API docs locally
56
57
 
57
- auth0 = Auth0Client.new(
58
- :client_id => "YOUR CLIENT ID"
59
- :token => "YOUR JWT HERE",
60
- :domain => "<YOUR ACCOUNT>.auth0.com",
61
- :timeout => 15
62
- )
63
-
64
- puts auth0.get_users
58
+ ``` bash
59
+ bundle exec rake documentation
65
60
  ```
66
61
 
62
+ To view API docs, go to `doc` folder and open `index.html`
63
+
67
64
  ## What is Auth0?
68
65
 
69
66
  Auth0 helps you to:
@@ -0,0 +1,9 @@
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
+ ```
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_runtime_dependency 'rest-client', '~> 1.8.0'
21
+ s.add_runtime_dependency 'rest-client', '~> 2.0'
22
22
 
23
23
  s.add_development_dependency 'rake', '~> 10.4'
24
24
  s.add_development_dependency 'fuubar', '~> 2.0'
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_development_dependency 'rack', '~> 1.6.4'
32
32
  s.add_development_dependency 'simplecov', '~> 0.9'
33
33
  s.add_development_dependency 'faker', '~> 1.4'
34
- s.add_development_dependency 'yard', '~> 0.8'
34
+ s.add_development_dependency 'yard', '~> 0.9.12'
35
35
  s.add_development_dependency 'gem-release', '~> 0.7'
36
36
  s.license = 'MIT'
37
37
  end
@@ -0,0 +1,2 @@
1
+ AUTH0_CLIENT_ID={CLIENT_ID}
2
+ AUTH0_CLIENT_SECRET={CLIENT_SECRET}
@@ -0,0 +1,2 @@
1
+ AUTH0_CLIENT_ID={CLIENT_ID}
2
+ AUTH0_CLIENT_SECRET={CLIENT_SECRET}
@@ -1,17 +1,17 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
- gem 'rails', '4.2.5.1'
4
+ gem 'rails', '5.0.0.1'
5
5
  # Use sqlite3 as the database for Active Record
6
6
  gem 'sqlite3', groups: [:development, :test]
7
7
 
8
8
  gem 'pg'
9
9
  # Use SCSS for stylesheets
10
- gem 'sass-rails', '~> 5.0.4'
10
+ gem 'sass-rails', '~> 5.0.6'
11
11
  # Use Uglifier as compressor for JavaScript assets
12
- gem 'uglifier', '>= 2.7.2'
12
+ gem 'uglifier', '>= 3.0.3'
13
13
  # Use CoffeeScript for .js.coffee assets and views
14
- gem 'coffee-rails', '~> 4.1.1'
14
+ gem 'coffee-rails', '~> 4.2.1'
15
15
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
16
16
  # gem 'therubyracer', platforms: :ruby
17
17
 
@@ -20,11 +20,11 @@ gem 'jquery-rails'
20
20
  # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
21
21
  gem 'turbolinks'
22
22
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
23
- gem 'jbuilder', '~> 2.4.1'
23
+ gem 'jbuilder', '~> 2.6.0'
24
24
  # bundle exec rake doc:rails generates the API under doc/api.
25
- gem 'sdoc', '~> 0.4.1', group: :doc
25
+ gem 'sdoc', '~> 0.4.2', group: :doc
26
26
  # knock dependency
27
- gem 'knock', '~> 1.4.2'
27
+ gem 'knock', '~> 2.0'
28
28
 
29
29
  # Dot env
30
30
  gem 'dotenv-rails', groups: [:development, :test]
@@ -1,11 +1,11 @@
1
1
  # Secured ping Controller
2
2
  class SecuredPingController < ApplicationController
3
- before_action :authenticate
3
+ before_action :authenticate_user
4
4
 
5
5
  def ping
6
6
  render json: {
7
7
  message: "All good. You only get this message if you're authenticated.",
8
- user: @current_user
8
+ user: current_user
9
9
  }
10
10
  end
11
11
  end
@@ -0,0 +1,5 @@
1
+ class User < ActiveRecord::Base
2
+ def self.from_token_payload payload
3
+ payload["sub"]
4
+ end
5
+ end
@@ -1,19 +1,5 @@
1
1
  require 'base64'
2
2
  Knock.setup do |config|
3
- ## Current user retrieval when validating token
4
- ## --------------------------------------------
5
- ##
6
- ## This is how you can tell Knock how to retrieve the current_user.
7
- ## By default, it assumes you have a model called `User` and that
8
- ## the user_id is stored in the 'sub' claim.
9
- ##
10
- ## Default:
11
- # config.current_user_from_token = -> (claims) { User.find claims['sub'] }
12
-
13
- # !!!
14
- # This is only to make the example test cases pass, you should use a real
15
- # user model in your app instead.
16
- config.current_user_from_token = -> (claims) { { id: claims['sub'] } }
17
3
 
18
4
  ## Expiration claim
19
5
  ## ----------------
@@ -44,10 +30,6 @@ Knock.setup do |config|
44
30
  # config.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
45
31
 
46
32
  ## If using Auth0, uncomment the line below
47
- # config.token_secret_signature_key = -> { JWT.base64url_decode Rails.application.secrets.auth0_client_secret }
48
- config.token_secret_signature_key = lambda {
49
- secret = Rails.application.secrets.auth0_client_secret
50
- secret += '=' * (4 - secret.length.modulo(4))
51
- Base64.decode64(secret.tr('-_', '+/'))
52
- }
33
+ config.token_secret_signature_key = -> { JWT.base64url_decode Rails.application.secrets.auth0_client_secret }
34
+
53
35
  end
@@ -57,16 +57,17 @@ module Auth0
57
57
  raise Auth0::InvalidParameter, 'Must supply a valid username' if username.to_s.empty?
58
58
  raise Auth0::InvalidParameter, 'Must supply a valid password' if password.to_s.empty?
59
59
  request_params = {
60
- client_id: @client_id,
61
- username: username,
62
- password: password,
63
- scope: options.fetch(:scope, 'openid'),
64
- connection: connection_name,
65
- grant_type: options.fetch(:grant_type, password),
66
- id_token: id_token,
67
- device: options.fetch(:device, nil)
60
+ client_id: @client_id,
61
+ client_secret: @client_secret,
62
+ username: username,
63
+ password: password,
64
+ scope: options.fetch(:scope, 'openid'),
65
+ connection: connection_name,
66
+ grant_type: options.fetch(:grant_type, password),
67
+ id_token: id_token,
68
+ device: options.fetch(:device, nil)
68
69
  }
69
- post('/oauth/ro', request_params)
70
+ post('/oauth/token', request_params)
70
71
  end
71
72
 
72
73
  # Signup using username/password
@@ -8,6 +8,7 @@ require 'auth0/api/v2/jobs'
8
8
  require 'auth0/api/v2/rules'
9
9
  require 'auth0/api/v2/stats'
10
10
  require 'auth0/api/v2/users'
11
+ require 'auth0/api/v2/users_by_email'
11
12
  require 'auth0/api/v2/user_blocks'
12
13
  require 'auth0/api/v2/tenants'
13
14
  require 'auth0/api/v2/tickets'
@@ -28,6 +29,7 @@ module Auth0
28
29
  include Auth0::Api::V2::Rules
29
30
  include Auth0::Api::V2::Stats
30
31
  include Auth0::Api::V2::Users
32
+ include Auth0::Api::V2::UsersByEmail
31
33
  include Auth0::Api::V2::UserBlocks
32
34
  include Auth0::Api::V2::Tenants
33
35
  include Auth0::Api::V2::Tickets
@@ -102,6 +102,7 @@ module Auth0
102
102
  path = "#{users_path}/#{user_id}"
103
103
  patch(path, body)
104
104
  end
105
+ alias update_user patch_user
105
106
 
106
107
  # Delete a user's multifactor provider
107
108
  # @see https://auth0.com/docs/api/v2#!/Users/delete_multifactor_by_provider
@@ -0,0 +1,35 @@
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 fields [string] A comma separated list of fields to include or exclude from the result.
12
+ # @param include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
13
+ # @param email [string] E-mail to be searched
14
+ #
15
+ # @return [json] Returns the list of existing users.
16
+ def users_by_email(email, options = {})
17
+ raise Auth0::InvalidParameter, 'Must supply a valid email' if email.to_s.empty?
18
+ request_params = {
19
+ fields: options.fetch(:fields, nil),
20
+ include_fields: options.fetch(:include_fields, nil)
21
+ }
22
+ request_params[:email] = email
23
+ get(users_by_email_path, request_params)
24
+ end
25
+
26
+ private
27
+
28
+ # Users By Emails API path
29
+ def users_by_email_path
30
+ @users_by_email_path ||= '/api/v2/users-by-email'
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -15,6 +15,8 @@ module Auth0
15
15
  class ServerError < Auth0::Exception; end
16
16
  # exception for incorrect request, you've sent wrong params
17
17
  class BadRequest < Auth0::Exception; end
18
+ # exception for timeouts
19
+ class RequestTimeout < Auth0::Exception; end
18
20
  # exception for unset user_id, this might cause removal of
19
21
  # all users, or other unexpected behaviour
20
22
  class MissingUserId < Auth0::Exception; end
@@ -48,7 +48,12 @@ module Auth0
48
48
  def call(method, url, timeout, headers, body = nil)
49
49
  RestClient::Request.execute(method: method, url: url, timeout: timeout, headers: headers, payload: body)
50
50
  rescue RestClient::Exception => e
51
- e.response
51
+ case e
52
+ when RestClient::RequestTimeout
53
+ raise Auth0::RequestTimeout
54
+ else
55
+ return e.response
56
+ end
52
57
  end
53
58
  end
54
59
  end
@@ -1,4 +1,4 @@
1
1
  # current version of gem
2
2
  module Auth0
3
- VERSION = '4.1.0'.freeze
3
+ VERSION = '4.4.0'.freeze
4
4
  end
@@ -0,0 +1,10 @@
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
@@ -3,7 +3,7 @@ describe Auth0::Api::AuthenticationEndpoints do
3
3
  attr_reader :client, :impersonate_user, :impersonator_user, :global_client, :password
4
4
 
5
5
  before(:all) do
6
- @client = Auth0Client.new(v2_creds)
6
+ @client = Auth0Client.new(Credentials.v2_creds)
7
7
  impersonate_username = Faker::Internet.user_name
8
8
  impersonate_email = "#{entity_suffix}#{Faker::Internet.safe_email(impersonate_username)}"
9
9
  @password = Faker::Internet.password
@@ -36,11 +36,6 @@ describe Auth0::Api::AuthenticationEndpoints do
36
36
  it { expect(acces_token).to_not be_nil }
37
37
  end
38
38
 
39
- describe '.login' do
40
- let(:login) { global_client.login(impersonate_user['email'], password) }
41
- it { expect(login).to(include('id_token', 'access_token', 'token_type')) }
42
- end
43
-
44
39
  describe '.signup' do
45
40
  let(:signup_username) { Faker::Internet.user_name }
46
41
  let(:signup_email) { "#{entity_suffix}#{Faker::Internet.safe_email(signup_username)}" }
@@ -51,9 +46,9 @@ describe Auth0::Api::AuthenticationEndpoints do
51
46
 
52
47
  describe '.change_password' do
53
48
  let(:change_password) do
54
- global_client.change_password(impersonate_user['user_id'], password)
49
+ global_client.change_password(impersonate_user['user_id'], '')
55
50
  end
56
- it { expect(change_password).to eq '"We\'ve just sent you an email to reset your password."' }
51
+ it { expect(change_password).to(include('We\'ve just sent you an email to reset your password.')) }
57
52
  end
58
53
 
59
54
  skip '.start_passwordless_email_flow' do
@@ -80,39 +75,4 @@ describe Auth0::Api::AuthenticationEndpoints do
80
75
  let(:wsfed_metadata) { global_client.wsfed_metadata }
81
76
  it { expect(wsfed_metadata).to(include('<EntityDescriptor')) }
82
77
  end
83
-
84
- describe '.token_info' do
85
- let(:id_token) { global_client.login(impersonate_user['email'], password)['id_token'] }
86
- let(:token_info) { global_client.token_info(id_token) }
87
- it { expect(token_info).to(include('email', 'clientID', 'global_client_id')) }
88
- end
89
-
90
- describe '.delegation' do
91
- let(:id_token) { global_client.login(impersonate_user['email'], password)['id_token'] }
92
- let(:target) { global_client.clients[0]['clientID'] }
93
- let(:delegation) { global_client.delegation(id_token, target) }
94
- it { expect(delegation).to(include('token_type', 'expires_in', 'id_token')) }
95
- end
96
-
97
- describe '.impersonation' do
98
- let(:impersonate_url) do
99
- global_client.impersonate(impersonate_user['user_id'], ENV['CLIENT_ID'], impersonator_user['user_id'], {})
100
- end
101
- it { expect(impersonate_url).to_not be_nil }
102
- end
103
-
104
- describe '.unlink_user' do
105
- let(:access_token) { global_client.login(impersonate_user['email'], password)['access_token'] }
106
- let(:unlink_user) { global_client.unlink_user(access_token, impersonator_user['user_id']) }
107
- it { expect(unlink_user).to eq 'OK' }
108
- end
109
-
110
- describe '.user_info' do
111
- let(:access_token) { global_client.login(impersonate_user['email'], password)['access_token'] }
112
- let(:credentials) { { client_id: ENV['CLIENT_ID'], token: access_token, domain: ENV['DOMAIN'] } }
113
- let(:client) { Auth0Client.new(credentials) }
114
- let(:user_info) { client.user_info }
115
- it { expect(user_info['email']).to eq impersonate_user['email'] }
116
- it { expect(user_info).to(include('clientID', 'identities', 'nickname', 'picture')) }
117
- end
118
78
  end