auth0 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -1
- data/.rubocop_todo.yml +0 -2
- data/.travis.yml +4 -2
- data/CHANGELOG.md +40 -38
- data/DEPLOYMENT.md +5 -0
- data/Gemfile +1 -1
- data/README.md +20 -2
- data/Rakefile +1 -1
- data/auth0.gemspec +4 -3
- data/doc_config/templates/default/layout/html/footer.erb +1 -1
- data/examples/ruby-api/.gitignore +86 -0
- data/examples/ruby-api/Gemfile +8 -0
- data/examples/ruby-api/README.md +24 -0
- data/examples/ruby-api/config.ru +2 -0
- data/examples/ruby-api/main.rb +33 -0
- data/examples/ruby-on-rails-api/.gitignore +18 -0
- data/examples/ruby-on-rails-api/Gemfile +48 -0
- data/examples/ruby-on-rails-api/README.md +27 -0
- data/examples/ruby-on-rails-api/Rakefile +6 -0
- data/examples/ruby-on-rails-api/app/assets/images/.keep +0 -0
- data/examples/ruby-on-rails-api/app/assets/javascripts/application.js +16 -0
- data/examples/ruby-on-rails-api/app/assets/stylesheets/application.css +15 -0
- data/examples/ruby-on-rails-api/app/controllers/application_controller.rb +8 -0
- data/examples/ruby-on-rails-api/app/controllers/concerns/.keep +0 -0
- data/examples/ruby-on-rails-api/app/controllers/ping_controller.rb +6 -0
- data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +11 -0
- data/examples/ruby-on-rails-api/app/helpers/application_helper.rb +3 -0
- data/examples/ruby-on-rails-api/app/mailers/.keep +0 -0
- data/examples/ruby-on-rails-api/app/models/.keep +0 -0
- data/examples/ruby-on-rails-api/app/models/concerns/.keep +0 -0
- data/examples/ruby-on-rails-api/app/views/layouts/application.html.erb +14 -0
- data/examples/ruby-on-rails-api/bin/bundle +3 -0
- data/examples/ruby-on-rails-api/bin/rails +4 -0
- data/examples/ruby-on-rails-api/bin/rake +4 -0
- data/examples/ruby-on-rails-api/bin/setup +29 -0
- data/examples/ruby-on-rails-api/config.ru +4 -0
- data/examples/ruby-on-rails-api/config/application.rb +23 -0
- data/examples/ruby-on-rails-api/config/boot.rb +4 -0
- data/examples/ruby-on-rails-api/config/database.yml +27 -0
- data/examples/ruby-on-rails-api/config/environment.rb +5 -0
- data/examples/ruby-on-rails-api/config/environments/development.rb +37 -0
- data/examples/ruby-on-rails-api/config/environments/production.rb +83 -0
- data/examples/ruby-on-rails-api/config/environments/test.rb +41 -0
- data/examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb +3 -0
- data/examples/ruby-on-rails-api/config/initializers/dotenv.rb +4 -0
- data/examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/ruby-on-rails-api/config/initializers/inflections.rb +16 -0
- data/examples/ruby-on-rails-api/config/initializers/knock.rb +53 -0
- data/examples/ruby-on-rails-api/config/initializers/mime_types.rb +4 -0
- data/examples/ruby-on-rails-api/config/initializers/session_store.rb +3 -0
- data/examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb +14 -0
- data/examples/ruby-on-rails-api/config/locales/en.yml +23 -0
- data/examples/ruby-on-rails-api/config/routes.rb +58 -0
- data/examples/ruby-on-rails-api/config/secrets.yml +28 -0
- data/examples/ruby-on-rails-api/db/schema.rb +15 -0
- data/examples/ruby-on-rails-api/db/seeds.rb +7 -0
- data/examples/ruby-on-rails-api/lib/assets/.keep +0 -0
- data/examples/ruby-on-rails-api/lib/tasks/.keep +0 -0
- data/examples/ruby-on-rails-api/log/.keep +0 -0
- data/examples/ruby-on-rails-api/public/404.html +67 -0
- data/examples/ruby-on-rails-api/public/422.html +67 -0
- data/examples/ruby-on-rails-api/public/500.html +66 -0
- data/examples/ruby-on-rails-api/public/favicon.ico +0 -0
- data/examples/ruby-on-rails-api/public/robots.txt +5 -0
- data/examples/ruby-on-rails-api/test/controllers/.keep +0 -0
- data/examples/ruby-on-rails-api/test/fixtures/.keep +0 -0
- data/examples/ruby-on-rails-api/test/helpers/.keep +0 -0
- data/examples/ruby-on-rails-api/test/integration/.keep +0 -0
- data/examples/ruby-on-rails-api/test/mailers/.keep +0 -0
- data/examples/ruby-on-rails-api/test/models/.keep +0 -0
- data/examples/ruby-on-rails-api/test/ping_controller_test.rb +8 -0
- data/examples/ruby-on-rails-api/test/secured_ping_controller_test.rb +26 -0
- data/examples/ruby-on-rails-api/test/test_helper.rb +16 -0
- data/lib/auth0/api/authentication_endpoints.rb +59 -30
- data/lib/auth0/api/v1/clients.rb +1 -1
- data/lib/auth0/api/v1/connections.rb +4 -3
- data/lib/auth0/api/v1/logs.rb +1 -1
- data/lib/auth0/api/v1/rules.rb +1 -1
- data/lib/auth0/api/v1/users.rb +5 -5
- data/lib/auth0/api/v2.rb +10 -0
- data/lib/auth0/api/v2/blacklists.rb +1 -1
- data/lib/auth0/api/v2/client_grants.rb +57 -0
- data/lib/auth0/api/v2/clients.rb +14 -14
- data/lib/auth0/api/v2/connections.rb +19 -20
- data/lib/auth0/api/v2/device_credentials.rb +76 -0
- data/lib/auth0/api/v2/emails.rb +5 -7
- data/lib/auth0/api/v2/jobs.rb +15 -12
- data/lib/auth0/api/v2/logs.rb +65 -0
- data/lib/auth0/api/v2/resource_servers.rb +61 -0
- data/lib/auth0/api/v2/rules.rb +21 -20
- data/lib/auth0/api/v2/stats.rb +2 -2
- data/lib/auth0/api/v2/tenants.rb +6 -4
- data/lib/auth0/api/v2/tickets.rb +13 -14
- data/lib/auth0/api/v2/user_blocks.rb +62 -0
- data/lib/auth0/api/v2/users.rb +63 -32
- data/lib/auth0/client.rb +0 -2
- data/lib/auth0/mixins.rb +4 -3
- data/lib/auth0/mixins/httpproxy.rb +55 -0
- data/lib/auth0/mixins/initializer.rb +27 -10
- data/lib/auth0/version.rb +1 -1
- data/spec/integration/lib/auth0/api/api_authentication_spec.rb +118 -0
- data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +1 -1
- data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +53 -0
- data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +5 -2
- data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +8 -5
- data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +67 -0
- data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +15 -8
- data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +11 -9
- data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +69 -0
- data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +47 -0
- data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +2 -1
- data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +2 -2
- data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +73 -0
- data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +32 -5
- data/spec/integration/lib/auth0/auth0_client_spec.rb +14 -11
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +116 -56
- data/spec/lib/auth0/api/v1/connections_spec.rb +2 -4
- data/spec/lib/auth0/api/v1/rules_spec.rb +2 -1
- data/spec/lib/auth0/api/v1/users_spec.rb +17 -9
- data/spec/lib/auth0/api/v2/client_grants_spec.rb +44 -0
- data/spec/lib/auth0/api/v2/connections_spec.rb +2 -1
- data/spec/lib/auth0/api/v2/device_credentials_spec.rb +73 -0
- data/spec/lib/auth0/api/v2/jobs_spec.rb +3 -2
- data/spec/lib/auth0/api/v2/logs_spec.rb +48 -0
- data/spec/lib/auth0/api/v2/resource_servers_spec.rb +63 -0
- data/spec/lib/auth0/api/v2/rules_spec.rb +8 -4
- data/spec/lib/auth0/api/v2/tenants_spec.rb +2 -1
- data/spec/lib/auth0/api/v2/tickets_spec.rb +4 -7
- data/spec/lib/auth0/api/v2/user_blocks_spec.rb +52 -0
- data/spec/lib/auth0/api/v2/users_spec.rb +39 -6
- data/spec/lib/auth0/client_spec.rb +8 -5
- data/spec/lib/auth0/mixins/httpproxy_spec.rb +225 -0
- data/spec/lib/auth0/mixins/initializer_spec.rb +1 -1
- data/spec/spec_helper_full.rb +12 -3
- data/spec/spec_helper_unit.rb +2 -2
- data/spec/support/credentials.rb +6 -4
- data/spec/support/dummy_class.rb +2 -1
- data/spec/support/dummy_class_for_proxy.rb +2 -2
- data/spec/support/dummy_class_for_restclient.rb +2 -0
- metadata +117 -9
- data/lib/auth0/mixins/httparty_proxy.rb +0 -38
- data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +0 -148
data/spec/spec_helper_unit.rb
CHANGED
@@ -4,8 +4,8 @@ require 'rspec'
|
|
4
4
|
require 'rack/test'
|
5
5
|
require 'faker'
|
6
6
|
require 'auth0'
|
7
|
-
Dir[
|
8
|
-
Dir[
|
7
|
+
Dir['./lib/**/*.rb'].each { |f| require f }
|
8
|
+
Dir['./spec/support/**/*.rb'].each { |f| require f }
|
9
9
|
RSpec.configure do |config|
|
10
10
|
config.include Rack::Test::Methods
|
11
11
|
config.fail_fast = true
|
data/spec/support/credentials.rb
CHANGED
@@ -2,18 +2,20 @@ module Credentials
|
|
2
2
|
def v1_creds
|
3
3
|
{ client_id: ENV['CLIENT_ID'],
|
4
4
|
client_secret: ENV['CLIENT_SECRET'],
|
5
|
-
domain: ENV['DOMAIN']
|
5
|
+
domain: ENV['DOMAIN'],
|
6
|
+
api_version: 1 }
|
6
7
|
end
|
7
8
|
|
8
9
|
def v1_global_creds
|
9
10
|
{ client_id: ENV['GLOBAL_CLIENT_ID'],
|
10
11
|
client_secret: ENV['GLOBAL_CLIENT_SECRET'],
|
11
|
-
domain: ENV['DOMAIN']
|
12
|
+
domain: ENV['DOMAIN'],
|
13
|
+
api_version: 1 }
|
12
14
|
end
|
13
15
|
|
14
16
|
def v2_creds
|
15
|
-
{
|
16
|
-
|
17
|
+
{ client_id: ENV['CLIENT_ID'],
|
18
|
+
token: ENV['MASTER_JWT'],
|
17
19
|
domain: ENV['DOMAIN'] }
|
18
20
|
end
|
19
21
|
end
|
data/spec/support/dummy_class.rb
CHANGED
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: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Auth0
|
@@ -11,22 +11,22 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: rest-client
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 1.8.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.8.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,6 +145,20 @@ dependencies:
|
|
145
145
|
- - ~>
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0.6'
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: rack
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ~>
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 1.6.4
|
155
|
+
type: :development
|
156
|
+
prerelease: false
|
157
|
+
version_requirements: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ~>
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: 1.6.4
|
148
162
|
- !ruby/object:Gem::Dependency
|
149
163
|
name: simplecov
|
150
164
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +215,7 @@ dependencies:
|
|
201
215
|
- - ~>
|
202
216
|
- !ruby/object:Gem::Version
|
203
217
|
version: '0.7'
|
204
|
-
description: Ruby
|
218
|
+
description: Ruby toolkit for Auth0 API https://auth0.com.
|
205
219
|
email:
|
206
220
|
- support@auth0.com
|
207
221
|
executables: []
|
@@ -216,6 +230,7 @@ files:
|
|
216
230
|
- .rubocop_todo.yml
|
217
231
|
- .travis.yml
|
218
232
|
- CHANGELOG.md
|
233
|
+
- DEPLOYMENT.md
|
219
234
|
- Gemfile
|
220
235
|
- Guardfile
|
221
236
|
- LICENSE
|
@@ -230,6 +245,70 @@ files:
|
|
230
245
|
- doc_config/templates/default/layout/html/footer.erb
|
231
246
|
- doc_config/templates/default/layout/html/headers.erb
|
232
247
|
- doc_config/templates/default/layout/html/layout.erb
|
248
|
+
- examples/ruby-api/.gitignore
|
249
|
+
- examples/ruby-api/Gemfile
|
250
|
+
- examples/ruby-api/README.md
|
251
|
+
- examples/ruby-api/config.ru
|
252
|
+
- examples/ruby-api/main.rb
|
253
|
+
- examples/ruby-on-rails-api/.gitignore
|
254
|
+
- examples/ruby-on-rails-api/Gemfile
|
255
|
+
- examples/ruby-on-rails-api/README.md
|
256
|
+
- examples/ruby-on-rails-api/Rakefile
|
257
|
+
- examples/ruby-on-rails-api/app/assets/images/.keep
|
258
|
+
- examples/ruby-on-rails-api/app/assets/javascripts/application.js
|
259
|
+
- examples/ruby-on-rails-api/app/assets/stylesheets/application.css
|
260
|
+
- examples/ruby-on-rails-api/app/controllers/application_controller.rb
|
261
|
+
- examples/ruby-on-rails-api/app/controllers/concerns/.keep
|
262
|
+
- examples/ruby-on-rails-api/app/controllers/ping_controller.rb
|
263
|
+
- examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb
|
264
|
+
- examples/ruby-on-rails-api/app/helpers/application_helper.rb
|
265
|
+
- examples/ruby-on-rails-api/app/mailers/.keep
|
266
|
+
- examples/ruby-on-rails-api/app/models/.keep
|
267
|
+
- examples/ruby-on-rails-api/app/models/concerns/.keep
|
268
|
+
- examples/ruby-on-rails-api/app/views/layouts/application.html.erb
|
269
|
+
- examples/ruby-on-rails-api/bin/bundle
|
270
|
+
- examples/ruby-on-rails-api/bin/rails
|
271
|
+
- examples/ruby-on-rails-api/bin/rake
|
272
|
+
- examples/ruby-on-rails-api/bin/setup
|
273
|
+
- examples/ruby-on-rails-api/config.ru
|
274
|
+
- examples/ruby-on-rails-api/config/application.rb
|
275
|
+
- examples/ruby-on-rails-api/config/boot.rb
|
276
|
+
- examples/ruby-on-rails-api/config/database.yml
|
277
|
+
- examples/ruby-on-rails-api/config/environment.rb
|
278
|
+
- examples/ruby-on-rails-api/config/environments/development.rb
|
279
|
+
- examples/ruby-on-rails-api/config/environments/production.rb
|
280
|
+
- examples/ruby-on-rails-api/config/environments/test.rb
|
281
|
+
- examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb
|
282
|
+
- examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb
|
283
|
+
- examples/ruby-on-rails-api/config/initializers/dotenv.rb
|
284
|
+
- examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb
|
285
|
+
- examples/ruby-on-rails-api/config/initializers/inflections.rb
|
286
|
+
- examples/ruby-on-rails-api/config/initializers/knock.rb
|
287
|
+
- examples/ruby-on-rails-api/config/initializers/mime_types.rb
|
288
|
+
- examples/ruby-on-rails-api/config/initializers/session_store.rb
|
289
|
+
- examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb
|
290
|
+
- examples/ruby-on-rails-api/config/locales/en.yml
|
291
|
+
- examples/ruby-on-rails-api/config/routes.rb
|
292
|
+
- examples/ruby-on-rails-api/config/secrets.yml
|
293
|
+
- examples/ruby-on-rails-api/db/schema.rb
|
294
|
+
- examples/ruby-on-rails-api/db/seeds.rb
|
295
|
+
- examples/ruby-on-rails-api/lib/assets/.keep
|
296
|
+
- examples/ruby-on-rails-api/lib/tasks/.keep
|
297
|
+
- examples/ruby-on-rails-api/log/.keep
|
298
|
+
- examples/ruby-on-rails-api/public/404.html
|
299
|
+
- examples/ruby-on-rails-api/public/422.html
|
300
|
+
- examples/ruby-on-rails-api/public/500.html
|
301
|
+
- examples/ruby-on-rails-api/public/favicon.ico
|
302
|
+
- examples/ruby-on-rails-api/public/robots.txt
|
303
|
+
- examples/ruby-on-rails-api/test/controllers/.keep
|
304
|
+
- examples/ruby-on-rails-api/test/fixtures/.keep
|
305
|
+
- examples/ruby-on-rails-api/test/helpers/.keep
|
306
|
+
- examples/ruby-on-rails-api/test/integration/.keep
|
307
|
+
- examples/ruby-on-rails-api/test/mailers/.keep
|
308
|
+
- examples/ruby-on-rails-api/test/models/.keep
|
309
|
+
- examples/ruby-on-rails-api/test/ping_controller_test.rb
|
310
|
+
- examples/ruby-on-rails-api/test/secured_ping_controller_test.rb
|
311
|
+
- examples/ruby-on-rails-api/test/test_helper.rb
|
233
312
|
- lib/auth0.rb
|
234
313
|
- lib/auth0/api/authentication_endpoints.rb
|
235
314
|
- lib/auth0/api/v1.rb
|
@@ -240,33 +319,44 @@ files:
|
|
240
319
|
- lib/auth0/api/v1/users.rb
|
241
320
|
- lib/auth0/api/v2.rb
|
242
321
|
- lib/auth0/api/v2/blacklists.rb
|
322
|
+
- lib/auth0/api/v2/client_grants.rb
|
243
323
|
- lib/auth0/api/v2/clients.rb
|
244
324
|
- lib/auth0/api/v2/connections.rb
|
325
|
+
- lib/auth0/api/v2/device_credentials.rb
|
245
326
|
- lib/auth0/api/v2/emails.rb
|
246
327
|
- lib/auth0/api/v2/jobs.rb
|
328
|
+
- lib/auth0/api/v2/logs.rb
|
329
|
+
- lib/auth0/api/v2/resource_servers.rb
|
247
330
|
- lib/auth0/api/v2/rules.rb
|
248
331
|
- lib/auth0/api/v2/stats.rb
|
249
332
|
- lib/auth0/api/v2/tenants.rb
|
250
333
|
- lib/auth0/api/v2/tickets.rb
|
334
|
+
- lib/auth0/api/v2/user_blocks.rb
|
251
335
|
- lib/auth0/api/v2/users.rb
|
252
336
|
- lib/auth0/client.rb
|
253
337
|
- lib/auth0/exception.rb
|
254
338
|
- lib/auth0/mixins.rb
|
255
|
-
- lib/auth0/mixins/
|
339
|
+
- lib/auth0/mixins/httpproxy.rb
|
256
340
|
- lib/auth0/mixins/initializer.rb
|
257
341
|
- lib/auth0/version.rb
|
258
342
|
- lib/auth0_client.rb
|
343
|
+
- spec/integration/lib/auth0/api/api_authentication_spec.rb
|
259
344
|
- spec/integration/lib/auth0/api/v1/api_clients_spec.rb
|
260
345
|
- spec/integration/lib/auth0/api/v1/api_users_spec.rb
|
261
346
|
- spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb
|
347
|
+
- spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb
|
262
348
|
- spec/integration/lib/auth0/api/v2/api_clients_spec.rb
|
263
349
|
- spec/integration/lib/auth0/api/v2/api_connections_spec.rb
|
350
|
+
- spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb
|
264
351
|
- spec/integration/lib/auth0/api/v2/api_email_spec.rb
|
265
352
|
- spec/integration/lib/auth0/api/v2/api_jobs_spec.rb
|
353
|
+
- spec/integration/lib/auth0/api/v2/api_logs_spec.rb
|
354
|
+
- spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb
|
266
355
|
- spec/integration/lib/auth0/api/v2/api_rules_spec.rb
|
267
356
|
- spec/integration/lib/auth0/api/v2/api_stats_spec.rb
|
268
357
|
- spec/integration/lib/auth0/api/v2/api_tenants_spec.rb
|
269
358
|
- spec/integration/lib/auth0/api/v2/api_tickets_spec.rb
|
359
|
+
- spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb
|
270
360
|
- spec/integration/lib/auth0/api/v2/api_users_spec.rb
|
271
361
|
- spec/integration/lib/auth0/auth0_client_spec.rb
|
272
362
|
- spec/lib/auth0/api/authentication_endpoints_spec.rb
|
@@ -276,17 +366,22 @@ files:
|
|
276
366
|
- spec/lib/auth0/api/v1/rules_spec.rb
|
277
367
|
- spec/lib/auth0/api/v1/users_spec.rb
|
278
368
|
- spec/lib/auth0/api/v2/blacklists_spec.rb
|
369
|
+
- spec/lib/auth0/api/v2/client_grants_spec.rb
|
279
370
|
- spec/lib/auth0/api/v2/clients_spec.rb
|
280
371
|
- spec/lib/auth0/api/v2/connections_spec.rb
|
372
|
+
- spec/lib/auth0/api/v2/device_credentials_spec.rb
|
281
373
|
- spec/lib/auth0/api/v2/emails_spec.rb
|
282
374
|
- spec/lib/auth0/api/v2/jobs_spec.rb
|
375
|
+
- spec/lib/auth0/api/v2/logs_spec.rb
|
376
|
+
- spec/lib/auth0/api/v2/resource_servers_spec.rb
|
283
377
|
- spec/lib/auth0/api/v2/rules_spec.rb
|
284
378
|
- spec/lib/auth0/api/v2/stats_spec.rb
|
285
379
|
- spec/lib/auth0/api/v2/tenants_spec.rb
|
286
380
|
- spec/lib/auth0/api/v2/tickets_spec.rb
|
381
|
+
- spec/lib/auth0/api/v2/user_blocks_spec.rb
|
287
382
|
- spec/lib/auth0/api/v2/users_spec.rb
|
288
383
|
- spec/lib/auth0/client_spec.rb
|
289
|
-
- spec/lib/auth0/mixins/
|
384
|
+
- spec/lib/auth0/mixins/httpproxy_spec.rb
|
290
385
|
- spec/lib/auth0/mixins/initializer_spec.rb
|
291
386
|
- spec/spec_helper.rb
|
292
387
|
- spec/spec_helper_full.rb
|
@@ -294,6 +389,7 @@ files:
|
|
294
389
|
- spec/support/credentials.rb
|
295
390
|
- spec/support/dummy_class.rb
|
296
391
|
- spec/support/dummy_class_for_proxy.rb
|
392
|
+
- spec/support/dummy_class_for_restclient.rb
|
297
393
|
- spec/support/import_users.json
|
298
394
|
- spec/support/stub_response.rb
|
299
395
|
homepage: https://github.com/auth0/ruby-auth0
|
@@ -321,17 +417,23 @@ signing_key:
|
|
321
417
|
specification_version: 4
|
322
418
|
summary: Auth0 API Client
|
323
419
|
test_files:
|
420
|
+
- spec/integration/lib/auth0/api/api_authentication_spec.rb
|
324
421
|
- spec/integration/lib/auth0/api/v1/api_clients_spec.rb
|
325
422
|
- spec/integration/lib/auth0/api/v1/api_users_spec.rb
|
326
423
|
- spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb
|
424
|
+
- spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb
|
327
425
|
- spec/integration/lib/auth0/api/v2/api_clients_spec.rb
|
328
426
|
- spec/integration/lib/auth0/api/v2/api_connections_spec.rb
|
427
|
+
- spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb
|
329
428
|
- spec/integration/lib/auth0/api/v2/api_email_spec.rb
|
330
429
|
- spec/integration/lib/auth0/api/v2/api_jobs_spec.rb
|
430
|
+
- spec/integration/lib/auth0/api/v2/api_logs_spec.rb
|
431
|
+
- spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb
|
331
432
|
- spec/integration/lib/auth0/api/v2/api_rules_spec.rb
|
332
433
|
- spec/integration/lib/auth0/api/v2/api_stats_spec.rb
|
333
434
|
- spec/integration/lib/auth0/api/v2/api_tenants_spec.rb
|
334
435
|
- spec/integration/lib/auth0/api/v2/api_tickets_spec.rb
|
436
|
+
- spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb
|
335
437
|
- spec/integration/lib/auth0/api/v2/api_users_spec.rb
|
336
438
|
- spec/integration/lib/auth0/auth0_client_spec.rb
|
337
439
|
- spec/lib/auth0/api/authentication_endpoints_spec.rb
|
@@ -341,17 +443,22 @@ test_files:
|
|
341
443
|
- spec/lib/auth0/api/v1/rules_spec.rb
|
342
444
|
- spec/lib/auth0/api/v1/users_spec.rb
|
343
445
|
- spec/lib/auth0/api/v2/blacklists_spec.rb
|
446
|
+
- spec/lib/auth0/api/v2/client_grants_spec.rb
|
344
447
|
- spec/lib/auth0/api/v2/clients_spec.rb
|
345
448
|
- spec/lib/auth0/api/v2/connections_spec.rb
|
449
|
+
- spec/lib/auth0/api/v2/device_credentials_spec.rb
|
346
450
|
- spec/lib/auth0/api/v2/emails_spec.rb
|
347
451
|
- spec/lib/auth0/api/v2/jobs_spec.rb
|
452
|
+
- spec/lib/auth0/api/v2/logs_spec.rb
|
453
|
+
- spec/lib/auth0/api/v2/resource_servers_spec.rb
|
348
454
|
- spec/lib/auth0/api/v2/rules_spec.rb
|
349
455
|
- spec/lib/auth0/api/v2/stats_spec.rb
|
350
456
|
- spec/lib/auth0/api/v2/tenants_spec.rb
|
351
457
|
- spec/lib/auth0/api/v2/tickets_spec.rb
|
458
|
+
- spec/lib/auth0/api/v2/user_blocks_spec.rb
|
352
459
|
- spec/lib/auth0/api/v2/users_spec.rb
|
353
460
|
- spec/lib/auth0/client_spec.rb
|
354
|
-
- spec/lib/auth0/mixins/
|
461
|
+
- spec/lib/auth0/mixins/httpproxy_spec.rb
|
355
462
|
- spec/lib/auth0/mixins/initializer_spec.rb
|
356
463
|
- spec/spec_helper.rb
|
357
464
|
- spec/spec_helper_full.rb
|
@@ -359,6 +466,7 @@ test_files:
|
|
359
466
|
- spec/support/credentials.rb
|
360
467
|
- spec/support/dummy_class.rb
|
361
468
|
- spec/support/dummy_class_for_proxy.rb
|
469
|
+
- spec/support/dummy_class_for_restclient.rb
|
362
470
|
- spec/support/import_users.json
|
363
471
|
- spec/support/stub_response.rb
|
364
472
|
has_rdoc:
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Auth0
|
2
|
-
module Mixins
|
3
|
-
# here's the proxy for HTTParty, we're building all request on that gem
|
4
|
-
# for now, if you want to feel free to use your own http client
|
5
|
-
module HTTPartyProxy
|
6
|
-
# proxying requests from instance methods to HTTParty class methods
|
7
|
-
%i(get post post_file put patch delete).each do |method|
|
8
|
-
define_method(method) do |path, body = {}|
|
9
|
-
safe_path = URI.escape(path)
|
10
|
-
body = body.delete_if { |_, v| v.nil? }
|
11
|
-
if method == :get
|
12
|
-
result = self.class.send(method, safe_path, query: body)
|
13
|
-
elsif method == :post_file
|
14
|
-
result = self.class.send(:post, safe_path, body: body, detect_mime_type: true)
|
15
|
-
else
|
16
|
-
result = self.class.send(method, safe_path, body: body.to_json)
|
17
|
-
end
|
18
|
-
response_body =
|
19
|
-
begin
|
20
|
-
JSON.parse(result.body.to_s)
|
21
|
-
rescue JSON::ParserError
|
22
|
-
result.body
|
23
|
-
end
|
24
|
-
case result.code
|
25
|
-
when 200...226 then response_body
|
26
|
-
when 400 then fail Auth0::BadRequest, response_body
|
27
|
-
when 401 then fail Auth0::Unauthorized, response_body
|
28
|
-
when 403 then fail Auth0::AccessDenied, response_body
|
29
|
-
when 404 then fail Auth0::NotFound, response_body
|
30
|
-
when 500 then fail Auth0::ServerError, response_body
|
31
|
-
else
|
32
|
-
fail Auth0::Unsupported, response_body
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,148 +0,0 @@
|
|
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: {})
|
15
|
-
.and_return(StubResponse.new({}, true, 200))
|
16
|
-
expect { @instance.send(http_method, '/test') }.not_to raise_error
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should not raise exception if data returned not in json format (should be fixed in v2)' do
|
20
|
-
allow(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
21
|
-
.and_return(StubResponse.new('Some random text here', true, 200))
|
22
|
-
expect { @instance.send(http_method, '/test') }.not_to raise_error
|
23
|
-
expect(@instance.send(http_method, '/test')).to eql('Some random text here')
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should raise Auth0::Unauthorized on send http #{http_method}
|
27
|
-
method to path defined through HTTParty when 401 status received" do
|
28
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', query: {})
|
29
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
30
|
-
.and_return(StubResponse.new({}, false, 401))
|
31
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::Unauthorized)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should raise Auth0::NotFound on send http #{http_method} method
|
35
|
-
to path defined through HTTParty when 404 status received" do
|
36
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', query: {})
|
37
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
38
|
-
.and_return(StubResponse.new({}, false, 404))
|
39
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::NotFound)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should raise Auth0::Unsupported on send http #{http_method} method
|
43
|
-
to path defined through HTTParty when 418 or other unknown status received" do
|
44
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', query: {})
|
45
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
46
|
-
.and_return(StubResponse.new({}, false, 418))
|
47
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::Unsupported)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should raise Auth0::BadRequest on send http #{http_method} method
|
51
|
-
to path defined through HTTParty when 400 or other unknown status received" do
|
52
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', query: {})
|
53
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
54
|
-
.and_return(StubResponse.new({}, false, 400))
|
55
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(
|
56
|
-
Auth0::BadRequest)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should raise Auth0::AccessDenied on send http #{http_method} method
|
60
|
-
to path defined through HTTParty when 403" do
|
61
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', query: {})
|
62
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
63
|
-
.and_return(StubResponse.new({}, false, 403))
|
64
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::AccessDenied)
|
65
|
-
end
|
66
|
-
it "should raise Auth0::ServerError on send http #{http_method} method
|
67
|
-
to path defined through HTTParty when 500 received" do
|
68
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', query: {})
|
69
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', query: {})
|
70
|
-
.and_return(StubResponse.new({}, false, 500))
|
71
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::ServerError)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should escape path with URI.escape' do
|
75
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/te%20st', query: {})
|
76
|
-
expect(DummyClassForProxy).to receive(http_method).with('/te%20st', query: {})
|
77
|
-
.and_return(StubResponse.new({}, true, 200))
|
78
|
-
expect { @instance.send(http_method, '/te st') }.not_to raise_error
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
%i(post put patch delete).each do |http_method|
|
84
|
-
context ".#{http_method}" do
|
85
|
-
it { expect(@instance).to respond_to(http_method.to_sym) }
|
86
|
-
it "should call send http #{http_method} method to path defined through HTTParty" do
|
87
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', body: '{}')
|
88
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
89
|
-
.and_return(StubResponse.new('{}', true, 200))
|
90
|
-
expect { @instance.send(http_method, '/test') }.not_to raise_error
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'should not raise exception if data returned not in json format (should be fixed in v2)' do
|
94
|
-
allow(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
95
|
-
.and_return(StubResponse.new('Some random text here', true, 200))
|
96
|
-
expect { @instance.send(http_method, '/test') }.not_to raise_error
|
97
|
-
expect(@instance.send(http_method, '/test')).to eql('Some random text here')
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should raise Auth0::Unauthorized on send http #{http_method} method
|
101
|
-
to path defined through HTTParty when 401 status received" do
|
102
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', body: '{}')
|
103
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
104
|
-
.and_return(StubResponse.new('{}', false, 401))
|
105
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::Unauthorized)
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should raise Auth0::NotFound on send http #{http_method} method
|
109
|
-
to path defined through HTTParty when 404 status received" do
|
110
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', body: '{}')
|
111
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
112
|
-
.and_return(StubResponse.new('{}', false, 404))
|
113
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::NotFound)
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should raise Auth0::Unsupported on send http #{http_method} method
|
117
|
-
to path defined through HTTParty when 418 or other unknown status received" do
|
118
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', body: '{}')
|
119
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
120
|
-
.and_return(StubResponse.new('{}', false, 418))
|
121
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::Unsupported)
|
122
|
-
end
|
123
|
-
|
124
|
-
it "should raise Auth0::BadRequest on send http #{http_method} method
|
125
|
-
to path defined through HTTParty when 400 or other unknown status received" do
|
126
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', body: '{}')
|
127
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
128
|
-
.and_return(StubResponse.new('{}', false, 400))
|
129
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::BadRequest)
|
130
|
-
end
|
131
|
-
|
132
|
-
it "should raise Auth0::ServerError on send http #{http_method} method
|
133
|
-
to path defined through HTTParty when 500 received" do
|
134
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/test', body: '{}')
|
135
|
-
expect(DummyClassForProxy).to receive(http_method).with('/test', body: '{}')
|
136
|
-
.and_return(StubResponse.new('{}', false, 500))
|
137
|
-
expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::ServerError)
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'should escape path with URI.escape' do
|
141
|
-
allow(DummyClassForProxy).to receive(http_method).with('http://login.auth0.com/te%20st', body: '{}')
|
142
|
-
expect(DummyClassForProxy).to receive(http_method).with('/te%20st', body: '{}')
|
143
|
-
.and_return(StubResponse.new('{}', true, 200))
|
144
|
-
expect { @instance.send(http_method, '/te st') }.not_to raise_error
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|