auth0 5.1.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/README.md +1 -0
  4. data/auth0.gemspec +6 -6
  5. data/lib/auth0/api/v2/connections.rb +5 -2
  6. data/lib/auth0/api/v2/device_credentials.rb +3 -3
  7. data/lib/auth0/api/v2/logs.rb +2 -2
  8. data/lib/auth0/api/v2/organizations.rb +23 -4
  9. data/lib/auth0/api/v2/roles.rb +7 -3
  10. data/lib/auth0/exception.rb +1 -1
  11. data/lib/auth0/mixins/httpproxy.rb +4 -1
  12. data/lib/auth0/version.rb +1 -1
  13. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_exclude_the_fields_indicated.yml +38 -26
  14. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/_filters/should_include_the_fields_indicated.yml +38 -24
  15. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connection/should_find_the_correct_connection.yml +38 -26
  16. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_include_previously-created_connection_when_filtered.yml +41 -21
  17. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_exclude_the_fields_indicated_from_filtered_results.yml +41 -21
  18. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/_filters/should_should_include_the_fields_indicated_from_filtered_results.yml +41 -21
  19. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_include_the_previously_created_connection.yml +41 -21
  20. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_connections/should_not_be_empty.yml +41 -21
  21. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection/should_delete_the_connection.yml +45 -24
  22. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_delete_connection_user/should_delete_the_user_created.yml +75 -39
  23. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/_update_connection/should_update_the_connection.yml +39 -28
  24. data/spec/fixtures/vcr_cassettes/Auth0_Api_V2_Connections/create_test_connection.yml +37 -25
  25. data/spec/lib/auth0/api/v2/connections_spec.rb +1 -1
  26. data/spec/lib/auth0/api/v2/device_credentials_spec.rb +2 -2
  27. data/spec/lib/auth0/api/v2/organizations_spec.rb +38 -8
  28. data/spec/lib/auth0/api/v2/roles_spec.rb +5 -1
  29. data/spec/lib/auth0/mixins/httpproxy_spec.rb +8 -8
  30. metadata +15 -15
@@ -12,54 +12,66 @@ http_interactions:
12
12
  Accept-Encoding:
13
13
  - gzip, deflate
14
14
  User-Agent:
15
- - Ruby/2.3.1
15
+ - rest-client/2.0.2 (darwin20.2.0 x86_64) ruby/2.7.2p137
16
16
  Content-Type:
17
17
  - application/json
18
18
  Auth0-Client:
19
- - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI0LjUuMCJ9
19
+ - eyJuYW1lIjoicnVieS1hdXRoMCIsInZlcnNpb24iOiI1LjEuMiIsImVudiI6eyJydWJ5IjoiMi43LjIifX0=
20
20
  Authorization:
21
21
  - Bearer API_TOKEN
22
22
  Content-Length:
23
23
  - '53'
24
- Host:
25
- - auth0-sdk-tests.auth0.com
26
24
  response:
27
25
  status:
28
26
  code: 201
29
27
  message: Created
30
28
  headers:
31
29
  Date:
32
- - Fri, 05 Oct 2018 20:16:25 GMT
30
+ - Tue, 20 Jul 2021 02:06:03 GMT
33
31
  Content-Type:
34
32
  - application/json; charset=utf-8
35
33
  Transfer-Encoding:
36
34
  - chunked
37
35
  Connection:
38
36
  - keep-alive
39
- X-Ratelimit-Limit:
40
- - '10'
41
- X-Ratelimit-Remaining:
42
- - '9'
43
- X-Ratelimit-Reset:
44
- - '1538770587'
45
- Vary:
46
- - origin,accept-encoding
37
+ Cf-Ray:
38
+ - 6718a0c42c0a323a-LAX
47
39
  Cache-Control:
48
- - private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ - no-cache
49
41
  Content-Encoding:
50
42
  - gzip
51
43
  Strict-Transport-Security:
52
- - max-age=15724800
53
- X-Robots-Tag:
54
- - noindex, nofollow, nosnippet, noarchive
44
+ - max-age=31536000
45
+ Vary:
46
+ - origin,accept-encoding
47
+ Cf-Cache-Status:
48
+ - DYNAMIC
49
+ Expect-Ct:
50
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
51
+ Ot-Baggage-Auth0-Request-Id:
52
+ - 6718a0c42c0a323a
53
+ Ot-Tracer-Sampled:
54
+ - 'true'
55
+ Ot-Tracer-Spanid:
56
+ - 672b1d28532dec55
57
+ Ot-Tracer-Traceid:
58
+ - 1552b04c1ec626a6
59
+ X-Content-Type-Options:
60
+ - nosniff
61
+ X-Ratelimit-Limit:
62
+ - '50'
63
+ X-Ratelimit-Remaining:
64
+ - '49'
65
+ X-Ratelimit-Reset:
66
+ - '1626746764'
67
+ Server:
68
+ - cloudflare
69
+ Alt-Svc:
70
+ - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443";
71
+ ma=86400
55
72
  body:
56
73
  encoding: ASCII-8BIT
57
74
  string: !binary |-
58
- H4sIAAAAAAAAA3WPQUvEQAyF/0vOFRYRlB4V9iQii+hhWYbpNK0DM0lJMl3K
59
- 0v/u1EU9eUp4L3zv5QKxhxYCk3v+uJ8fH3Z7fc+H/d3wAg3wZJFJob1AHvw2
60
- fLA4I7QmBRsQtCLkkIRTcopmkUa9umsDk1c9s/SvnGJYaszI3FdsJ8XQDSwB
61
- 3SRsGLaYH6iaeMNxcTOKfuu3659aKb7Y565iyOfaBN5Q7YmJrpQbKd1iVaoH
62
- UV3P2Udy4deHdvBJawyS7xL2LqSIZLX08bQ95FPe9n+pp/ULPGRgtDMBAAA=
63
- http_version:
64
- recorded_at: Fri, 05 Oct 2018 20:16:25 GMT
65
- recorded_with: VCR 4.0.0
75
+ H4sIAAAAAAAAA3WPQUvEQAyF/0vOFUpPMke9LSgelAVlGaYzaR2YJiVJd7cs+9+duurNU0Je8r2XC+QEDiKTp/unXdudu3dtdw9v+2dogGfLTAruAtMQthKi5SOCM1mwAUFbhDyScCle0SzTqDf12sAcVE8s6YVLjmu1GZlTxapJMBxXf0TRagCua6CXxdAPLBH9LGwY7Vv6Yf3eVEpY7LOtGApTTQKvqPbIRLeDO1n61eqoLmT1iaeQycc/HdwQitbsSKEvmHwsGclq6I/D9lAo09b/Sz1cvwBFiD9BMwEAAA==
76
+ recorded_at: Tue, 20 Jul 2021 02:06:02 GMT
77
+ recorded_with: VCR 6.0.0
@@ -113,7 +113,7 @@ describe Auth0::Api::V2::Connections do
113
113
  context '.delete_connection_user' do
114
114
  it { expect(@instance).to respond_to(:delete_connection_user) }
115
115
  it 'is expected to call delete to /api/v2/connections/connectionId/users' do
116
- expect(@instance).to receive(:delete).with('/api/v2/connections/connectionId/users?email=email@test.com')
116
+ expect(@instance).to receive(:delete).with('/api/v2/connections/connectionId/users', email: 'email@test.com')
117
117
  @instance.delete_connection_user('connectionId', 'email@test.com')
118
118
  end
119
119
 
@@ -22,9 +22,9 @@ describe Auth0::Api::V2::DeviceCredentials do
22
22
  )
23
23
  expect { @instance.device_credentials(client_id) }.not_to raise_error
24
24
  end
25
- it 'is expect to raise an error when type is not one of \'public_key\', \'refresh_token\'' do
25
+ it 'is expect to raise an error when type is not one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\'' do
26
26
  expect { @instance.device_credentials(client_id, type: 'invalid_type') }.to raise_error(
27
- 'Type must be one of \'public_key\', \'refresh_token\''
27
+ 'Type must be one of \'public_key\', \'refresh_token\', \'rotating_refresh_token\''
28
28
  )
29
29
  end
30
30
  end
@@ -20,6 +20,8 @@ describe Auth0::Api::V2::Organizations do
20
20
  '/api/v2/organizations',
21
21
  per_page: nil,
22
22
  page: nil,
23
+ from: nil,
24
+ take: nil,
23
25
  include_totals: nil
24
26
  )
25
27
  expect { @instance.organizations }.not_to raise_error
@@ -30,12 +32,16 @@ describe Auth0::Api::V2::Organizations do
30
32
  '/api/v2/organizations',
31
33
  per_page: 10,
32
34
  page: 1,
35
+ from: 'org_id',
36
+ take: 50,
33
37
  include_totals: true
34
38
  )
35
39
  expect do
36
40
  @instance.organizations(
37
41
  per_page: 10,
38
42
  page: 1,
43
+ from: 'org_id',
44
+ take: 50,
39
45
  include_totals: true
40
46
  )
41
47
  end.not_to raise_error
@@ -247,14 +253,19 @@ describe Auth0::Api::V2::Organizations do
247
253
  expect(@instance).to receive(:post).with(
248
254
  '/api/v2/organizations/org_id/enabled_connections',
249
255
  {
256
+ connection_id: 'connection_id',
250
257
  assign_membership_on_login: true
251
258
  }
252
259
  )
253
- @instance.create_organizations_enabled_connection('org_id', assign_membership_on_login: true)
260
+ @instance.create_organizations_enabled_connection('org_id', 'connection_id', assign_membership_on_login: true)
254
261
  end
255
262
 
256
263
  it 'is expected to raise an exception when the organization id is empty' do
257
- expect { @instance.create_organizations_enabled_connection(nil) }.to raise_exception(Auth0::MissingOrganizationId)
264
+ expect { @instance.create_organizations_enabled_connection(nil, nil) }.to raise_exception(Auth0::MissingOrganizationId)
265
+ end
266
+
267
+ it 'is expected to raise an exception when the connection id is empty' do
268
+ expect { @instance.create_organizations_enabled_connection('123', nil) }.to raise_error 'Must supply a valid connection id'
258
269
  end
259
270
  end
260
271
 
@@ -433,19 +444,38 @@ describe Auth0::Api::V2::Organizations do
433
444
  expect { @instance.get_organizations_members(nil) }.to raise_exception(Auth0::MissingOrganizationId)
434
445
  end
435
446
 
436
- it 'is expected to get invitations for an org' do
447
+ it 'is expected to get members for an org' do
437
448
  expect(@instance).to receive(:get).with(
438
- '/api/v2/organizations/org_id/members'
449
+ '/api/v2/organizations/org_id/members',
450
+ per_page: nil,
451
+ page: nil,
452
+ from: nil,
453
+ take: nil,
454
+ include_totals: nil
439
455
  )
440
- expect { @instance.get_organizations_members('org_id') }.not_to raise_error
456
+ expect do
457
+ @instance.get_organizations_members('org_id')
458
+ end.not_to raise_error
441
459
  end
442
460
 
443
- it 'is expected to get members for an org' do
461
+ it 'is expected to get /api/v2/organizations with custom parameters' do
444
462
  expect(@instance).to receive(:get).with(
445
- '/api/v2/organizations/org_id/members'
463
+ '/api/v2/organizations/org_id/members',
464
+ per_page: 10,
465
+ page: 1,
466
+ from: 'org_id',
467
+ take: 50,
468
+ include_totals: true
446
469
  )
447
470
  expect do
448
- @instance.get_organizations_members('org_id')
471
+ @instance.get_organizations_members(
472
+ 'org_id',
473
+ per_page: 10,
474
+ page: 1,
475
+ from: 'org_id',
476
+ take: 50,
477
+ include_totals: true
478
+ )
449
479
  end.not_to raise_error
450
480
  end
451
481
  end
@@ -152,6 +152,8 @@ describe Auth0::Api::V2::Roles do
152
152
  '/api/v2/roles/ROLE_ID/users',
153
153
  per_page: nil,
154
154
  page: nil,
155
+ from: nil,
156
+ take: nil,
155
157
  include_totals: nil
156
158
  )
157
159
  expect { @instance.get_role_users('ROLE_ID') }.not_to raise_error
@@ -162,10 +164,12 @@ describe Auth0::Api::V2::Roles do
162
164
  '/api/v2/roles/ROLE_ID/users',
163
165
  per_page: 30,
164
166
  page: 4,
167
+ from: 'org_id',
168
+ take: 50,
165
169
  include_totals: true
166
170
  )
167
171
  expect do
168
- @instance.get_role_users('ROLE_ID', per_page: 30, page: 4, include_totals: true)
172
+ @instance.get_role_users('ROLE_ID', per_page: 30, page: 4, from: 'org_id', take: 50, include_totals: true)
169
173
  end.not_to raise_error
170
174
  end
171
175
  end
@@ -104,9 +104,9 @@ describe Auth0::Mixins::HTTPProxy do
104
104
  it "should raise Auth0::RateLimitEncountered on send http #{http_method} method
105
105
  to path defined through HTTP when 429 recieved" do
106
106
  headers = {
107
- 'X-RateLimit-Limit' => 10,
108
- 'X-RateLimit-Remaining' => 0,
109
- 'X-RateLimit-Reset' => 1560564149
107
+ :x_ratelimit_limit => 10,
108
+ :x_ratelimit_remaining => 0,
109
+ :x_ratelimit_reset => 1560564149
110
110
  }
111
111
  @exception.response = StubResponse.new({}, false, 429, headers)
112
112
  allow(RestClient::Request).to receive(:execute).with(method: http_method,
@@ -127,7 +127,7 @@ describe Auth0::Mixins::HTTPProxy do
127
127
  reset: Time.at(1560564149)
128
128
  )
129
129
  }
130
- end
130
+ end
131
131
 
132
132
  it "should raise Auth0::ServerError on send http #{http_method} method
133
133
  to path defined through HTTP when 500 received" do
@@ -188,13 +188,13 @@ describe Auth0::Mixins::HTTPProxy do
188
188
  .and_raise(@exception)
189
189
  expect { @instance.send(http_method, '/test') }.to raise_error(Auth0::Unauthorized)
190
190
  end
191
-
191
+
192
192
  it "should raise Auth0::RateLimitEncountered on send http #{http_method} method
193
193
  to path defined through HTTP when 429 status received" do
194
194
  headers = {
195
- 'X-RateLimit-Limit' => 10,
196
- 'X-RateLimit-Remaining' => 0,
197
- 'X-RateLimit-Reset' => 1560564149
195
+ :x_ratelimit_limit => 10,
196
+ :x_ratelimit_remaining => 0,
197
+ :x_ratelimit_reset => 1560564149
198
198
  }
199
199
  @exception.response = StubResponse.new({}, false, 429,headers)
200
200
  allow(RestClient::Request).to receive(:execute).with(method: http_method,
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: 5.1.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Auth0
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-04-09 00:00:00.000000000 Z
14
+ date: 2021-07-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -19,56 +19,56 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: 2.0.0
22
+ version: 2.0.2
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: 2.0.0
29
+ version: 2.0.2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: jwt
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: 2.2.0
36
+ version: '2.2'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: 2.2.0
43
+ version: '2.2'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: zache
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - "~>"
49
49
  - !ruby/object:Gem::Version
50
- version: 0.12.0
50
+ version: '0.12'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: 0.12.0
57
+ version: '0.12'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: addressable
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: 2.7.0
64
+ version: '2.8'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: 2.7.0
71
+ version: '2.8'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: bundler
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -159,14 +159,14 @@ dependencies:
159
159
  requirements:
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: 0.2.4
162
+ version: '0.2'
163
163
  type: :development
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - "~>"
168
168
  - !ruby/object:Gem::Version
169
- version: 0.2.4
169
+ version: '0.2'
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: rspec
172
172
  requirement: !ruby/object:Gem::Requirement
@@ -201,14 +201,14 @@ dependencies:
201
201
  requirements:
202
202
  - - "~>"
203
203
  - !ruby/object:Gem::Version
204
- version: 2.1.2
204
+ version: '2.1'
205
205
  type: :development
206
206
  prerelease: false
207
207
  version_requirements: !ruby/object:Gem::Requirement
208
208
  requirements:
209
209
  - - "~>"
210
210
  - !ruby/object:Gem::Version
211
- version: 2.1.2
211
+ version: '2.1'
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: simplecov
214
214
  requirement: !ruby/object:Gem::Requirement
@@ -636,7 +636,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
636
636
  - !ruby/object:Gem::Version
637
637
  version: '0'
638
638
  requirements: []
639
- rubygems_version: 3.1.4
639
+ rubygems_version: 3.2.16
640
640
  signing_key:
641
641
  specification_version: 4
642
642
  summary: Auth0 API Client