auth0 2.1.1 → 3.0.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 -0
- data/.gitignore +5 -2
- data/.rspec +3 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +68 -0
- data/auth0.gemspec +11 -10
- data/doc/Auth0/AccessDenied.html +142 -0
- data/doc/Auth0/Api/AuthenticationEndpoints.html +592 -0
- data/doc/Auth0/Api/V1/Clients.html +440 -0
- data/doc/Auth0/Api/V1/Connections.html +506 -0
- data/doc/Auth0/Api/V1/Logs.html +366 -0
- data/doc/Auth0/Api/V1/Rules.html +439 -0
- data/doc/Auth0/Api/V1/Users.html +1617 -0
- data/doc/Auth0/Api/V1.html +188 -0
- data/doc/Auth0/Api/V2/Blacklists.html +268 -0
- data/doc/Auth0/Api/V2/Clients.html +477 -0
- data/doc/Auth0/Api/V2/Jobs.html +277 -0
- data/doc/Auth0/Api/V2/Router.html +109 -0
- data/doc/Auth0/Api/V2/Stats.html +268 -0
- data/doc/Auth0/Api/V2/Users.html +652 -0
- data/doc/Auth0/Api/V2.html +193 -0
- data/doc/Auth0/Api.html +128 -0
- data/doc/Auth0/BadRequest.html +142 -0
- data/doc/Auth0/Client.html +164 -0
- data/doc/Auth0/Exception.html +140 -0
- data/doc/Auth0/InvalidParameter.html +142 -0
- data/doc/Auth0/Mixins/HTTPartyProxy.html +121 -0
- data/doc/Auth0/Mixins/Initializer.html +312 -0
- data/doc/Auth0/Mixins.html +153 -0
- data/doc/Auth0/NotFound.html +143 -0
- data/doc/Auth0/ServerError.html +142 -0
- data/doc/Auth0/Unauthorized.html +143 -0
- data/doc/Auth0/Unsupported.html +142 -0
- data/doc/Auth0/UserIdIsBlank.html +143 -0
- data/doc/Auth0.html +153 -0
- data/doc/Auth0Client.html +163 -0
- data/doc/_index.html +418 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +103 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +103 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +435 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/auth0/api/authentication_endpoints.rb +71 -0
- data/lib/auth0/api/v1/clients.rb +48 -0
- data/lib/auth0/api/v1/connections.rb +51 -0
- data/lib/auth0/api/v1/logs.rb +41 -0
- data/lib/auth0/api/v1/rules.rb +44 -0
- data/lib/auth0/api/v1/users.rb +163 -0
- data/lib/auth0/api/v1.rb +19 -0
- data/lib/auth0/api/v2/blacklists.rb +24 -0
- data/lib/auth0/api/v2/clients.rb +41 -0
- data/lib/auth0/api/v2/jobs.rb +20 -0
- data/lib/auth0/api/v2/stats.rb +24 -0
- data/lib/auth0/api/v2/users.rb +67 -0
- data/lib/auth0/api/v2.rb +17 -0
- data/lib/auth0/client.rb +5 -48
- data/lib/auth0/exception.rb +22 -0
- data/lib/auth0/mixins/httparty_proxy.rb +35 -0
- data/lib/auth0/mixins/initializer.rb +34 -0
- data/lib/auth0/mixins.rb +12 -0
- data/lib/auth0/version.rb +3 -2
- data/lib/auth0.rb +6 -1
- data/lib/auth0_client.rb +3 -0
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +56 -0
- data/spec/lib/auth0/api/v1/clients_spec.rb +62 -0
- data/spec/lib/auth0/api/v1/connections_spec.rb +62 -0
- data/spec/lib/auth0/api/v1/logs_spec.rb +46 -0
- data/spec/lib/auth0/api/v1/rules_spec.rb +40 -0
- data/spec/lib/auth0/api/v1/users_spec.rb +217 -0
- data/spec/lib/auth0/api/v2/blacklists_spec.rb +24 -0
- data/spec/lib/auth0/api/v2/clients_spec.rb +54 -0
- data/spec/lib/auth0/api/v2/jobs_spec.rb +21 -0
- data/spec/lib/auth0/api/v2/stats_spec.rb +22 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +72 -0
- data/spec/lib/auth0/client_spec.rb +47 -0
- data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +119 -0
- data/spec/lib/auth0_client_spec.rb +8 -0
- data/spec/spec_helper.rb +8 -7
- data/spec/support/dummy_class.rb +7 -0
- data/spec/support/dummy_class_for_proxy.rb +4 -0
- data/spec/support/stub_response.rb +2 -0
- metadata +159 -28
- data/lib/omniauth/strategies/auth0.rb +0 -62
- data/spec/omniauth/strategies/auth0_spec.rb +0 -149
@@ -0,0 +1,72 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe Auth0::Api::V2::Users do
|
3
|
+
before :all do
|
4
|
+
dummy_instance = DummyClass.new
|
5
|
+
dummy_instance.extend(Auth0::Api::V2::Users)
|
6
|
+
@instance = dummy_instance
|
7
|
+
end
|
8
|
+
|
9
|
+
context ".users" do
|
10
|
+
it {expect(@instance).to respond_to(:users)}
|
11
|
+
it {expect(@instance).to respond_to(:get_users)}
|
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, :exclude_fields=>nil, :q=>nil})
|
14
|
+
expect{@instance.users}.not_to raise_error
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context ".user" do
|
19
|
+
it {expect(@instance).to respond_to(:user)}
|
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, exclude_fields: nil})
|
22
|
+
expect{@instance.user("USER_ID")}.not_to raise_error
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
context ".create_user" do
|
28
|
+
it {expect(@instance).to respond_to(:create_user)}
|
29
|
+
it "is expected to call post to /api/v2/users" do
|
30
|
+
expect(@instance).to receive(:post).with("/api/v2/users", {email: "test@test.com", password: "password", connection: "conn", name:"name"})
|
31
|
+
@instance.create_user("name", {email:"test@test.com",password: "password", connection: "conn"})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context ".delete_users" do
|
36
|
+
it {expect(@instance).to respond_to :delete_users}
|
37
|
+
it "is expected to call delete to /api/v2/users" do
|
38
|
+
expect(@instance).to receive(:delete).with("/api/v2/users")
|
39
|
+
@instance.delete_users
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context ".delete_user" do
|
44
|
+
it {expect(@instance).to respond_to(:delete_user)}
|
45
|
+
it "is expected to call delete to /api/v2/users/userId" do
|
46
|
+
expect(@instance).to receive(:delete).with("/api/v2/users/userId")
|
47
|
+
@instance.delete_user("userId")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "is expected not to call delete to /api/v2/users if user_id is blank" do
|
51
|
+
expect(@instance).not_to receive(:delete)
|
52
|
+
expect{@instance.delete_user("")}.to raise_exception(Auth0::UserIdIsBlank)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context ".delete_user_provider" do
|
57
|
+
it {expect(@instance).to respond_to(:delete_user_provider)}
|
58
|
+
it "is expected to call delete to /api/v2/users/userId/multifactor/provider" do
|
59
|
+
expect(@instance).to receive(:delete).with("/api/v2/users/userId/multifactor/provider")
|
60
|
+
@instance.delete_user_provider("userId", "provider")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context ".patch_user" do
|
65
|
+
it {expect(@instance).to respond_to(:patch_user)}
|
66
|
+
it "is expected to call patch to /api/v2/users/userID" do
|
67
|
+
expect(@instance).to receive(:patch).with("/api/v2/users/UserID", {email: "test@test.com", password: "password", connection: "conn", name:"name"})
|
68
|
+
@instance.patch_user("UserID", {email:"test@test.com",password: "password", connection: "conn", name:"name"})
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe Auth0::Client do
|
3
|
+
context "V1 modules to be included" do
|
4
|
+
let(:subject){Auth0::Client.new({})}
|
5
|
+
before :each do
|
6
|
+
allow_any_instance_of(Auth0::Api::AuthenticationEndpoints).to receive(:obtain_access_token)
|
7
|
+
end
|
8
|
+
it {expect(subject).to be_a HTTParty}
|
9
|
+
it {expect(subject).to be_a Auth0::Mixins}
|
10
|
+
it {expect(subject).to be_a Auth0::Mixins::Initializer}
|
11
|
+
it {expect(subject).to be_a Auth0::Api::V1}
|
12
|
+
it {expect(subject).to be_a Auth0::Api::V1::Users}
|
13
|
+
it {expect(subject).to be_a Auth0::Api::V1::Connections}
|
14
|
+
it {expect(subject).to be_a Auth0::Api::V1::Clients}
|
15
|
+
it {expect(subject).to be_a Auth0::Api::V1::Rules}
|
16
|
+
it {expect(subject).to be_a Auth0::Api::V1::Logs}
|
17
|
+
it {expect(subject).to be_a Auth0::Api::AuthenticationEndpoints}
|
18
|
+
it {expect(subject).not_to be_a Auth0::Api::V2}
|
19
|
+
it {expect(subject).not_to be_a Auth0::Api::V2::Clients}
|
20
|
+
it {expect(subject).not_to be_a Auth0::Api::V2::Users}
|
21
|
+
it {expect(subject).not_to be_a Auth0::Api::V2::Jobs}
|
22
|
+
it {expect(subject).not_to be_a Auth0::Api::V2::Stats}
|
23
|
+
it {expect(subject).not_to be_a Auth0::Api::V2::Blacklists}
|
24
|
+
end
|
25
|
+
context "V2 modules to be included" do
|
26
|
+
let(:subject){Auth0::Client.new({protocols: "v2"})}
|
27
|
+
before :each do
|
28
|
+
expect_any_instance_of(Auth0::Api::AuthenticationEndpoints).not_to receive(:obtain_access_token)
|
29
|
+
end
|
30
|
+
it {expect(subject).to be_a HTTParty}
|
31
|
+
it {expect(subject).to be_a Auth0::Mixins}
|
32
|
+
it {expect(subject).to be_a Auth0::Mixins::Initializer}
|
33
|
+
it {expect(subject).to be_a Auth0::Api::V2}
|
34
|
+
it {expect(subject).to be_a Auth0::Api::V2::Clients}
|
35
|
+
it {expect(subject).to be_a Auth0::Api::V2::Users}
|
36
|
+
it {expect(subject).to be_a Auth0::Api::V2::Stats}
|
37
|
+
it {expect(subject).to be_a Auth0::Api::V2::Jobs}
|
38
|
+
it {expect(subject).to be_a Auth0::Api::V2::Blacklists}
|
39
|
+
it {expect(subject).not_to be_a Auth0::Api::V1}
|
40
|
+
it {expect(subject).not_to be_a Auth0::Api::V1::Users}
|
41
|
+
it {expect(subject).not_to be_a Auth0::Api::V1::Connections}
|
42
|
+
it {expect(subject).not_to be_a Auth0::Api::V1::Clients}
|
43
|
+
it {expect(subject).not_to be_a Auth0::Api::V1::Rules}
|
44
|
+
it {expect(subject).not_to be_a Auth0::Api::V1::Logs}
|
45
|
+
it {expect(subject).not_to be_a Auth0::Api::AuthenticationEndpoints}
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe Auth0::Mixins::HTTPartyProxy do
|
3
|
+
before :all do
|
4
|
+
dummy_instance = DummyClassForProxy.new
|
5
|
+
dummy_instance.extend(Auth0::Mixins::HTTPartyProxy)
|
6
|
+
@instance = dummy_instance
|
7
|
+
end
|
8
|
+
|
9
|
+
%i(get).each do |http_method|
|
10
|
+
context ".#{http_method}" do
|
11
|
+
it {expect(@instance).to respond_to(http_method.to_sym)}
|
12
|
+
it "should call send http #{http_method} method to path defined through HTTParty" do
|
13
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
14
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, true, 200))
|
15
|
+
expect{@instance.send(http_method,"/test")}.not_to raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not raise exception if data returned not in json format(should be fixed in v2)" do
|
19
|
+
allow(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new("Some random text here", true, 200))
|
20
|
+
expect{@instance.send(http_method,"/test")}.not_to raise_error
|
21
|
+
expect(@instance.send(http_method,"/test")).to eql "Some random text here"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should raise Auth0::Unauthorized on send http #{http_method} method to path defined through HTTParty when 401 status received" do
|
25
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
26
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, false, 401))
|
27
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::Unauthorized)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should raise Auth0::NotFound on send http #{http_method} method to path defined through HTTParty when 404 status received" do
|
31
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
32
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, false, 404))
|
33
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::NotFound)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should raise Auth0::Unsupported on send http #{http_method} method to path defined through HTTParty when 418 or other unknown status received" do
|
37
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
38
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, false, 418))
|
39
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::Unsupported)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should raise Auth0::BadRequest on send http #{http_method} method to path defined through HTTParty when 400 or other unknown status received" do
|
43
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
44
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, false, 400))
|
45
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::BadRequest)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should raise Auth0::AccessDenied on send http #{http_method} method to path defined through HTTParty when 403" do
|
49
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
50
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, false, 403))
|
51
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::AccessDenied)
|
52
|
+
end
|
53
|
+
it "should raise Auth0::ServerError on send http #{http_method} method to path defined through HTTParty when 500 received" do
|
54
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :query => {})
|
55
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :query => {}).and_return(StubResponse.new({}, false, 500))
|
56
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::ServerError)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should escape path with URI.escape" do
|
60
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/te%20st", :query => {})
|
61
|
+
expect(DummyClassForProxy).to receive(http_method).with("/te%20st", :query => {}).and_return(StubResponse.new({}, true, 200))
|
62
|
+
expect{@instance.send(http_method,"/te st")}.not_to raise_error
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
%i(post put patch delete).each do |http_method|
|
68
|
+
context ".#{http_method}" do
|
69
|
+
it {expect(@instance).to respond_to(http_method.to_sym)}
|
70
|
+
it "should call send http #{http_method} method to path defined through HTTParty" do
|
71
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :body => "{}")
|
72
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("{}", true, 200))
|
73
|
+
expect{@instance.send(http_method,"/test")}.not_to raise_error
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should not raise exception if data returned not in json format(should be fixed in v2)" do
|
77
|
+
allow(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("Some random text here", true, 200))
|
78
|
+
expect{@instance.send(http_method,"/test")}.not_to raise_error
|
79
|
+
expect(@instance.send(http_method,"/test")).to eql "Some random text here"
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should raise Auth0::Unauthorized on send http #{http_method} method to path defined through HTTParty when 401 status received" do
|
83
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :body => "{}")
|
84
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("{}", false, 401))
|
85
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::Unauthorized)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should raise Auth0::NotFound on send http #{http_method} method to path defined through HTTParty when 404 status received" do
|
89
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :body => "{}")
|
90
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("{}", false, 404))
|
91
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::NotFound)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should raise Auth0::Unsupported on send http #{http_method} method to path defined through HTTParty when 418 or other unknown status received" do
|
95
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :body => "{}")
|
96
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("{}", false, 418))
|
97
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::Unsupported)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should raise Auth0::BadRequest on send http #{http_method} method to path defined through HTTParty when 400 or other unknown status received" do
|
101
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :body => "{}")
|
102
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("{}", false, 400))
|
103
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::BadRequest)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should raise Auth0::ServerError on send http #{http_method} method to path defined through HTTParty when 500 received" do
|
107
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/test", :body => "{}")
|
108
|
+
expect(DummyClassForProxy).to receive(http_method).with("/test", :body => "{}").and_return(StubResponse.new("{}", false, 500))
|
109
|
+
expect{@instance.send(http_method,"/test")}.to raise_error(Auth0::ServerError)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should escape path with URI.escape" do
|
113
|
+
allow(DummyClassForProxy).to receive(http_method).with("http://login.auth0.com/te%20st", :body => "{}")
|
114
|
+
expect(DummyClassForProxy).to receive(http_method).with("/te%20st", :body => "{}").and_return(StubResponse.new("{}", true, 200))
|
115
|
+
expect{@instance.send(http_method,"/te st")}.not_to raise_error
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
$:.unshift File.expand_path('..', __FILE__)
|
2
2
|
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
3
|
require 'simplecov'
|
4
|
-
SimpleCov.start
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter "/spec/"
|
6
|
+
end
|
5
7
|
require 'rspec'
|
6
8
|
require 'rack/test'
|
7
9
|
require 'webmock/rspec'
|
8
|
-
require '
|
10
|
+
require 'byebug'
|
9
11
|
require 'auth0'
|
10
|
-
|
12
|
+
Dir[("./lib/**/*.rb")].each { |f| require f }
|
13
|
+
Dir[("./spec/support/**/*.rb")].each { |f| require f }
|
11
14
|
RSpec.configure do |config|
|
12
15
|
config.include WebMock::API
|
13
16
|
config.include Rack::Test::Methods
|
14
|
-
config.
|
15
|
-
|
16
|
-
config.formatter = 'documentation'
|
17
|
-
end
|
17
|
+
# config.fail_fast = true
|
18
|
+
end
|
metadata
CHANGED
@@ -1,119 +1,233 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Auth0
|
8
|
-
- Ezequiel Morito
|
9
8
|
- Jose Romaniello
|
9
|
+
- Petroe Ivan
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: httparty
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '0.13'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '0.13'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: rspec
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
36
|
-
|
35
|
+
version: 3.1.0
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 3.1.0
|
39
|
+
type: :development
|
37
40
|
prerelease: false
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
39
42
|
requirements:
|
40
43
|
- - ~>
|
41
44
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
45
|
+
version: 3.1.0
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 3.1.0
|
43
49
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
50
|
+
name: rack-test
|
45
51
|
requirement: !ruby/object:Gem::Requirement
|
46
52
|
requirements:
|
47
53
|
- - ~>
|
48
54
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
55
|
+
version: '0'
|
50
56
|
type: :development
|
51
57
|
prerelease: false
|
52
58
|
version_requirements: !ruby/object:Gem::Requirement
|
53
59
|
requirements:
|
54
60
|
- - ~>
|
55
61
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
62
|
+
version: '0'
|
57
63
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
64
|
+
name: simplecov
|
59
65
|
requirement: !ruby/object:Gem::Requirement
|
60
66
|
requirements:
|
61
|
-
- -
|
67
|
+
- - ~>
|
62
68
|
- !ruby/object:Gem::Version
|
63
69
|
version: '0'
|
64
70
|
type: :development
|
65
71
|
prerelease: false
|
66
72
|
version_requirements: !ruby/object:Gem::Requirement
|
67
73
|
requirements:
|
68
|
-
- -
|
74
|
+
- - ~>
|
69
75
|
- !ruby/object:Gem::Version
|
70
76
|
version: '0'
|
71
77
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
78
|
+
name: webmock
|
73
79
|
requirement: !ruby/object:Gem::Requirement
|
74
80
|
requirements:
|
75
|
-
- -
|
81
|
+
- - ~>
|
76
82
|
- !ruby/object:Gem::Version
|
77
83
|
version: '0'
|
78
84
|
type: :development
|
79
85
|
prerelease: false
|
80
86
|
version_requirements: !ruby/object:Gem::Requirement
|
81
87
|
requirements:
|
82
|
-
- -
|
88
|
+
- - ~>
|
83
89
|
- !ruby/object:Gem::Version
|
84
90
|
version: '0'
|
85
91
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
92
|
+
name: byebug
|
87
93
|
requirement: !ruby/object:Gem::Requirement
|
88
94
|
requirements:
|
89
|
-
- -
|
95
|
+
- - ~>
|
90
96
|
- !ruby/object:Gem::Version
|
91
97
|
version: '0'
|
92
98
|
type: :development
|
93
99
|
prerelease: false
|
94
100
|
version_requirements: !ruby/object:Gem::Requirement
|
95
101
|
requirements:
|
96
|
-
- -
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: faker
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ~>
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: yard
|
121
|
+
requirement: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
type: :development
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ~>
|
97
131
|
- !ruby/object:Gem::Version
|
98
132
|
version: '0'
|
99
|
-
description: Ruby client library for the Auth0
|
133
|
+
description: Ruby client library for the Auth0 API.
|
100
134
|
email:
|
101
135
|
- support@auth0.com
|
102
136
|
executables: []
|
103
137
|
extensions: []
|
104
138
|
extra_rdoc_files: []
|
105
139
|
files:
|
140
|
+
- .bundle/config
|
106
141
|
- .gitignore
|
142
|
+
- .rspec
|
107
143
|
- Gemfile
|
144
|
+
- Gemfile.lock
|
108
145
|
- README.md
|
109
146
|
- Rakefile
|
110
147
|
- auth0.gemspec
|
148
|
+
- doc/Auth0.html
|
149
|
+
- doc/Auth0/AccessDenied.html
|
150
|
+
- doc/Auth0/Api.html
|
151
|
+
- doc/Auth0/Api/AuthenticationEndpoints.html
|
152
|
+
- doc/Auth0/Api/V1.html
|
153
|
+
- doc/Auth0/Api/V1/Clients.html
|
154
|
+
- doc/Auth0/Api/V1/Connections.html
|
155
|
+
- doc/Auth0/Api/V1/Logs.html
|
156
|
+
- doc/Auth0/Api/V1/Rules.html
|
157
|
+
- doc/Auth0/Api/V1/Users.html
|
158
|
+
- doc/Auth0/Api/V2.html
|
159
|
+
- doc/Auth0/Api/V2/Blacklists.html
|
160
|
+
- doc/Auth0/Api/V2/Clients.html
|
161
|
+
- doc/Auth0/Api/V2/Jobs.html
|
162
|
+
- doc/Auth0/Api/V2/Router.html
|
163
|
+
- doc/Auth0/Api/V2/Stats.html
|
164
|
+
- doc/Auth0/Api/V2/Users.html
|
165
|
+
- doc/Auth0/BadRequest.html
|
166
|
+
- doc/Auth0/Client.html
|
167
|
+
- doc/Auth0/Exception.html
|
168
|
+
- doc/Auth0/InvalidParameter.html
|
169
|
+
- doc/Auth0/Mixins.html
|
170
|
+
- doc/Auth0/Mixins/HTTPartyProxy.html
|
171
|
+
- doc/Auth0/Mixins/Initializer.html
|
172
|
+
- doc/Auth0/NotFound.html
|
173
|
+
- doc/Auth0/ServerError.html
|
174
|
+
- doc/Auth0/Unauthorized.html
|
175
|
+
- doc/Auth0/Unsupported.html
|
176
|
+
- doc/Auth0/UserIdIsBlank.html
|
177
|
+
- doc/Auth0Client.html
|
178
|
+
- doc/_index.html
|
179
|
+
- doc/class_list.html
|
180
|
+
- doc/css/common.css
|
181
|
+
- doc/css/full_list.css
|
182
|
+
- doc/css/style.css
|
183
|
+
- doc/file.README.html
|
184
|
+
- doc/file_list.html
|
185
|
+
- doc/frames.html
|
186
|
+
- doc/index.html
|
187
|
+
- doc/js/app.js
|
188
|
+
- doc/js/full_list.js
|
189
|
+
- doc/js/jquery.js
|
190
|
+
- doc/method_list.html
|
191
|
+
- doc/top-level-namespace.html
|
111
192
|
- lib/auth0.rb
|
193
|
+
- lib/auth0/api/authentication_endpoints.rb
|
194
|
+
- lib/auth0/api/v1.rb
|
195
|
+
- lib/auth0/api/v1/clients.rb
|
196
|
+
- lib/auth0/api/v1/connections.rb
|
197
|
+
- lib/auth0/api/v1/logs.rb
|
198
|
+
- lib/auth0/api/v1/rules.rb
|
199
|
+
- lib/auth0/api/v1/users.rb
|
200
|
+
- lib/auth0/api/v2.rb
|
201
|
+
- lib/auth0/api/v2/blacklists.rb
|
202
|
+
- lib/auth0/api/v2/clients.rb
|
203
|
+
- lib/auth0/api/v2/jobs.rb
|
204
|
+
- lib/auth0/api/v2/stats.rb
|
205
|
+
- lib/auth0/api/v2/users.rb
|
112
206
|
- lib/auth0/client.rb
|
207
|
+
- lib/auth0/exception.rb
|
208
|
+
- lib/auth0/mixins.rb
|
209
|
+
- lib/auth0/mixins/httparty_proxy.rb
|
210
|
+
- lib/auth0/mixins/initializer.rb
|
113
211
|
- lib/auth0/version.rb
|
114
|
-
- lib/
|
115
|
-
- spec/
|
212
|
+
- lib/auth0_client.rb
|
213
|
+
- spec/lib/auth0/api/authentication_endpoints_spec.rb
|
214
|
+
- spec/lib/auth0/api/v1/clients_spec.rb
|
215
|
+
- spec/lib/auth0/api/v1/connections_spec.rb
|
216
|
+
- spec/lib/auth0/api/v1/logs_spec.rb
|
217
|
+
- spec/lib/auth0/api/v1/rules_spec.rb
|
218
|
+
- spec/lib/auth0/api/v1/users_spec.rb
|
219
|
+
- spec/lib/auth0/api/v2/blacklists_spec.rb
|
220
|
+
- spec/lib/auth0/api/v2/clients_spec.rb
|
221
|
+
- spec/lib/auth0/api/v2/jobs_spec.rb
|
222
|
+
- spec/lib/auth0/api/v2/stats_spec.rb
|
223
|
+
- spec/lib/auth0/api/v2/users_spec.rb
|
224
|
+
- spec/lib/auth0/client_spec.rb
|
225
|
+
- spec/lib/auth0/mixins/httparty_proxy_spec.rb
|
226
|
+
- spec/lib/auth0_client_spec.rb
|
116
227
|
- spec/spec_helper.rb
|
228
|
+
- spec/support/dummy_class.rb
|
229
|
+
- spec/support/dummy_class_for_proxy.rb
|
230
|
+
- spec/support/stub_response.rb
|
117
231
|
homepage: https://github.com/auth0/ruby-auth0
|
118
232
|
licenses:
|
119
233
|
- MIT
|
@@ -134,10 +248,27 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
248
|
version: '0'
|
135
249
|
requirements: []
|
136
250
|
rubyforge_project: auth0
|
137
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.2.2
|
138
252
|
signing_key:
|
139
253
|
specification_version: 4
|
140
|
-
summary:
|
254
|
+
summary: Auth0 API Client
|
141
255
|
test_files:
|
142
|
-
- spec/
|
256
|
+
- spec/lib/auth0/api/authentication_endpoints_spec.rb
|
257
|
+
- spec/lib/auth0/api/v1/clients_spec.rb
|
258
|
+
- spec/lib/auth0/api/v1/connections_spec.rb
|
259
|
+
- spec/lib/auth0/api/v1/logs_spec.rb
|
260
|
+
- spec/lib/auth0/api/v1/rules_spec.rb
|
261
|
+
- spec/lib/auth0/api/v1/users_spec.rb
|
262
|
+
- spec/lib/auth0/api/v2/blacklists_spec.rb
|
263
|
+
- spec/lib/auth0/api/v2/clients_spec.rb
|
264
|
+
- spec/lib/auth0/api/v2/jobs_spec.rb
|
265
|
+
- spec/lib/auth0/api/v2/stats_spec.rb
|
266
|
+
- spec/lib/auth0/api/v2/users_spec.rb
|
267
|
+
- spec/lib/auth0/client_spec.rb
|
268
|
+
- spec/lib/auth0/mixins/httparty_proxy_spec.rb
|
269
|
+
- spec/lib/auth0_client_spec.rb
|
143
270
|
- spec/spec_helper.rb
|
271
|
+
- spec/support/dummy_class.rb
|
272
|
+
- spec/support/dummy_class_for_proxy.rb
|
273
|
+
- spec/support/stub_response.rb
|
274
|
+
has_rdoc:
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require "omniauth-oauth2"
|
2
|
-
|
3
|
-
module OmniAuth
|
4
|
-
module Strategies
|
5
|
-
class Auth0 < OmniAuth::Strategies::OAuth2
|
6
|
-
PASSTHROUGHS = %w[
|
7
|
-
connection
|
8
|
-
redirect_uri
|
9
|
-
]
|
10
|
-
|
11
|
-
option :name, "auth0"
|
12
|
-
option :namespace, nil
|
13
|
-
option :provider_ignores_state, true
|
14
|
-
|
15
|
-
args [:client_id, :client_secret, :namespace, :provider_ignores_state]
|
16
|
-
|
17
|
-
def initialize(app, *args, &block)
|
18
|
-
super
|
19
|
-
|
20
|
-
warn "[DEPRECATION] The omniauth strategy in this gem is deprecated."
|
21
|
-
warn "[DEPRECATION] Please use the gem omniauth-auth0."
|
22
|
-
|
23
|
-
@options.provider_ignores_state = args[3] unless args[3].nil?
|
24
|
-
|
25
|
-
@options.client_options.site = "https://#{options[:namespace]}"
|
26
|
-
@options.client_options.authorize_url = "https://#{options[:namespace]}/authorize"
|
27
|
-
@options.client_options.token_url = "https://#{options[:namespace]}/oauth/token"
|
28
|
-
@options.client_options.userinfo_url = "https://#{options[:namespace]}/userinfo"
|
29
|
-
end
|
30
|
-
|
31
|
-
def authorize_params
|
32
|
-
super.tap do |param|
|
33
|
-
PASSTHROUGHS.each do |p|
|
34
|
-
param[p.to_sym] = request.params[p] if request.params[p]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
uid { raw_info["user_id"] }
|
40
|
-
|
41
|
-
extra do
|
42
|
-
{ :raw_info => raw_info }
|
43
|
-
end
|
44
|
-
|
45
|
-
info do
|
46
|
-
{
|
47
|
-
:name => raw_info["name"],
|
48
|
-
:email => raw_info["email"],
|
49
|
-
:nickname => raw_info["nickname"],
|
50
|
-
:first_name => raw_info["given_name"],
|
51
|
-
:last_name => raw_info["family_name"],
|
52
|
-
:location => raw_info["locale"],
|
53
|
-
:image => raw_info["picture"]
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
|
-
def raw_info
|
58
|
-
@raw_info ||= access_token.get(options.client_options.userinfo_url).parsed
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|