auth0 4.14.0 → 5.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/.gitignore +0 -1
- data/.yardoc/checksums +22 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/CHANGELOG.md +73 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +34 -39
- data/README.md +5 -7
- data/Rakefile +0 -22
- data/auth0.gemspec +1 -1
- data/examples/ruby-api/.gitignore +0 -6
- data/lib/auth0/api/authentication_endpoints.rb +6 -220
- data/lib/auth0/api/v2.rb +2 -0
- data/lib/auth0/api/v2/jobs.rb +11 -1
- data/lib/auth0/api/v2/log_streams.rb +78 -0
- data/lib/auth0/api/v2/tickets.rb +12 -1
- data/lib/auth0/api/v2/users.rb +20 -7
- data/lib/auth0/exception.rb +2 -7
- data/lib/auth0/mixins.rb +0 -1
- data/lib/auth0/mixins/access_token_struct.rb +2 -2
- data/lib/auth0/mixins/api_token_struct.rb +2 -2
- data/lib/auth0/mixins/httpproxy.rb +3 -1
- data/lib/auth0/mixins/initializer.rb +1 -7
- data/lib/auth0/mixins/permission_struct.rb +2 -2
- data/lib/auth0/mixins/validation.rb +1 -1
- data/lib/auth0/version.rb +1 -1
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +12 -0
- data/spec/integration/lib/auth0/api/v2/api_roles_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +7 -1
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +1 -1
- data/spec/lib/auth0/api/v2/jobs_spec.rb +17 -0
- data/spec/lib/auth0/api/v2/log_streams_spec.rb +84 -0
- data/spec/lib/auth0/api/v2/roles_spec.rb +4 -4
- data/spec/lib/auth0/api/v2/tickets_spec.rb +17 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +37 -10
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +2 -2
- data/spec/support/credentials.rb +0 -19
- metadata +31 -38
- data/deploy_documentation.sh +0 -29
- data/doc_config/templates/default/fulldoc/html/css/full_list.css +0 -79
- data/doc_config/templates/default/fulldoc/html/css/style.css +0 -546
- data/doc_config/templates/default/layout/html/breadcrumb.erb +0 -11
- data/doc_config/templates/default/layout/html/footer.erb +0 -115
- data/doc_config/templates/default/layout/html/headers.erb +0 -17
- data/doc_config/templates/default/layout/html/layout.erb +0 -27
- data/lib/auth0/api/v1.rb +0 -19
- data/lib/auth0/api/v1/clients.rb +0 -58
- data/lib/auth0/api/v1/connections.rb +0 -68
- data/lib/auth0/api/v1/logs.rb +0 -43
- data/lib/auth0/api/v1/rules.rb +0 -57
- data/lib/auth0/api/v1/users.rb +0 -227
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +0 -703
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82dfc2ea2a26c6a1aa75bcbfeb013ba0ae6f88f160c855863e858b56dadc40a4
|
4
|
+
data.tar.gz: 9c882d7199b9084703b573ab3621b202858fc1d4f6ffd20c588de54e4b7ac2e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8005cde8f1c028b5d87c8058c3b711cd0f8d85e4dd34db1d2b79e45581935a26401dfc5da5d0e08745ccb3b061ebd1ab767d9255043e827e55468f7603ea290c
|
7
|
+
data.tar.gz: cb6ac580e79b850b7785f1e13594e06b4055fb124906910590519b9cd6e6f6df984c218b21cf07cf2c0738212a0d444c2e07dcbf3e7c58bb5298a38fbea3c347
|
data/.gitignore
CHANGED
data/.yardoc/checksums
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
lib/auth0/api/v2/jobs.rb 53fe5a814c9da1bb89d7cb885fe7f1151d6ca44a
|
2
|
+
lib/auth0/api/v2/logs.rb f4b9b93248d85d29d58ac12b6b5ebabd72f98adb
|
3
|
+
lib/auth0/api/v2/roles.rb 99e9d0222f0d59f21cb061d13b434bf1a903660a
|
4
|
+
lib/auth0/api/v2/rules.rb 2fbbf4258ba7e6fe67d1ab197ca3503d4e5daf84
|
5
|
+
lib/auth0/api/v2/stats.rb 035b172ad69efb2b040ffcd29319f23017352b4c
|
6
|
+
lib/auth0/api/v2/users.rb 6a648030a6851db60ab13dc3a8a7d46bd51ce977
|
7
|
+
lib/auth0/api/v2/emails.rb 83aaf5ed8082cb2787a0f9c47c463d218a3aee77
|
8
|
+
lib/auth0/api/v2/anomaly.rb c0e38b3cbb4cca65fbe51e6ed69d56cfa5ea8d0e
|
9
|
+
lib/auth0/api/v2/clients.rb 23c2b6f307f6a20537720ad24de30b62de51b9f2
|
10
|
+
lib/auth0/api/v2/prompts.rb 688c71d37885b64ed8c174d54c9403fe21dc0735
|
11
|
+
lib/auth0/api/v2/tenants.rb d20a9c46b6754d504667b6d5187b525274d5ffe8
|
12
|
+
lib/auth0/api/v2/tickets.rb fd192d8b281ca54d318cac0a6b5cff3cad555076
|
13
|
+
lib/auth0/api/v2/guardian.rb 367ea7046c90fdb2065bc66eddb64e47b2d3370d
|
14
|
+
lib/auth0/api/v2/blacklists.rb c3405a13b9c6481a43136b3f4c755602e24a9511
|
15
|
+
lib/auth0/api/v2/connections.rb 3a2ac77a7f9ba97df3fd2e7b958192e06db2e0a7
|
16
|
+
lib/auth0/api/v2/log_streams.rb 1624abe964bd0e9bcfa1107a970f8fa823ec5955
|
17
|
+
lib/auth0/api/v2/user_blocks.rb ce0f80dc00eb32dc1b825c0bbafb89e94d30a28c
|
18
|
+
lib/auth0/api/v2/client_grants.rb ac7489b697d58e7514014e5ae125ffa88015306d
|
19
|
+
lib/auth0/api/v2/users_by_email.rb 95bb92421fb03ec8feee8ef0b5f2ab64c8e51403
|
20
|
+
lib/auth0/api/v2/resource_servers.rb f9c6e7c8fc0bd497e34b0a9e3ac1a81d7fbbe88b
|
21
|
+
lib/auth0/api/v2/device_credentials.rb 94b92db7091ebc7af97fe0fb10a3ad64fa36cdc8
|
22
|
+
lib/auth0/api/authentication_endpoints.rb d6e5c2fabbd79b4f17864b6ec026488d65c5090d
|
data/.yardoc/complete
ADDED
File without changes
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,78 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v5.0.0](https://github.com/auth0/ruby-auth0/tree/v5.0.0) (2020-10-22)
|
4
|
+
|
5
|
+
This release addresses some long standing issues with the library that could only be addressed in a major. We have also removed Api/v1 endpoints and other deprecated methods.
|
6
|
+
|
7
|
+
### Migration from v4 to v5
|
8
|
+
|
9
|
+
#### Top Level Structs
|
10
|
+
The following top level structs were colliding with other libraries, this was addressed in [\#183](183) and have been namespaced with `::Auth0::`
|
11
|
+
- `ApiToken` changed to `::Auth0::ApiToken`
|
12
|
+
- `Permission` changed to `::Auth0::Permission`
|
13
|
+
- `AccessToken` changed to `::AccessToken::AccessToken`
|
14
|
+
|
15
|
+
#### Api2 Users create_user method
|
16
|
+
This method was requiring you send in a `name`, which was optional, but didn't require `connection_name` which isn't optional. This was fixed in [\#244](244).
|
17
|
+
|
18
|
+
`Auth0::Api::V2::Users.create_user(name, options = {})` has changed to `Auth0::Api::V2::Users.create_user(connection_name, options = {})`
|
19
|
+
|
20
|
+
#### APIv1 End of Life
|
21
|
+
APIv1 endpoints were deprecated in 4.x and now have been removed in v5. They reached end-of-life in the Public Cloud on 13 July 2020. Migration from v1 to v2 has been documented here https://auth0.com/docs/product-lifecycle/deprecations-and-migrations/migrate-to-management-api-v2
|
22
|
+
|
23
|
+
#### Catching 429 Errors
|
24
|
+
In 4.x `RateLimitEncountered` was inheriting from `Auth0::Unsupported` in order for backwards compatibility. This class is now inheriting `Auth0::HTTPError`. If you are catching 429 errors with `Auth0::Unsupported` then you will need to migrate to catching with `Auth0::HTTPError`.
|
25
|
+
|
26
|
+
### Changes
|
27
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.17.1...v5.0.0)
|
28
|
+
|
29
|
+
**Fixed**
|
30
|
+
- Don't define structs as top-level constants (breaking changes) [\#183](https://github.com/auth0/ruby-auth0/pull/183) ([makimoto](https://github.com/makimoto))
|
31
|
+
- Fix create_user implementation (breaking changes) [\#244](https://github.com/auth0/ruby-auth0/pull/244) ([davidpatrick](https://github.com/davidpatrick))
|
32
|
+
|
33
|
+
**Removed**
|
34
|
+
- Removed Deprecations (breaking changes) [\#245](https://github.com/auth0/ruby-auth0/pull/245) ([davidpatrick](https://github.com/davidpatrick))
|
35
|
+
|
36
|
+
## [v4.17.1](https://github.com/auth0/ruby-auth0/tree/v4.17.1) (2020-10-21)
|
37
|
+
|
38
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.17.0...v4.17.1)
|
39
|
+
|
40
|
+
**Fixed**
|
41
|
+
|
42
|
+
- Addressable dependency [\#247](https://github.com/auth0/ruby-auth0/pull/247) ([davidpatrick](https://github.com/davidpatrick))
|
43
|
+
|
44
|
+
|
45
|
+
## [v4.17.0](https://github.com/auth0/ruby-auth0/tree/v4.17.0) (2020-10-19)
|
46
|
+
|
47
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.16.0...v4.17.0)
|
48
|
+
|
49
|
+
**Added**
|
50
|
+
|
51
|
+
- Add pagination to user permissions [\#241](https://github.com/auth0/ruby-auth0/pull/241) ([davidpatrick](https://github.com/davidpatrick))
|
52
|
+
|
53
|
+
**Deprecated**
|
54
|
+
|
55
|
+
- Addressable URI Escape [\#240](https://github.com/auth0/ruby-auth0/pull/240) ([davidpatrick](https://github.com/apps/davidpatrick))
|
56
|
+
|
57
|
+
|
58
|
+
## [v4.16.0](https://github.com/auth0/ruby-auth0/tree/v4.16.0) (2020-10-02)
|
59
|
+
|
60
|
+
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.15.0...v4.16.0)
|
61
|
+
|
62
|
+
**Added**
|
63
|
+
|
64
|
+
- New Email Verification Fields [\#237](https://github.com/auth0/ruby-auth0/pull/237) ([davidpatrick](https://github.com/davidpatrick))
|
65
|
+
|
66
|
+
**Security**
|
67
|
+
|
68
|
+
- Bump actionview from 6.0.3.2 to 6.0.3.3 [\#236](https://github.com/auth0/ruby-auth0/pull/236) ([dependabot[bot]](https://github.com/apps/dependabot))
|
69
|
+
|
70
|
+
## [v4.15.0](https://github.com/auth0/ruby-auth0/tree/v4.15.0) (2020-09-04)
|
71
|
+
|
72
|
+
**Added**
|
73
|
+
|
74
|
+
- Add log streaming endpoints [\#233](https://github.com/auth0/ruby-auth0/pull/233) ([davidpatrick](https://github.com/davidpatrick))
|
75
|
+
|
3
76
|
## [v4.14.0](https://github.com/auth0/ruby-auth0/tree/v4.14.0) (2020-07-20)
|
4
77
|
|
5
78
|
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.13.0...v4.14.0)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
auth0 (
|
4
|
+
auth0 (5.0.0)
|
5
|
+
addressable (~> 2.7.0)
|
5
6
|
jwt (~> 2.2.0)
|
6
7
|
rest-client (~> 2.0.0)
|
7
8
|
zache (~> 0.12.0)
|
@@ -9,20 +10,20 @@ PATH
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
actionpack (6.0.3.
|
13
|
-
actionview (= 6.0.3.
|
14
|
-
activesupport (= 6.0.3.
|
13
|
+
actionpack (6.0.3.4)
|
14
|
+
actionview (= 6.0.3.4)
|
15
|
+
activesupport (= 6.0.3.4)
|
15
16
|
rack (~> 2.0, >= 2.0.8)
|
16
17
|
rack-test (>= 0.6.3)
|
17
18
|
rails-dom-testing (~> 2.0)
|
18
19
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
19
|
-
actionview (6.0.3.
|
20
|
-
activesupport (= 6.0.3.
|
20
|
+
actionview (6.0.3.4)
|
21
|
+
activesupport (= 6.0.3.4)
|
21
22
|
builder (~> 3.1)
|
22
23
|
erubi (~> 1.4)
|
23
24
|
rails-dom-testing (~> 2.0)
|
24
25
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
25
|
-
activesupport (6.0.3.
|
26
|
+
activesupport (6.0.3.4)
|
26
27
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
28
|
i18n (>= 0.7, < 2)
|
28
29
|
minitest (~> 5.1)
|
@@ -32,21 +33,18 @@ GEM
|
|
32
33
|
public_suffix (>= 2.0.2, < 5.0)
|
33
34
|
ast (2.4.1)
|
34
35
|
builder (3.2.4)
|
35
|
-
codecov (0.2.
|
36
|
-
colorize
|
36
|
+
codecov (0.2.12)
|
37
37
|
json
|
38
38
|
simplecov
|
39
39
|
coderay (1.1.3)
|
40
|
-
|
41
|
-
concurrent-ruby (1.1.6)
|
40
|
+
concurrent-ruby (1.1.7)
|
42
41
|
coveralls (0.7.1)
|
43
42
|
multi_json (~> 1.3)
|
44
43
|
rest-client
|
45
44
|
simplecov (>= 0.7)
|
46
45
|
term-ansicolor
|
47
46
|
thor
|
48
|
-
crack (0.4.
|
49
|
-
safe_yaml (~> 1.0.0)
|
47
|
+
crack (0.4.4)
|
50
48
|
crass (1.0.6)
|
51
49
|
diff-lcs (1.4.4)
|
52
50
|
docile (1.3.2)
|
@@ -82,23 +80,23 @@ GEM
|
|
82
80
|
hashdiff (1.0.1)
|
83
81
|
http-cookie (1.0.3)
|
84
82
|
domain_name (~> 0.5)
|
85
|
-
i18n (1.8.
|
83
|
+
i18n (1.8.5)
|
86
84
|
concurrent-ruby (~> 1.0)
|
87
85
|
json (2.3.1)
|
88
|
-
jwt (2.2.
|
86
|
+
jwt (2.2.2)
|
89
87
|
listen (3.2.1)
|
90
88
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
91
89
|
rb-inotify (~> 0.9, >= 0.9.10)
|
92
|
-
loofah (2.
|
90
|
+
loofah (2.7.0)
|
93
91
|
crass (~> 1.0.2)
|
94
92
|
nokogiri (>= 1.5.9)
|
95
|
-
lumberjack (1.2.
|
93
|
+
lumberjack (1.2.8)
|
96
94
|
method_source (0.8.2)
|
97
95
|
mime-types (3.3.1)
|
98
96
|
mime-types-data (~> 3.2015)
|
99
97
|
mime-types-data (3.2020.0512)
|
100
98
|
mini_portile2 (2.4.0)
|
101
|
-
minitest (5.14.
|
99
|
+
minitest (5.14.2)
|
102
100
|
multi_json (1.15.0)
|
103
101
|
nenv (0.3.0)
|
104
102
|
netrc (0.11.0)
|
@@ -108,7 +106,7 @@ GEM
|
|
108
106
|
nenv (~> 0.1)
|
109
107
|
shellany (~> 0.0)
|
110
108
|
parallel (1.19.2)
|
111
|
-
parser (2.7.
|
109
|
+
parser (2.7.2.0)
|
112
110
|
ast (~> 2.4.1)
|
113
111
|
pry (0.10.4)
|
114
112
|
coderay (~> 1.1.0)
|
@@ -116,7 +114,7 @@ GEM
|
|
116
114
|
slop (~> 3.4)
|
117
115
|
pry-nav (0.2.4)
|
118
116
|
pry (>= 0.9.10, < 0.11.0)
|
119
|
-
public_suffix (4.0.
|
117
|
+
public_suffix (4.0.6)
|
120
118
|
rack (2.1.4)
|
121
119
|
rack-test (0.8.3)
|
122
120
|
rack (>= 1.0, < 3)
|
@@ -125,9 +123,9 @@ GEM
|
|
125
123
|
nokogiri (>= 1.6)
|
126
124
|
rails-html-sanitizer (1.3.0)
|
127
125
|
loofah (~> 2.3)
|
128
|
-
railties (6.0.3.
|
129
|
-
actionpack (= 6.0.3.
|
130
|
-
activesupport (= 6.0.3.
|
126
|
+
railties (6.0.3.4)
|
127
|
+
actionpack (= 6.0.3.4)
|
128
|
+
activesupport (= 6.0.3.4)
|
131
129
|
method_source
|
132
130
|
rake (>= 0.8.7)
|
133
131
|
thor (>= 0.20.3, < 2.0)
|
@@ -136,7 +134,7 @@ GEM
|
|
136
134
|
rb-fsevent (0.10.4)
|
137
135
|
rb-inotify (0.10.1)
|
138
136
|
ffi (~> 1.0)
|
139
|
-
regexp_parser (1.
|
137
|
+
regexp_parser (1.8.2)
|
140
138
|
rest-client (2.0.2)
|
141
139
|
http-cookie (>= 1.0.2, < 2.0)
|
142
140
|
mime-types (>= 1.16, < 4.0)
|
@@ -146,7 +144,7 @@ GEM
|
|
146
144
|
rspec-core (~> 3.9.0)
|
147
145
|
rspec-expectations (~> 3.9.0)
|
148
146
|
rspec-mocks (~> 3.9.0)
|
149
|
-
rspec-core (3.9.
|
147
|
+
rspec-core (3.9.3)
|
150
148
|
rspec-support (~> 3.9.3)
|
151
149
|
rspec-expectations (3.9.2)
|
152
150
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -155,28 +153,27 @@ GEM
|
|
155
153
|
diff-lcs (>= 1.2.0, < 2.0)
|
156
154
|
rspec-support (~> 3.9.0)
|
157
155
|
rspec-support (3.9.3)
|
158
|
-
rubocop (0.
|
156
|
+
rubocop (1.0.0)
|
159
157
|
parallel (~> 1.10)
|
160
|
-
parser (>= 2.7.1.
|
158
|
+
parser (>= 2.7.1.5)
|
161
159
|
rainbow (>= 2.2.2, < 4.0)
|
162
|
-
regexp_parser (>= 1.
|
160
|
+
regexp_parser (>= 1.8)
|
163
161
|
rexml
|
164
|
-
rubocop-ast (>= 0.
|
162
|
+
rubocop-ast (>= 0.6.0)
|
165
163
|
ruby-progressbar (~> 1.7)
|
166
164
|
unicode-display_width (>= 1.4.0, < 2.0)
|
167
|
-
rubocop-ast (0.
|
168
|
-
parser (>= 2.7.
|
169
|
-
rubocop-rails (2.
|
165
|
+
rubocop-ast (1.0.0)
|
166
|
+
parser (>= 2.7.1.5)
|
167
|
+
rubocop-rails (2.8.1)
|
170
168
|
activesupport (>= 4.2.0)
|
171
169
|
rack (>= 1.1)
|
172
170
|
rubocop (>= 0.87.0)
|
173
171
|
ruby-progressbar (1.10.1)
|
174
|
-
safe_yaml (1.0.5)
|
175
172
|
shellany (0.0.1)
|
176
|
-
simplecov (0.
|
173
|
+
simplecov (0.19.0)
|
177
174
|
docile (~> 1.1)
|
178
175
|
simplecov-html (~> 0.11)
|
179
|
-
simplecov-html (0.12.
|
176
|
+
simplecov-html (0.12.3)
|
180
177
|
slop (3.6.0)
|
181
178
|
sync (0.5.0)
|
182
179
|
term-ansicolor (1.7.1)
|
@@ -184,7 +181,7 @@ GEM
|
|
184
181
|
terminal-notifier-guard (1.7.0)
|
185
182
|
thor (1.0.1)
|
186
183
|
thread_safe (0.3.6)
|
187
|
-
tins (1.
|
184
|
+
tins (1.26.0)
|
188
185
|
sync
|
189
186
|
tzinfo (1.2.7)
|
190
187
|
thread_safe (~> 0.1)
|
@@ -193,11 +190,10 @@ GEM
|
|
193
190
|
unf_ext (0.0.7.7)
|
194
191
|
unicode-display_width (1.7.0)
|
195
192
|
vcr (6.0.0)
|
196
|
-
webmock (3.
|
193
|
+
webmock (3.9.3)
|
197
194
|
addressable (>= 2.3.6)
|
198
195
|
crack (>= 0.3.2)
|
199
196
|
hashdiff (>= 0.4.0, < 2.0.0)
|
200
|
-
yard (0.9.25)
|
201
197
|
zache (0.12.0)
|
202
198
|
zeitwerk (2.4.0)
|
203
199
|
|
@@ -225,7 +221,6 @@ DEPENDENCIES
|
|
225
221
|
terminal-notifier-guard
|
226
222
|
vcr
|
227
223
|
webmock
|
228
|
-
yard
|
229
224
|
|
230
225
|
BUNDLED WITH
|
231
226
|
1.17.3
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[](https://codecov.io/gh/auth0/ruby-auth0)
|
6
6
|
[](http://www.rubydoc.info/github/auth0/ruby-auth0/master/frames)
|
7
7
|
[](https://github.com/auth0/ruby-auth0/blob/master/LICENSE)
|
8
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fruby-auth0?ref=badge_shield)
|
8
9
|
|
9
10
|
Ruby API client for the [Auth0](https://auth0.com) platform.
|
10
11
|
|
@@ -24,13 +25,7 @@ bundle add auth0
|
|
24
25
|
|
25
26
|
## API Documentation
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
```bash
|
30
|
-
bundle exec rake documentation
|
31
|
-
```
|
32
|
-
|
33
|
-
To view the generated documentation, open `doc/Auth0/Api.html` .
|
28
|
+
https://www.rubydoc.info/gems/auth0
|
34
29
|
|
35
30
|
## Management API v2
|
36
31
|
|
@@ -234,3 +229,6 @@ If you find a bug or have a feature request, please report them in this reposito
|
|
234
229
|
## License
|
235
230
|
|
236
231
|
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
232
|
+
|
233
|
+
|
234
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fruby-auth0?ref=badge_large)
|
data/Rakefile
CHANGED
@@ -9,28 +9,6 @@ begin
|
|
9
9
|
desc 'Run Rubocop'
|
10
10
|
RuboCop::RakeTask.new(:rubocop)
|
11
11
|
|
12
|
-
require 'yard'
|
13
|
-
DOC_FILES = ['lib/auth0/api/v2/*.rb', 'lib/auth0/api/authentication_endpoints.rb'].freeze
|
14
|
-
|
15
|
-
desc 'Build Documentation'
|
16
|
-
YARD::Rake::YardocTask.new(:documentation) do |t|
|
17
|
-
t.files = DOC_FILES
|
18
|
-
t.options = ['-p', 'doc_config/templates']
|
19
|
-
end
|
20
|
-
|
21
|
-
desc 'Publish SDK documentation'
|
22
|
-
task :publish do
|
23
|
-
sh 'rake documentation'
|
24
|
-
sh 'cp -R doc /tmp/ruby-auth0-doc'
|
25
|
-
sh 'git checkout gh-pages'
|
26
|
-
sh 'cp -R /tmp/ruby-auth0-doc/* .'
|
27
|
-
sh 'rm -rf /tmp/ruby-auth0-doc'
|
28
|
-
sh 'git add .'
|
29
|
-
sh 'git commit -am "Rebuild documentation"'
|
30
|
-
sh 'git push origin gh-pages'
|
31
|
-
sh 'git checkout master'
|
32
|
-
end
|
33
|
-
|
34
12
|
desc 'Run Integration Tests'
|
35
13
|
RSpec::Core::RakeTask.new(:integration) do |t|
|
36
14
|
t.pattern = FileList["spec/integration/**/*#{ENV['PATTERN']}*_spec.rb"]
|
data/auth0.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency 'rest-client', '~> 2.0.0'
|
20
20
|
s.add_runtime_dependency 'jwt', '~> 2.2.0'
|
21
21
|
s.add_runtime_dependency 'zache', '~> 0.12.0'
|
22
|
+
s.add_runtime_dependency 'addressable', '~> 2.7.0'
|
22
23
|
|
23
24
|
s.add_development_dependency 'rake', '~> 13.0'
|
24
25
|
s.add_development_dependency 'fuubar', '~> 2.0'
|
@@ -31,7 +32,6 @@ Gem::Specification.new do |s|
|
|
31
32
|
s.add_development_dependency 'rack', '~> 2.1.2'
|
32
33
|
s.add_development_dependency 'simplecov', '~> 0.9'
|
33
34
|
s.add_development_dependency 'faker', '~> 1.4'
|
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
|
@@ -27,7 +27,7 @@ module Auth0
|
|
27
27
|
audience: audience
|
28
28
|
}
|
29
29
|
response = post('/oauth/token', request_params)
|
30
|
-
ApiToken.new(response['access_token'], response['scope'], response['expires_in'])
|
30
|
+
::Auth0::ApiToken.new(response['access_token'], response['scope'], response['expires_in'])
|
31
31
|
end
|
32
32
|
|
33
33
|
# Get access and ID tokens using an Authorization Code.
|
@@ -37,7 +37,7 @@ module Auth0
|
|
37
37
|
# Required only if it was set at the GET /authorize endpoint
|
38
38
|
# @param client_id [string] Client ID for the Application
|
39
39
|
# @param client_secret [string] Client Secret for the Application.
|
40
|
-
# @return [AccessToken] Returns the access_token and id_token
|
40
|
+
# @return [Auth0::AccessToken] Returns the access_token and id_token
|
41
41
|
def exchange_auth_code_for_tokens(
|
42
42
|
code,
|
43
43
|
redirect_uri: nil,
|
@@ -53,7 +53,7 @@ module Auth0
|
|
53
53
|
code: code,
|
54
54
|
redirect_uri: redirect_uri
|
55
55
|
}
|
56
|
-
AccessToken.from_response post('/oauth/token', request_params)
|
56
|
+
::Auth0::AccessToken.from_response post('/oauth/token', request_params)
|
57
57
|
end
|
58
58
|
|
59
59
|
# Get access and ID tokens using a refresh token.
|
@@ -64,7 +64,7 @@ module Auth0
|
|
64
64
|
# @param client_secret [string] Client Secret for the Application.
|
65
65
|
# Required when the Application's Token Endpoint Authentication Method
|
66
66
|
# is Post or Basic.
|
67
|
-
# @return [AccessToken] Returns tokens allowed in the refresh_token
|
67
|
+
# @return [Auth0::AccessToken] Returns tokens allowed in the refresh_token
|
68
68
|
def exchange_refresh_token(
|
69
69
|
refresh_token,
|
70
70
|
client_id: @client_id,
|
@@ -78,7 +78,7 @@ module Auth0
|
|
78
78
|
client_secret: client_secret,
|
79
79
|
refresh_token: refresh_token
|
80
80
|
}
|
81
|
-
AccessToken.from_response post('/oauth/token', request_params)
|
81
|
+
::Auth0::AccessToken.from_response post('/oauth/token', request_params)
|
82
82
|
end
|
83
83
|
|
84
84
|
# rubocop:disable Metrics/ParameterLists
|
@@ -118,7 +118,7 @@ module Auth0
|
|
118
118
|
audience: audience,
|
119
119
|
grant_type: realm ? 'http://auth0.com/oauth/grant-type/password-realm' : 'password'
|
120
120
|
}
|
121
|
-
AccessToken.from_response post('/oauth/token', request_params)
|
121
|
+
::Auth0::AccessToken.from_response post('/oauth/token', request_params)
|
122
122
|
end
|
123
123
|
# rubocop:enable Metrics/ParameterLists
|
124
124
|
|
@@ -292,220 +292,6 @@ module Auth0
|
|
292
292
|
)
|
293
293
|
end
|
294
294
|
|
295
|
-
#
|
296
|
-
# DEPRECATED
|
297
|
-
#
|
298
|
-
|
299
|
-
# Retrieve an access token.
|
300
|
-
# @deprecated 4.6.0 - Use the api_token method instead.
|
301
|
-
# @see https://auth0.com/docs/api/authentication#client-credentials
|
302
|
-
# @param access_token [string] Social provider's access_token
|
303
|
-
# @param connection [string] Currently, this endpoint only works for Facebook, Google, Twitter and Weibo
|
304
|
-
# @return [json] Returns the access token
|
305
|
-
def obtain_access_token(access_token = nil, connection = 'facebook', scope = 'openid')
|
306
|
-
if access_token
|
307
|
-
request_params = { client_id: @client_id, access_token: access_token, connection: connection, scope: scope }
|
308
|
-
post('/oauth/access_token', request_params)['access_token']
|
309
|
-
else
|
310
|
-
request_params = { client_id: @client_id, client_secret: @client_secret, grant_type: 'client_credentials' }
|
311
|
-
post('/oauth/token', request_params)['access_token']
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
# Get access and ID tokens using an Authorization Code.
|
316
|
-
# @deprecated 4.6.0 - Use the exchange_auth_code_for_tokens method instead.
|
317
|
-
# @see https://auth0.com/docs/api/authentication#authorization-code
|
318
|
-
# @param code [string] The access code obtained through passive authentication
|
319
|
-
# @param redirect_uri [string] Url to redirect after authorization
|
320
|
-
# @param connection [string] Currently, this endpoint only works for Facebook, Google, Twitter and Weibo
|
321
|
-
# @param scope [string] Defaults to openid. Can be 'openid name email', 'openid offline_access'
|
322
|
-
# @return [json] Returns the access_token and id_token
|
323
|
-
def obtain_user_tokens(code, redirect_uri, connection = 'facebook', scope = 'openid')
|
324
|
-
raise Auth0::InvalidParameter, 'Must supply a valid code' if code.to_s.empty?
|
325
|
-
raise Auth0::InvalidParameter, 'Must supply a valid redirect_uri' if redirect_uri.to_s.empty?
|
326
|
-
|
327
|
-
request_params = {
|
328
|
-
client_id: @client_id,
|
329
|
-
client_secret: @client_secret,
|
330
|
-
connection: connection,
|
331
|
-
grant_type: 'authorization_code',
|
332
|
-
code: code,
|
333
|
-
scope: scope,
|
334
|
-
redirect_uri: redirect_uri
|
335
|
-
}
|
336
|
-
post('/oauth/token', request_params)
|
337
|
-
end
|
338
|
-
|
339
|
-
# Get access and ID tokens using Resource Owner Password.
|
340
|
-
# @deprecated 4.6.0 - Use the login_with_resource_owner method instead.
|
341
|
-
# @see https://auth0.com/docs/api/authentication#resource-owner-password
|
342
|
-
# @param username [string] Username or email
|
343
|
-
# @param password [string] Password
|
344
|
-
# @param id_token [string] Token's id
|
345
|
-
# @param connection_name [string] Connection name; use a database or
|
346
|
-
# passwordless connection, Active Directory/LDAP, Windows Azure or ADF
|
347
|
-
# @param options [hash] Additional options - :scope, :grant_type, :device
|
348
|
-
# @return [json] Returns the access_token and id_token
|
349
|
-
def login(username, password, id_token = nil, connection_name = UP_AUTH, options = {})
|
350
|
-
raise Auth0::InvalidParameter, 'Must supply a valid username' if username.to_s.empty?
|
351
|
-
raise Auth0::InvalidParameter, 'Must supply a valid password' if password.to_s.empty?
|
352
|
-
|
353
|
-
request_params = {
|
354
|
-
client_id: @client_id,
|
355
|
-
client_secret: @client_secret,
|
356
|
-
username: username,
|
357
|
-
password: password,
|
358
|
-
scope: options.fetch(:scope, 'openid'),
|
359
|
-
connection: connection_name,
|
360
|
-
grant_type: options.fetch(:grant_type, 'password'),
|
361
|
-
id_token: id_token,
|
362
|
-
device: options.fetch(:device, nil)
|
363
|
-
}
|
364
|
-
post('/oauth/token', request_params)
|
365
|
-
end
|
366
|
-
|
367
|
-
# Return the user information based on the Auth0 access token.
|
368
|
-
# @deprecated 4.6.0 - Use the userinfo method instead.
|
369
|
-
# @see https://auth0.com/docs/api/authentication#get-user-info
|
370
|
-
# @return [json] User information based on the Auth0 access token
|
371
|
-
def user_info
|
372
|
-
get('/userinfo')
|
373
|
-
end
|
374
|
-
|
375
|
-
# Login using phone number + verification code.
|
376
|
-
# @deprecated 4.5.0 - Legacy authentication pipeline; use a Password Grant
|
377
|
-
# instead - https://auth0.com/docs/api-auth/tutorials/password-grant
|
378
|
-
# @see https://auth0.com/docs/api/authentication#resource-owner
|
379
|
-
# @param phone_number [string] User's phone number.
|
380
|
-
# @param code [string] Verification code.
|
381
|
-
# @return [json] Returns the access token and id token
|
382
|
-
def phone_login(phone_number, code, scope = 'openid')
|
383
|
-
raise Auth0::InvalidParameter, 'Must supply a valid phone number' if phone_number.to_s.empty?
|
384
|
-
raise Auth0::InvalidParameter, 'Must supply a valid code' if code.to_s.empty?
|
385
|
-
|
386
|
-
request_params = {
|
387
|
-
client_id: @client_id,
|
388
|
-
username: phone_number,
|
389
|
-
password: code,
|
390
|
-
scope: scope,
|
391
|
-
connection: 'sms',
|
392
|
-
grant_type: 'password'
|
393
|
-
}
|
394
|
-
post('/oauth/ro', request_params)
|
395
|
-
end
|
396
|
-
|
397
|
-
# Validate a JSON Web Token (signature and expiration).
|
398
|
-
# @deprecated 4.5.0 - Legacy endpoint, use /userinfo instead.
|
399
|
-
# @see https://auth0.com/docs/api/authentication#get-token-info
|
400
|
-
# @param id_token [string] ID Token to use
|
401
|
-
# @return User information associated with the user id (sub property) of the token.
|
402
|
-
def token_info(id_token)
|
403
|
-
raise Auth0::InvalidParameter, 'Must supply a valid id_token' if id_token.to_s.empty?
|
404
|
-
|
405
|
-
request_params = { id_token: id_token }
|
406
|
-
post('/tokeninfo', request_params)
|
407
|
-
end
|
408
|
-
|
409
|
-
# Refresh a delegation token.
|
410
|
-
# @deprecated 4.5.0 - Feature is disabled, no replacement currently; see
|
411
|
-
# https://auth0.com/docs/api-auth/tutorials/adoption/delegation
|
412
|
-
# @see https://auth0.com/docs/api/authentication#delegation
|
413
|
-
# @param refresh_token [string] Token to refresh
|
414
|
-
# @param target [string] Target to sign the new token.
|
415
|
-
# @param scope [string] Defaults to openid. Can be 'openid name email'.
|
416
|
-
# @param api_type [string] Defaults to app. Can be aws, azure_sb, azure_blob, firebase, layer, salesforce_api,
|
417
|
-
# salesforce_sandbox_api, sap_api or wams
|
418
|
-
# @param extra_parameters [hash] Extra parameters.
|
419
|
-
# @return [json] Returns the refreshed delegation token
|
420
|
-
def refresh_delegation(refresh_token, target, scope = 'openid', api_type = 'app', extra_parameters = {})
|
421
|
-
raise Auth0::InvalidParameter, 'Must supply a valid token to refresh' if refresh_token.to_s.empty?
|
422
|
-
|
423
|
-
request_params = {
|
424
|
-
client_id: @client_id,
|
425
|
-
grant_type: JWT_BEARER,
|
426
|
-
refresh_token: refresh_token,
|
427
|
-
target: target,
|
428
|
-
api_type: api_type,
|
429
|
-
scope: scope
|
430
|
-
}.merge(extra_parameters)
|
431
|
-
post('/delegation', request_params)
|
432
|
-
end
|
433
|
-
|
434
|
-
# Retrieve a delegation token.
|
435
|
-
# @deprecated 4.5.0 - Feature is disabled, no replacement currently; see
|
436
|
-
# https://auth0.com/docs/api-auth/tutorials/adoption/delegation
|
437
|
-
# @see https://auth0.com/docs/api/authentication#delegation
|
438
|
-
# @param id_token [string] Token's id.
|
439
|
-
# @param target [string] Target to sign the new token.
|
440
|
-
# @param scope [string] Defaults to openid. Can be 'openid name email'.
|
441
|
-
# @param api_type [string] Defaults to app. Can be aws, azure_sb, azure_blob, firebase, layer, salesforce_api,
|
442
|
-
# salesforce_sandbox_api, sap_api or wams
|
443
|
-
# @param extra_parameters [hash] Extra parameters.
|
444
|
-
# @return [json] Returns the refreshed delegation token
|
445
|
-
def delegation(id_token, target, scope = 'openid', api_type = 'app', extra_parameters = {})
|
446
|
-
raise Auth0::InvalidParameter, 'Must supply a valid id_token' if id_token.to_s.empty?
|
447
|
-
|
448
|
-
request_params = {
|
449
|
-
client_id: @client_id,
|
450
|
-
grant_type: JWT_BEARER,
|
451
|
-
id_token: id_token,
|
452
|
-
target: target,
|
453
|
-
api_type: api_type,
|
454
|
-
scope: scope
|
455
|
-
}.merge(extra_parameters)
|
456
|
-
post('/delegation', request_params)
|
457
|
-
end
|
458
|
-
|
459
|
-
# Retrieve an impersonation URL to login as another user.
|
460
|
-
# @deprecated 4.5.0 - Feature is disabled.
|
461
|
-
# @see https://auth0.com/docs/api/authentication#impersonation
|
462
|
-
# @param user_id [string] Impersonate user id
|
463
|
-
# @param app_client_id [string] Application client id
|
464
|
-
# @param impersonator_id [string] Impersonator user id id.
|
465
|
-
# @param options [string] Additional Parameters
|
466
|
-
# @return [string] Impersonation URL
|
467
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
468
|
-
def impersonate(user_id, app_client_id, impersonator_id, options)
|
469
|
-
raise Auth0::InvalidParameter, 'Must supply a valid user_id' if user_id.to_s.empty?
|
470
|
-
raise Auth0::InvalidParameter, 'Must supply a valid app_client_id' if app_client_id.to_s.empty?
|
471
|
-
raise Auth0::InvalidParameter, 'Must supply a valid impersonator_id' if impersonator_id.to_s.empty?
|
472
|
-
raise Auth0::MissingParameter, 'Must supply client_secret' if @client_secret.nil?
|
473
|
-
|
474
|
-
authorization_header obtain_access_token
|
475
|
-
request_params = {
|
476
|
-
protocol: options.fetch(:protocol, 'oauth2'),
|
477
|
-
impersonator_id: impersonator_id,
|
478
|
-
client_id: app_client_id,
|
479
|
-
additionalParameters: {
|
480
|
-
response_type: options.fetch(:response_type, 'code'),
|
481
|
-
state: options.fetch(:state, ''),
|
482
|
-
scope: options.fetch(:scope, 'openid'),
|
483
|
-
callback_url: options.fetch(:callback_url, '')
|
484
|
-
}
|
485
|
-
}
|
486
|
-
result = post("/users/#{user_id}/impersonate", request_params)
|
487
|
-
authorization_header @token
|
488
|
-
result
|
489
|
-
end
|
490
|
-
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
491
|
-
|
492
|
-
# Unlink a user's account from the identity provider.
|
493
|
-
# @deprecated 4.5.0 - Endpoint is disabled in favor of the Management API;
|
494
|
-
# see https://auth0.com/docs/migrations/guides/account-linking
|
495
|
-
# @see https://auth0.com/docs/api/authentication#unlink
|
496
|
-
# @param access_token [string] Logged-in user access token
|
497
|
-
# @param user_id [string] User Id
|
498
|
-
def unlink_user(access_token, user_id)
|
499
|
-
raise Auth0::InvalidParameter, 'Must supply a valid access_token' if access_token.to_s.empty?
|
500
|
-
raise Auth0::InvalidParameter, 'Must supply a valid user_id' if user_id.to_s.empty?
|
501
|
-
|
502
|
-
request_params = {
|
503
|
-
access_token: access_token,
|
504
|
-
user_id: user_id
|
505
|
-
}
|
506
|
-
post('/unlink', request_params)
|
507
|
-
end
|
508
|
-
|
509
295
|
# Validate an ID token (signature and expiration).
|
510
296
|
# @see https://auth0.com/docs/tokens/guides/validate-id-tokens
|
511
297
|
# @param id_token [string] The JWT to validate.
|