auth0 4.1.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +38 -0
- data/DEPLOYMENT.md +10 -1
- data/Dockerfile +5 -0
- data/README.md +14 -17
- data/RUBYGEM.md +9 -0
- data/auth0.gemspec +2 -2
- data/examples/ruby-api/.env.example +2 -0
- data/examples/ruby-on-rails-api/.env.example +2 -0
- data/examples/ruby-on-rails-api/Gemfile +7 -7
- data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +2 -2
- data/examples/ruby-on-rails-api/app/models/User.rb +5 -0
- data/examples/ruby-on-rails-api/config/initializers/knock.rb +2 -20
- data/lib/auth0/api/authentication_endpoints.rb +10 -9
- data/lib/auth0/api/v2.rb +2 -0
- data/lib/auth0/api/v2/users.rb +1 -0
- data/lib/auth0/api/v2/users_by_email.rb +35 -0
- data/lib/auth0/exception.rb +2 -0
- data/lib/auth0/mixins/httpproxy.rb +6 -1
- data/lib/auth0/version.rb +1 -1
- data/publish_rubygem.sh +10 -0
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +3 -43
- data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +26 -17
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +45 -9
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +58 -13
- data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +22 -4
- data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +66 -22
- data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +38 -24
- data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +15 -2
- data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +52 -16
- data/spec/integration/lib/auth0/api/v2/api_stats_spec.rb +12 -3
- data/spec/integration/lib/auth0/api/v2/api_tenants_spec.rb +21 -5
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +15 -3
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +58 -37
- data/spec/integration/lib/auth0/auth0_client_spec.rb +1 -1
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +5 -3
- data/spec/lib/auth0/api/v2/users_by_email_spec.rb +21 -0
- data/spec/lib/auth0/client_spec.rb +0 -61
- data/spec/spec_helper.rb +23 -0
- data/spec/spec_helper_full.rb +8 -19
- data/spec/spec_helper_unit.rb +0 -9
- data/spec/support/credentials.rb +2 -0
- data/spec/support/dummy_class.rb +1 -1
- metadata +55 -107
- data/spec/integration/lib/auth0/api/v1/api_clients_spec.rb +0 -12
- data/spec/integration/lib/auth0/api/v1/api_users_spec.rb +0 -52
- data/spec/lib/auth0/api/v1/clients_spec.rb +0 -61
- data/spec/lib/auth0/api/v1/connections_spec.rb +0 -66
- data/spec/lib/auth0/api/v1/logs_spec.rb +0 -46
- data/spec/lib/auth0/api/v1/rules_spec.rb +0 -42
- data/spec/lib/auth0/api/v1/users_spec.rb +0 -248
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 50bf71ae1695273ad9f86de42239cff42c681c8c0841fde4f2002c1e045940b0
|
4
|
+
data.tar.gz: 4956b4307c7c2d93fd1d8e955c2f77fc1c6fdd57232674c1dc50a1d95507097b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cdbe3de507568e75af632efdd47c005c71425f0c884fb66863d63325ac5f4d162e0d129d648c306ad5747bb6d6634819431cd566420e06b87611b384f91b632
|
7
|
+
data.tar.gz: cc4d1e11073b11d8412615bf57586e3f173d649ae48f47b212104de5aaca6b294d86f06eeb3bbb7f13c3016a3ef4a2f57d5e6b87b08db776e730e36e9eb1a566
|
data/CHANGELOG.md
CHANGED
@@ -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
|
|
data/DEPLOYMENT.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
```
|
2
2
|
bundle install
|
3
3
|
bundle exec rake spec
|
4
|
-
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.
|
data/Dockerfile
ADDED
data/README.md
CHANGED
@@ -4,6 +4,7 @@ Ruby api client for [Auth0](https://auth0.com) platform
|
|
4
4
|
[](http://badge.fury.io/rb/auth0)
|
5
5
|
[](https://coveralls.io/r/auth0/ruby-auth0?branch=master)
|
6
6
|
[](https://gemnasium.com/auth0/ruby-auth0)
|
7
|
+
[](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
|
-
|
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
|
-
:
|
46
|
+
:token => "YOUR JWT HERE",
|
44
47
|
:domain => "<YOUR ACCOUNT>.auth0.com",
|
45
|
-
:
|
48
|
+
:timeout => 15
|
46
49
|
)
|
47
50
|
|
48
51
|
puts auth0.get_users
|
49
52
|
```
|
50
53
|
|
51
|
-
|
52
|
-
You can setup a custom timeout in the Auth0Client. By default it is set to 10 minutes.
|
54
|
+
## API Documentation
|
53
55
|
|
54
|
-
|
55
|
-
require "auth0"
|
56
|
+
Build API docs locally
|
56
57
|
|
57
|
-
|
58
|
-
|
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:
|
data/RUBYGEM.md
ADDED
@@ -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
|
+
```
|
data/auth0.gemspec
CHANGED
@@ -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', '~>
|
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.
|
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
|
@@ -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
|
+
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.
|
10
|
+
gem 'sass-rails', '~> 5.0.6'
|
11
11
|
# Use Uglifier as compressor for JavaScript assets
|
12
|
-
gem 'uglifier', '>=
|
12
|
+
gem 'uglifier', '>= 3.0.3'
|
13
13
|
# Use CoffeeScript for .js.coffee assets and views
|
14
|
-
gem 'coffee-rails', '~> 4.
|
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.
|
23
|
+
gem 'jbuilder', '~> 2.6.0'
|
24
24
|
# bundle exec rake doc:rails generates the API under doc/api.
|
25
|
-
gem 'sdoc', '~> 0.4.
|
25
|
+
gem 'sdoc', '~> 0.4.2', group: :doc
|
26
26
|
# knock dependency
|
27
|
-
gem 'knock', '~>
|
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 :
|
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:
|
8
|
+
user: current_user
|
9
9
|
}
|
10
10
|
end
|
11
11
|
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
|
-
|
48
|
-
|
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:
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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/
|
70
|
+
post('/oauth/token', request_params)
|
70
71
|
end
|
71
72
|
|
72
73
|
# Signup using username/password
|
data/lib/auth0/api/v2.rb
CHANGED
@@ -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
|
data/lib/auth0/api/v2/users.rb
CHANGED
@@ -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
|
data/lib/auth0/exception.rb
CHANGED
@@ -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
|
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
|
data/lib/auth0/version.rb
CHANGED
data/publish_rubygem.sh
ADDED
@@ -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'],
|
49
|
+
global_client.change_password(impersonate_user['user_id'], '')
|
55
50
|
end
|
56
|
-
it { expect(change_password).to
|
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
|