auth0 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.bundle/config +2 -1
- data/CHANGELOG.md +12 -2
- data/lib/auth0/api/v2.rb +3 -0
- data/lib/auth0/api/v2/connections.rb +45 -0
- data/lib/auth0/api/v2/users.rb +2 -4
- data/lib/auth0/exception.rb +2 -0
- data/lib/auth0/mixins/initializer.rb +11 -5
- data/lib/auth0/version.rb +1 -1
- data/spec/integration/lib/auth0/api/v1/api_users_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +2 -2
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +71 -0
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +3 -3
- data/spec/integration/lib/auth0/auth0_client_spec.rb +26 -9
- data/spec/lib/auth0/api/v2/connections_spec.rb +70 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +2 -2
- data/spec/lib/auth0/mixins/initializer_spec.rb +6 -6
- data/spec/spec_helper_full.rb +3 -1
- data/spec/support/credentials.rb +9 -9
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a47592985ca2d564200c14e5b0129e196f609a9
|
4
|
+
data.tar.gz: 938c7174648629d40e948855de95a1531c8245b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767338bdf3da7e5f081cde39fe65f742ab0e588087e057b59142e8a1d70f8b281b3dab59d17b8a8071a9e2dd120ac6132fd0b56ed71a027bc67bb2a3088a0b9c
|
7
|
+
data.tar.gz: 21a89cc78706a91f6b503bed30b39b9ac6a9df1ec8b2804fe172034d6049388d77e1334806ae408536bb73631f5b90ae5b74a993e39d834979c9246f2d429cec
|
data/.bundle/config
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [v3.5.0](https://github.com/auth0/ruby-auth0/tree/v3.5.0) (2015-05-21)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.
|
5
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.4.0...v3.5.0)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Client information headers [\#31](https://github.com/auth0/ruby-auth0/pull/31) ([benschwarz](https://github.com/benschwarz))
|
10
|
+
|
11
|
+
## [v3.4.0](https://github.com/auth0/ruby-auth0/tree/v3.4.0) (2015-05-07)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v3.3.0...v3.4.0)
|
6
14
|
|
7
15
|
**Closed issues:**
|
8
16
|
|
17
|
+
- Changelog [\#29](https://github.com/auth0/ruby-auth0/issues/29)
|
18
|
+
|
9
19
|
- Tag releases [\#16](https://github.com/auth0/ruby-auth0/issues/16)
|
10
20
|
|
11
21
|
**Merged pull requests:**
|
data/lib/auth0/api/v2.rb
CHANGED
@@ -3,6 +3,8 @@ require "auth0/api/v2/users"
|
|
3
3
|
require "auth0/api/v2/blacklists"
|
4
4
|
require "auth0/api/v2/jobs"
|
5
5
|
require "auth0/api/v2/stats"
|
6
|
+
require "auth0/api/v2/connections"
|
7
|
+
|
6
8
|
module Auth0
|
7
9
|
module Api
|
8
10
|
# https://auth0.com/docs/apiv2
|
@@ -12,6 +14,7 @@ module Auth0
|
|
12
14
|
include Auth0::Api::V2::Blacklists
|
13
15
|
include Auth0::Api::V2::Jobs
|
14
16
|
include Auth0::Api::V2::Stats
|
17
|
+
include Auth0::Api::V2::Connections
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Auth0
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
module Connections
|
5
|
+
def connections(strategy: nil, fields: nil, include_fields: true)
|
6
|
+
request_params = {
|
7
|
+
strategy: strategy,
|
8
|
+
fields: fields,
|
9
|
+
include_fields: include_fields
|
10
|
+
}
|
11
|
+
path = "/api/v2/connections"
|
12
|
+
get(path, request_params)
|
13
|
+
end
|
14
|
+
alias :get_connections :connections
|
15
|
+
|
16
|
+
def create_connection(body)
|
17
|
+
path = "/api/v2/connections"
|
18
|
+
request_params = body
|
19
|
+
post(path, request_params )
|
20
|
+
end
|
21
|
+
|
22
|
+
def connection(connection_id, fields: nil, include_fields: true)
|
23
|
+
path = "/api/v2/connections/" + connection_id.to_s
|
24
|
+
request_params = {
|
25
|
+
fields: fields,
|
26
|
+
include_fields: include_fields
|
27
|
+
}
|
28
|
+
get(path, request_params)
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete_connection(connection_id)
|
32
|
+
raise Auth0::MissingConnectionId, "you must specify a connection id" if connection_id.to_s.empty?
|
33
|
+
path = "/api/v2/connections/#{connection_id}"
|
34
|
+
delete(path)
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_connection(connection_id, body)
|
38
|
+
raise Auth0::MissingConnectionId, "you must specify a connection id" if connection_id.to_s.empty?
|
39
|
+
path = "/api/v2/connections/" + connection_id.to_s
|
40
|
+
patch(path, body)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/auth0/api/v2/users.rb
CHANGED
@@ -4,7 +4,7 @@ module Auth0
|
|
4
4
|
#https://auth0.com/docs/apiv2#!/users
|
5
5
|
module Users
|
6
6
|
#https://auth0.com/docs/apiv2#!/users/get_users
|
7
|
-
def users( per_page: nil, page: nil, include_totals: nil, sort: nil, connection: nil, fields: nil,
|
7
|
+
def users( per_page: nil, page: nil, include_totals: nil, sort: nil, connection: nil, fields: nil, q: nil )
|
8
8
|
request_params = {
|
9
9
|
per_page: per_page,
|
10
10
|
page: page,
|
@@ -12,7 +12,6 @@ module Auth0
|
|
12
12
|
sort: sort,
|
13
13
|
connection: connection,
|
14
14
|
fields: fields,
|
15
|
-
exclude_fields: exclude_fields,
|
16
15
|
q: q
|
17
16
|
}
|
18
17
|
path = "/api/v2/users"
|
@@ -35,11 +34,10 @@ module Auth0
|
|
35
34
|
end
|
36
35
|
|
37
36
|
#https://auth0.com/docs/apiv2#!/users/get_users_by_id
|
38
|
-
def user(user_id, fields: nil
|
37
|
+
def user(user_id, fields: nil)
|
39
38
|
path = "/api/v2/users/" + user_id.to_s
|
40
39
|
request_params = {
|
41
40
|
fields: fields,
|
42
|
-
exclude_fields: exclude_fields
|
43
41
|
}
|
44
42
|
get(path, request_params)
|
45
43
|
end
|
data/lib/auth0/exception.rb
CHANGED
@@ -16,6 +16,8 @@ class Auth0::ServerError < Auth0::Exception; end
|
|
16
16
|
class Auth0::BadRequest < Auth0::Exception; end
|
17
17
|
# exception for unset user_id, this might cause removal of all users, or other unexpected bahaviour
|
18
18
|
class Auth0::MissingUserId < Auth0::Exception; end
|
19
|
+
# exception for an unset connection_id
|
20
|
+
class Auth0::MissingConnectionId < Auth0::Exception; end
|
19
21
|
# Api v2 access denied
|
20
22
|
class Auth0::AccessDenied < Auth0::Exception; end
|
21
23
|
# Invalid parameter passed, e.g. empty where ID is required
|
@@ -29,12 +29,18 @@ module Auth0
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def client_headers(config)
|
32
|
-
|
33
|
-
|
32
|
+
client_info = JSON.dump({name: 'ruby-auth0', version: Auth0::VERSION})
|
33
|
+
|
34
|
+
headers = {
|
35
|
+
'Content-Type' => 'application/json'
|
34
36
|
}
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
|
38
|
+
if !config[:opt_out_sdk_info]
|
39
|
+
headers['User-Agent'] = "Ruby/#{RUBY_VERSION}"
|
40
|
+
headers['Auth0-Client'] = Base64.urlsafe_encode64(client_info)
|
41
|
+
end
|
42
|
+
|
43
|
+
headers
|
38
44
|
end
|
39
45
|
|
40
46
|
def api_domain(options)
|
data/lib/auth0/version.rb
CHANGED
@@ -3,7 +3,7 @@ describe Auth0::Api::V1::Users do
|
|
3
3
|
|
4
4
|
let(:client) { Auth0Client.new(v1_creds) }
|
5
5
|
let(:username) { Faker::Internet.user_name }
|
6
|
-
let(:email) { Faker::Internet.safe_email(
|
6
|
+
let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(username)}" }
|
7
7
|
let(:password) { Faker::Internet.password }
|
8
8
|
let(:connection) { "Username-Password-Authentication" }
|
9
9
|
let!(:user) { client.create_user(email, password, connection, {
|
@@ -7,9 +7,9 @@ describe Auth0::Api::V2::Clients do
|
|
7
7
|
|
8
8
|
it { expect(client.clients).to_not be_empty }
|
9
9
|
|
10
|
-
it { expect(client.create_client(client_name, {
|
10
|
+
it { expect(client.create_client(client_name, {custom_login_page_on: false})).to include("name" => client_name, "custom_login_page_on" => false) }
|
11
11
|
|
12
|
-
it { expect(client.patch_client(existing_client["client_id"], {
|
12
|
+
it { expect(client.patch_client(existing_client["client_id"], {custom_login_page_on: false, sso: true})).to include("custom_login_page_on" => false, "sso" => true) }
|
13
13
|
|
14
14
|
it { expect { client.delete_client(existing_client["client_id"]) }.to_not raise_error }
|
15
15
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe Auth0::Api::V2::Connections do
|
3
|
+
|
4
|
+
let(:client) { Auth0Client.new(v2_creds) }
|
5
|
+
|
6
|
+
let(:name) { SecureRandom.uuid[0..25] }
|
7
|
+
let(:strategy) { 'google-oauth2' }
|
8
|
+
let(:options) { {} }
|
9
|
+
let(:enabled_clients) { [] }
|
10
|
+
|
11
|
+
let!(:connection) { client.create_connection({
|
12
|
+
name: name,
|
13
|
+
strategy: strategy,
|
14
|
+
options: options,
|
15
|
+
enabled_clients: enabled_clients,
|
16
|
+
})}
|
17
|
+
|
18
|
+
describe '.connections' do
|
19
|
+
|
20
|
+
let(:connections) { client.connections() }
|
21
|
+
|
22
|
+
it { expect(connections.size).to be > 0 }
|
23
|
+
it { expect(connections.find {|con| con["name"] == name}).to_not be_nil }
|
24
|
+
|
25
|
+
context "#filters" do
|
26
|
+
it { expect(client.connections(strategy: strategy).size).to be > 0 }
|
27
|
+
it { expect(client.connections(strategy: strategy, fields: [:name].join(',')).first).to include("name") }
|
28
|
+
it { expect(client.connections(strategy: strategy, fields: [:name].join(','), include_fields: false).first).to_not include("name") }
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.connection' do
|
34
|
+
|
35
|
+
let(:subject) { client.connection(connection["id"]) }
|
36
|
+
|
37
|
+
it { should include("name" => connection['name']) }
|
38
|
+
|
39
|
+
context "#filters" do
|
40
|
+
it { expect(client.connection(connection["id"], fields: [:name, :id].join(','))).to include("id", "name") }
|
41
|
+
it { expect(client.connection(connection["id"], fields: [:name, :id].join(','), include_fields: false)).to_not include("id", "name") }
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '.create_connection' do
|
47
|
+
|
48
|
+
let(:subject) { connection }
|
49
|
+
|
50
|
+
it { should include("id", "name") }
|
51
|
+
it { should include(
|
52
|
+
"name" => connection['name'],
|
53
|
+
)}
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '.delete_connection' do
|
58
|
+
|
59
|
+
it { expect { client.delete_connection connection["id"] }.to_not raise_error }
|
60
|
+
|
61
|
+
it { expect { client.delete_connection "" }.to raise_error(Auth0::MissingConnectionId) }
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
describe '.update_connection' do
|
67
|
+
new_name = SecureRandom.uuid[0..25]
|
68
|
+
it { expect(client.update_connection(connection["id"], {"name" => new_name})).to include("name" => new_name) }
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -3,7 +3,7 @@ describe Auth0::Api::V2::Users do
|
|
3
3
|
|
4
4
|
let(:client) { Auth0Client.new(v2_creds) }
|
5
5
|
let(:username) { Faker::Internet.user_name }
|
6
|
-
let(:email) { Faker::Internet.safe_email(
|
6
|
+
let(:email) { "#{entity_suffix}#{Faker::Internet.safe_email(username)}" }
|
7
7
|
let(:password) { Faker::Internet.password }
|
8
8
|
let(:connection) { "Username-Password-Authentication" }
|
9
9
|
let!(:user) { client.create_user(username, {
|
@@ -24,7 +24,7 @@ describe Auth0::Api::V2::Users do
|
|
24
24
|
context "#filters" do
|
25
25
|
it { expect(client.users(per_page: 1).size).to be 1 }
|
26
26
|
it { expect(client.users(per_page: 1, fields: [:picture, :email, :user_id].join(',')).first).to include("email", "user_id", "picture") }
|
27
|
-
it { expect(client.users(per_page: 1, fields: [:
|
27
|
+
it { expect(client.users(per_page: 1, fields: [:email].join(',')).first).to_not include("user_id", "picture") }
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -37,7 +37,7 @@ describe Auth0::Api::V2::Users do
|
|
37
37
|
|
38
38
|
context "#filters" do
|
39
39
|
it { expect(client.user(user["user_id"], fields: [:picture, :email, :user_id].join(','))).to include("email", "user_id", "picture") }
|
40
|
-
it { expect(client.user(user["user_id"], fields: [:
|
40
|
+
it { expect(client.user(user["user_id"], fields: [:email].join(','))).to_not include("user_id", "picture") }
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
@@ -42,15 +42,32 @@ describe Auth0::Client do
|
|
42
42
|
let(:credentials) { v2_credentials.merge({access_token: ENV["MASTER_JWT"]}) }
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
let(:
|
47
|
-
let(:domain) { 'myhost.auth0.com' }
|
48
|
-
let(:client) { Auth0::Client.new(v2_credentials.merge({access_token: access_token, domain: domain})) }
|
49
|
-
|
45
|
+
context "client headers" do
|
46
|
+
let(:client) { Auth0::Client.new(v2_credentials.merge({access_token: 'abc123', domain: 'myhost.auth0.com'})) }
|
50
47
|
let(:headers) { client.class.headers }
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
|
49
|
+
let(:base64_token) {
|
50
|
+
Base64.urlsafe_encode64('{"name":"ruby-auth0","version":"'+Auth0::VERSION+'"}')
|
51
|
+
}
|
52
|
+
|
53
|
+
it "has the correct headers present" do
|
54
|
+
expect(headers.keys.sort).to eql ['Auth0-Client', 'Authorization', 'Content-Type', 'User-Agent']
|
55
|
+
end
|
56
|
+
|
57
|
+
it "uses the correct access token" do
|
58
|
+
expect(headers['Authorization']).to eql "Bearer abc123"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "is always json" do
|
62
|
+
expect(headers['Content-Type']).to eql 'application/json'
|
63
|
+
end
|
64
|
+
|
65
|
+
it "sets the ruby version" do
|
66
|
+
expect(headers['User-Agent']).to eql "Ruby/#{RUBY_VERSION}"
|
67
|
+
end
|
68
|
+
|
69
|
+
it "sets the client version" do
|
70
|
+
expect(headers['Auth0-Client']).to eql base64_token
|
71
|
+
end
|
55
72
|
end
|
56
73
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe Auth0::Api::V2::Connections do
|
3
|
+
before :all do
|
4
|
+
dummy_instance = DummyClass.new
|
5
|
+
dummy_instance.extend(Auth0::Api::V2::Connections)
|
6
|
+
@instance = dummy_instance
|
7
|
+
end
|
8
|
+
|
9
|
+
context ".connections" do
|
10
|
+
it {expect(@instance).to respond_to(:connections)}
|
11
|
+
it {expect(@instance).to respond_to(:get_connections)}
|
12
|
+
|
13
|
+
it "is expected to call /api/v2/connections" do
|
14
|
+
expect(@instance).to receive(:get).with("/api/v2/connections", {
|
15
|
+
strategy: nil,
|
16
|
+
fields: nil,
|
17
|
+
include_fields: true
|
18
|
+
})
|
19
|
+
|
20
|
+
expect{@instance.connections}.not_to raise_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context '.create_connection' do
|
25
|
+
it {expect(@instance).to respond_to(:connection)}
|
26
|
+
it {expect(@instance).to respond_to(:create_connection)}
|
27
|
+
|
28
|
+
it "is expected to call /api/v2/connections" do
|
29
|
+
body = double
|
30
|
+
expect(@instance).to receive(:post).with("/api/v2/connections", body)
|
31
|
+
|
32
|
+
expect{@instance.create_connection(body)}.not_to raise_error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context ".connection" do
|
37
|
+
it {expect(@instance).to respond_to(:connection)}
|
38
|
+
it "is expected to call get request to /api/v2/connection/CONNECTION_ID" do
|
39
|
+
expect(@instance).to receive(:get).with("/api/v2/connections/CONNECTION_ID", {fields: nil, include_fields: true})
|
40
|
+
expect{@instance.connection("CONNECTION_ID")}.not_to raise_error
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context ".delete_connection" do
|
45
|
+
it {expect(@instance).to respond_to(:delete_connection)}
|
46
|
+
it "is expected to call delete to /api/v2/connections/connectionId" do
|
47
|
+
expect(@instance).to receive(:delete).with("/api/v2/connections/connectionId")
|
48
|
+
@instance.delete_connection("connectionId")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "is expected not to call delete to /api/v2/connections if connection_id is blank" do
|
52
|
+
expect(@instance).not_to receive(:delete)
|
53
|
+
expect{@instance.delete_connection("")}.to raise_exception(Auth0::MissingConnectionId)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context ".update_connection" do
|
58
|
+
it {expect(@instance).to respond_to(:update_connection)}
|
59
|
+
it "is expected to call patch to /api/v2/connections/connectionId" do
|
60
|
+
body = double
|
61
|
+
expect(@instance).to receive(:patch).with("/api/v2/connections/connectionId", body)
|
62
|
+
@instance.update_connection("connectionId", body)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "is expected not to call delete to /api/v2/connections if connection_id is blank" do
|
66
|
+
expect(@instance).not_to receive(:patch)
|
67
|
+
expect{@instance.delete_connection("")}.to raise_exception(Auth0::MissingConnectionId)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -10,7 +10,7 @@ describe Auth0::Api::V2::Users do
|
|
10
10
|
it {expect(@instance).to respond_to(:users)}
|
11
11
|
it {expect(@instance).to respond_to(:get_users)}
|
12
12
|
it "is expected to call /api/v2/users" do
|
13
|
-
expect(@instance).to receive(:get).with("/api/v2/users",{:per_page=>nil, :page=>nil, :include_totals=>nil, :sort=>nil, :connection=>nil, :fields=>nil, :
|
13
|
+
expect(@instance).to receive(:get).with("/api/v2/users",{:per_page=>nil, :page=>nil, :include_totals=>nil, :sort=>nil, :connection=>nil, :fields=>nil, :q=>nil})
|
14
14
|
expect{@instance.users}.not_to raise_error
|
15
15
|
end
|
16
16
|
end
|
@@ -18,7 +18,7 @@ describe Auth0::Api::V2::Users do
|
|
18
18
|
context ".user" do
|
19
19
|
it {expect(@instance).to respond_to(:user)}
|
20
20
|
it "is expected to call get request to /api/v2/users/USER_ID" do
|
21
|
-
expect(@instance).to receive(:get).with("/api/v2/users/USER_ID", {fields: nil
|
21
|
+
expect(@instance).to receive(:get).with("/api/v2/users/USER_ID", {fields: nil})
|
22
22
|
expect{@instance.user("USER_ID")}.not_to raise_error
|
23
23
|
end
|
24
24
|
end
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
class MockClass
|
4
|
-
attr_reader :token
|
4
|
+
attr_reader :token
|
5
5
|
include Auth0::Mixins::Initializer
|
6
6
|
include HTTParty
|
7
7
|
end
|
8
8
|
|
9
9
|
describe Auth0::Mixins::Initializer do
|
10
10
|
let(:params) { { namespace: 'samples.auth0.com' } }
|
11
|
-
let(:instance) { DummyClassForProxy.include
|
11
|
+
let(:instance) { DummyClassForProxy.send(:include, described_class).new(params) }
|
12
12
|
context 'api v2' do
|
13
13
|
before do
|
14
14
|
params[:api_version] = 2
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it 'sets token when access_token is passed' do
|
18
18
|
params[:access_token] = '123'
|
19
|
-
|
19
|
+
|
20
20
|
expect(instance.instance_variable_get('@token')).to eq('123')
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'sets token when token is passed' do
|
24
24
|
params[:token] = '123'
|
25
|
-
|
26
|
-
expect(instance.instance_variable_get('@token')).to eq('123')
|
25
|
+
|
26
|
+
expect(instance.instance_variable_get('@token')).to eq('123')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/spec/spec_helper_full.rb
CHANGED
@@ -29,6 +29,7 @@ RSpec.configure do |config|
|
|
29
29
|
config.include Rack::Test::Methods
|
30
30
|
config.include Credentials
|
31
31
|
config.after(:suite) do
|
32
|
+
puts "Cleaning up for #{entity_suffix}"
|
32
33
|
v2_client = Auth0Client.new({token: ENV["MASTER_JWT"], api_version: 2, domain: ENV["DOMAIN"]})
|
33
34
|
v2_client
|
34
35
|
.clients
|
@@ -36,7 +37,8 @@ RSpec.configure do |config|
|
|
36
37
|
.each { |client| v2_client.delete_client(client["client_id"]) }
|
37
38
|
v2_client
|
38
39
|
.users
|
39
|
-
.select { |user| user["email"].split("@").first.
|
40
|
+
.select { |user| user["email"].split("@").first.include? entity_suffix }
|
40
41
|
.each { |user| v2_client.delete_user(user["user_id"])}
|
42
|
+
puts "Finished cleaning up for #{entity_suffix}"
|
41
43
|
end
|
42
44
|
end
|
data/spec/support/credentials.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module Credentials
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
def v1_creds
|
3
|
+
{client_id: ENV["CLIENT_ID"], client_secret: ENV["CLIENT_SECRET"], domain: ENV["DOMAIN"]}
|
4
|
+
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def v1_global_creds
|
7
|
+
{client_id: ENV["GLOBAL_CLIENT_ID"], client_secret: ENV["GLOBAL_CLIENT_SECRET"], domain: ENV["DOMAIN"]}
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def v2_creds
|
11
|
+
{token: ENV["MASTER_JWT"], api_version: 2, domain: ENV["DOMAIN"]}
|
12
|
+
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Auth0
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: httparty
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- lib/auth0/api/v2.rb
|
233
233
|
- lib/auth0/api/v2/blacklists.rb
|
234
234
|
- lib/auth0/api/v2/clients.rb
|
235
|
+
- lib/auth0/api/v2/connections.rb
|
235
236
|
- lib/auth0/api/v2/jobs.rb
|
236
237
|
- lib/auth0/api/v2/stats.rb
|
237
238
|
- lib/auth0/api/v2/users.rb
|
@@ -245,6 +246,7 @@ files:
|
|
245
246
|
- spec/integration/lib/auth0/api/v1/api_clients_spec.rb
|
246
247
|
- spec/integration/lib/auth0/api/v1/api_users_spec.rb
|
247
248
|
- spec/integration/lib/auth0/api/v2/api_clients_spec.rb
|
249
|
+
- spec/integration/lib/auth0/api/v2/api_connections_spec.rb
|
248
250
|
- spec/integration/lib/auth0/api/v2/api_users_spec.rb
|
249
251
|
- spec/integration/lib/auth0/auth0_client_spec.rb
|
250
252
|
- spec/lib/auth0/api/authentication_endpoints_spec.rb
|
@@ -255,6 +257,7 @@ files:
|
|
255
257
|
- spec/lib/auth0/api/v1/users_spec.rb
|
256
258
|
- spec/lib/auth0/api/v2/blacklists_spec.rb
|
257
259
|
- spec/lib/auth0/api/v2/clients_spec.rb
|
260
|
+
- spec/lib/auth0/api/v2/connections_spec.rb
|
258
261
|
- spec/lib/auth0/api/v2/jobs_spec.rb
|
259
262
|
- spec/lib/auth0/api/v2/stats_spec.rb
|
260
263
|
- spec/lib/auth0/api/v2/users_spec.rb
|
@@ -296,6 +299,7 @@ test_files:
|
|
296
299
|
- spec/integration/lib/auth0/api/v1/api_clients_spec.rb
|
297
300
|
- spec/integration/lib/auth0/api/v1/api_users_spec.rb
|
298
301
|
- spec/integration/lib/auth0/api/v2/api_clients_spec.rb
|
302
|
+
- spec/integration/lib/auth0/api/v2/api_connections_spec.rb
|
299
303
|
- spec/integration/lib/auth0/api/v2/api_users_spec.rb
|
300
304
|
- spec/integration/lib/auth0/auth0_client_spec.rb
|
301
305
|
- spec/lib/auth0/api/authentication_endpoints_spec.rb
|
@@ -306,6 +310,7 @@ test_files:
|
|
306
310
|
- spec/lib/auth0/api/v1/users_spec.rb
|
307
311
|
- spec/lib/auth0/api/v2/blacklists_spec.rb
|
308
312
|
- spec/lib/auth0/api/v2/clients_spec.rb
|
313
|
+
- spec/lib/auth0/api/v2/connections_spec.rb
|
309
314
|
- spec/lib/auth0/api/v2/jobs_spec.rb
|
310
315
|
- spec/lib/auth0/api/v2/stats_spec.rb
|
311
316
|
- spec/lib/auth0/api/v2/users_spec.rb
|