auth0 5.6.1 → 5.7.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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +2 -1
  3. data/.gitignore +0 -1
  4. data/CHANGELOG.md +11 -1
  5. data/Gemfile.lock +233 -0
  6. data/lib/auth0/api/v2/attack_protection.rb +79 -0
  7. data/lib/auth0/api/v2/organizations.rb +1 -1
  8. data/lib/auth0/api/v2.rb +2 -0
  9. data/lib/auth0/version.rb +1 -1
  10. data/spec/lib/auth0/api/v2/actions_spec.rb +13 -13
  11. data/spec/lib/auth0/api/v2/attack_protection_spec.rb +132 -0
  12. data/spec/lib/auth0/api/v2/blacklists_spec.rb +2 -2
  13. data/spec/lib/auth0/api/v2/branding_spec.rb +4 -3
  14. data/spec/lib/auth0/api/v2/client_grants_spec.rb +8 -8
  15. data/spec/lib/auth0/api/v2/clients_spec.rb +12 -12
  16. data/spec/lib/auth0/api/v2/connections_spec.rb +10 -10
  17. data/spec/lib/auth0/api/v2/device_credentials_spec.rb +4 -4
  18. data/spec/lib/auth0/api/v2/emails_spec.rb +2 -2
  19. data/spec/lib/auth0/api/v2/grants_spec.rb +10 -10
  20. data/spec/lib/auth0/api/v2/jobs_spec.rb +18 -17
  21. data/spec/lib/auth0/api/v2/log_streams_spec.rb +3 -3
  22. data/spec/lib/auth0/api/v2/logs_spec.rb +2 -2
  23. data/spec/lib/auth0/api/v2/organizations_spec.rb +13 -13
  24. data/spec/lib/auth0/api/v2/resource_servers_spec.rb +5 -5
  25. data/spec/lib/auth0/api/v2/roles_spec.rb +22 -22
  26. data/spec/lib/auth0/api/v2/rules_spec.rb +7 -7
  27. data/spec/lib/auth0/api/v2/stats_spec.rb +1 -1
  28. data/spec/lib/auth0/api/v2/tenants_spec.rb +1 -1
  29. data/spec/lib/auth0/api/v2/tickets_spec.rb +14 -14
  30. data/spec/lib/auth0/api/v2/user_blocks_spec.rb +2 -2
  31. data/spec/lib/auth0/api/v2/users_by_email_spec.rb +2 -2
  32. data/spec/lib/auth0/api/v2/users_spec.rb +23 -23
  33. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d57247dc3db711110d8be1372f9679bdf5124e271ed9648c0a8f657c38daa76
4
- data.tar.gz: 81946438f3e11d42d628ed9da89a446ee72f3b10ee638cf058804b9bce35948b
3
+ metadata.gz: 620d2e620738de16a0d93b03b0c0aa0bfb8ec4237f15bf5d162c265422c32a1c
4
+ data.tar.gz: 4793187b1546e9a5bf2432de5d208971d689934444e2dcb50d962380bb020ab5
5
5
  SHA512:
6
- metadata.gz: 057f873c48f31661967dcb8c9ec62ec275f0f5feef9777e1c88bb6e0fa16263522e4049e1c23d91f528c5f30d5c0404266ea21276e6bcdf3b716d70bbdf71f9d
7
- data.tar.gz: ab73c8c4d3691f11d1f426c175f3de2f163ca241db2461300e66c90028ad5c01c8dd4e7b46a50e9e12f28649f667597a5cac386bbad0a396dd469617a639f1d5
6
+ metadata.gz: 1940c62f9398063cbd3b24dceb8538ea7d8872091ec280f5580a4f880198767f3d7b0be0d512e1c63ee25ba380f3666eca1bbf823da0689fb6f17454c695daec
7
+ data.tar.gz: 8994e0f38d80460bc770567c2a62b53dfafe302fe631f9ddb2edd559cb5af33356f9442014bc710c635bbb4c0064e8997bdf6dbdf42a9192e125b87ba55f03ec
data/.circleci/config.yml CHANGED
@@ -27,6 +27,7 @@ jobs:
27
27
  ruby_version: << parameters.ruby_version >>
28
28
  steps:
29
29
  - checkout
30
+ - run: rm Gemfile.lock
30
31
  - restore_cache:
31
32
  key: gems-v2-{{ checksum "Gemfile.lock" }}
32
33
  - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
@@ -41,4 +42,4 @@ workflows:
41
42
  tests:
42
43
  jobs:
43
44
  - run-tests:
44
- <<: *matrix_ruby_versions
45
+ <<: *matrix_ruby_versions
data/.gitignore CHANGED
@@ -11,7 +11,6 @@ coverage
11
11
  *.swo
12
12
  spec/auth0.yml
13
13
  .env
14
- /Gemfile.lock
15
14
  /.yardoc/checksums
16
15
  /.yardoc/complete
17
16
  /.yardoc/object_types
data/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
- # Changelog
1
+ # Change Log
2
+
3
+ ## [v5.7.0](https://github.com/auth0/ruby-auth0/tree/v5.7.0) (2022-02-17)
4
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v5.6.1...v5.7.0)
5
+
6
+ **Added**
7
+ - [SDK-3118] Add attack protection endpoints [\#316](https://github.com/auth0/ruby-auth0/pull/316) ([stevehobbsdev](https://github.com/stevehobbsdev))
8
+
9
+ **Fixed**
10
+ - [SDK-3106] Fix up tests for Ruby 3 and rspec-mocks update [\#313](https://github.com/auth0/ruby-auth0/pull/313) ([stevehobbsdev](https://github.com/stevehobbsdev))
11
+ - Fix #310: delete_organizations_member_roles should use delete_with_body instead of delete [\#311](https://github.com/auth0/ruby-auth0/pull/311) ([SanterreJo](https://github.com/SanterreJo))
2
12
 
3
13
  ## [v5.6.1](https://github.com/auth0/ruby-auth0/tree/v5.6.1) (2021-09-14)
4
14
 
data/Gemfile.lock ADDED
@@ -0,0 +1,233 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ auth0 (5.7.0)
5
+ addressable (~> 2.8)
6
+ jwt (~> 2.2)
7
+ rest-client (~> 2.1)
8
+ retryable (~> 3.0)
9
+ zache (~> 0.12)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actionpack (7.0.2.2)
15
+ actionview (= 7.0.2.2)
16
+ activesupport (= 7.0.2.2)
17
+ rack (~> 2.0, >= 2.2.0)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.0)
20
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
21
+ actionview (7.0.2.2)
22
+ activesupport (= 7.0.2.2)
23
+ builder (~> 3.1)
24
+ erubi (~> 1.4)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
27
+ activesupport (7.0.2.2)
28
+ concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ i18n (>= 1.6, < 2)
30
+ minitest (>= 5.1)
31
+ tzinfo (~> 2.0)
32
+ addressable (2.8.0)
33
+ public_suffix (>= 2.0.2, < 5.0)
34
+ ast (2.4.2)
35
+ builder (3.2.4)
36
+ codecov (0.6.0)
37
+ simplecov (>= 0.15, < 0.22)
38
+ coderay (1.1.3)
39
+ concurrent-ruby (1.1.9)
40
+ coveralls (0.7.1)
41
+ multi_json (~> 1.3)
42
+ rest-client
43
+ simplecov (>= 0.7)
44
+ term-ansicolor
45
+ thor
46
+ crack (0.4.5)
47
+ rexml
48
+ crass (1.0.6)
49
+ diff-lcs (1.5.0)
50
+ docile (1.4.0)
51
+ domain_name (0.5.20190701)
52
+ unf (>= 0.0.5, < 1.0.0)
53
+ dotenv (2.7.6)
54
+ dotenv-rails (2.7.6)
55
+ dotenv (= 2.7.6)
56
+ railties (>= 3.2)
57
+ erubi (1.10.0)
58
+ faker (2.19.0)
59
+ i18n (>= 1.6, < 2)
60
+ ffi (1.15.5)
61
+ formatador (1.1.0)
62
+ fuubar (2.5.1)
63
+ rspec-core (~> 3.0)
64
+ ruby-progressbar (~> 1.4)
65
+ gem-release (0.7.4)
66
+ guard (2.17.0)
67
+ formatador (>= 0.2.4)
68
+ listen (>= 2.7, < 4.0)
69
+ lumberjack (>= 1.0.12, < 2.0)
70
+ nenv (~> 0.1)
71
+ notiffany (~> 0.0)
72
+ pry (>= 0.9.12)
73
+ shellany (~> 0.0)
74
+ thor (>= 0.18.1)
75
+ guard-compat (1.2.1)
76
+ guard-rspec (4.7.3)
77
+ guard (~> 2.1)
78
+ guard-compat (~> 1.1)
79
+ rspec (>= 2.99.0, < 4.0)
80
+ hashdiff (1.0.1)
81
+ http-accept (1.7.0)
82
+ http-cookie (1.0.4)
83
+ domain_name (~> 0.5)
84
+ i18n (1.10.0)
85
+ concurrent-ruby (~> 1.0)
86
+ jwt (2.3.0)
87
+ listen (3.7.1)
88
+ rb-fsevent (~> 0.10, >= 0.10.3)
89
+ rb-inotify (~> 0.9, >= 0.9.10)
90
+ loofah (2.14.0)
91
+ crass (~> 1.0.2)
92
+ nokogiri (>= 1.5.9)
93
+ lumberjack (1.2.8)
94
+ method_source (0.9.2)
95
+ mime-types (3.4.1)
96
+ mime-types-data (~> 3.2015)
97
+ mime-types-data (3.2022.0105)
98
+ mini_portile2 (2.7.1)
99
+ minitest (5.15.0)
100
+ multi_json (1.15.0)
101
+ nenv (0.3.0)
102
+ netrc (0.11.0)
103
+ nokogiri (1.13.1)
104
+ mini_portile2 (~> 2.7.0)
105
+ racc (~> 1.4)
106
+ notiffany (0.1.3)
107
+ nenv (~> 0.1)
108
+ shellany (~> 0.0)
109
+ parallel (1.21.0)
110
+ parser (3.1.0.0)
111
+ ast (~> 2.4.1)
112
+ pry (0.12.2)
113
+ coderay (~> 1.1.0)
114
+ method_source (~> 0.9.0)
115
+ pry-nav (0.3.0)
116
+ pry (>= 0.9.10, < 0.13.0)
117
+ public_suffix (4.0.6)
118
+ racc (1.6.0)
119
+ rack (2.2.3)
120
+ rack-test (0.8.3)
121
+ rack (>= 1.0, < 3)
122
+ rails-dom-testing (2.0.3)
123
+ activesupport (>= 4.2.0)
124
+ nokogiri (>= 1.6)
125
+ rails-html-sanitizer (1.4.2)
126
+ loofah (~> 2.3)
127
+ railties (7.0.2.2)
128
+ actionpack (= 7.0.2.2)
129
+ activesupport (= 7.0.2.2)
130
+ method_source
131
+ rake (>= 12.2)
132
+ thor (~> 1.0)
133
+ zeitwerk (~> 2.5)
134
+ rainbow (3.1.1)
135
+ rake (13.0.6)
136
+ rb-fsevent (0.11.1)
137
+ rb-inotify (0.10.1)
138
+ ffi (~> 1.0)
139
+ regexp_parser (2.2.1)
140
+ rest-client (2.1.0)
141
+ http-accept (>= 1.7.0, < 2.0)
142
+ http-cookie (>= 1.0.2, < 2.0)
143
+ mime-types (>= 1.16, < 4.0)
144
+ netrc (~> 0.8)
145
+ retryable (3.0.5)
146
+ rexml (3.2.5)
147
+ rspec (3.11.0)
148
+ rspec-core (~> 3.11.0)
149
+ rspec-expectations (~> 3.11.0)
150
+ rspec-mocks (~> 3.11.0)
151
+ rspec-core (3.11.0)
152
+ rspec-support (~> 3.11.0)
153
+ rspec-expectations (3.11.0)
154
+ diff-lcs (>= 1.2.0, < 2.0)
155
+ rspec-support (~> 3.11.0)
156
+ rspec-mocks (3.11.0)
157
+ diff-lcs (>= 1.2.0, < 2.0)
158
+ rspec-support (~> 3.11.0)
159
+ rspec-support (3.11.0)
160
+ rubocop (1.25.1)
161
+ parallel (~> 1.10)
162
+ parser (>= 3.1.0.0)
163
+ rainbow (>= 2.2.2, < 4.0)
164
+ regexp_parser (>= 1.8, < 3.0)
165
+ rexml
166
+ rubocop-ast (>= 1.15.1, < 2.0)
167
+ ruby-progressbar (~> 1.7)
168
+ unicode-display_width (>= 1.4.0, < 3.0)
169
+ rubocop-ast (1.15.2)
170
+ parser (>= 3.0.1.1)
171
+ rubocop-rails (2.13.2)
172
+ activesupport (>= 4.2.0)
173
+ rack (>= 1.1)
174
+ rubocop (>= 1.7.0, < 2.0)
175
+ ruby-progressbar (1.11.0)
176
+ shellany (0.0.1)
177
+ simplecov (0.21.2)
178
+ docile (~> 1.1)
179
+ simplecov-html (~> 0.11)
180
+ simplecov_json_formatter (~> 0.1)
181
+ simplecov-html (0.12.3)
182
+ simplecov_json_formatter (0.1.4)
183
+ sync (0.5.0)
184
+ term-ansicolor (1.7.1)
185
+ tins (~> 1.0)
186
+ terminal-notifier-guard (1.7.0)
187
+ thor (1.2.1)
188
+ timecop (0.9.4)
189
+ tins (1.31.0)
190
+ sync
191
+ tzinfo (2.0.4)
192
+ concurrent-ruby (~> 1.0)
193
+ unf (0.1.4)
194
+ unf_ext
195
+ unf_ext (0.0.8)
196
+ unicode-display_width (2.1.0)
197
+ vcr (6.0.0)
198
+ webmock (3.14.0)
199
+ addressable (>= 2.8.0)
200
+ crack (>= 0.3.2)
201
+ hashdiff (>= 0.4.0, < 2.0.0)
202
+ zache (0.12.0)
203
+ zeitwerk (2.5.4)
204
+
205
+ PLATFORMS
206
+ ruby
207
+
208
+ DEPENDENCIES
209
+ auth0!
210
+ bundler
211
+ codecov
212
+ coveralls
213
+ dotenv-rails (~> 2.0)
214
+ faker (~> 2.0)
215
+ fuubar (~> 2.0)
216
+ gem-release (~> 0.7)
217
+ guard-rspec (~> 4.5)
218
+ pry (~> 0.10)
219
+ pry-nav (~> 0.2)
220
+ rack (~> 2.1)
221
+ rack-test (~> 0.6)
222
+ rake (~> 13.0)
223
+ rspec (~> 3.5)
224
+ rubocop
225
+ rubocop-rails
226
+ simplecov
227
+ terminal-notifier-guard
228
+ timecop
229
+ vcr
230
+ webmock
231
+
232
+ BUNDLED WITH
233
+ 1.17.2
@@ -0,0 +1,79 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the attack-protection endpoints
5
+ module AttackProtection
6
+ attr_reader :attack_protection_path
7
+
8
+ # Get breached password detection settings
9
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_breached_password_detection
10
+ # @return [json] The configuration for breached password detection
11
+ def breached_password_detection
12
+ get(breached_password_settings_path)
13
+ end
14
+ alias get_breached_password_detection_settings breached_password_detection
15
+
16
+ # Update breached password detection settings
17
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_breached_password_detection
18
+ # @param body [hash] See https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_breached_password_detection for available options
19
+ # @return [json] The configuration for breached password detection
20
+ def patch_breached_password_detection(body)
21
+ patch(breached_password_settings_path, body)
22
+ end
23
+
24
+ # Get brute force protection settings.
25
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_brute_force_protection
26
+ # @return [json] The configuration for brute force protection
27
+ def brute_force_protection
28
+ get(brute_force_protection_settings_path)
29
+ end
30
+ alias get_brute_force_protection_settings brute_force_protection
31
+
32
+ # Update brute force protection settings.
33
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_brute_force_protection
34
+ # @param body [hash] See https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_brute_force_protection for available options
35
+ # @return [json] The configuration for brute force protection
36
+ def patch_brute_force_protection(body)
37
+ patch(brute_force_protection_settings_path, body)
38
+ end
39
+ alias update_brute_force_protection_settings patch_brute_force_protection
40
+
41
+ # Get suspicious IP throttling settings
42
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_suspicious_ip_throttling
43
+ # @return The configuration for suspicious IP throttling
44
+ def suspicious_ip_throttling
45
+ get(suspicious_ip_throttling_settings_path)
46
+ end
47
+ alias get_suspicious_ip_throttling_settings suspicious_ip_throttling
48
+
49
+ # Update suspicious IP throttling settings
50
+ # @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_suspicious_ip_throttling
51
+ # @param body [hash] See https://auth0.com/docs/api/management/v2#!/Attack_Protection/patch_suspicious_ip_throttling for available options
52
+ # @return The configuration for suspicious IP throttling
53
+ def patch_suspicious_ip_throttling(body)
54
+ patch(suspicious_ip_throttling_settings_path, body)
55
+ end
56
+ alias update_suspicious_ip_throttling_settings patch_suspicious_ip_throttling
57
+
58
+ private
59
+
60
+ def attack_protection_path
61
+ @attack_protection_path ||= '/api/v2/attack-protection'
62
+ end
63
+ alias update_breached_password_detection_settings patch_breached_password_detection
64
+
65
+ def breached_password_settings_path
66
+ "#{attack_protection_path}/breached-password-detection"
67
+ end
68
+
69
+ def brute_force_protection_settings_path
70
+ "#{attack_protection_path}/brute-force-protection"
71
+ end
72
+
73
+ def suspicious_ip_throttling_settings_path
74
+ "#{attack_protection_path}/suspicious-ip-throttling"
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -320,7 +320,7 @@ module Auth0
320
320
  body = {}
321
321
  body[:roles] = roles
322
322
 
323
- delete(path, body)
323
+ delete_with_body(path, body)
324
324
  end
325
325
  alias remove_organizations_member_roles delete_organizations_member_roles
326
326
 
data/lib/auth0/api/v2.rb CHANGED
@@ -23,6 +23,7 @@ require 'auth0/api/v2/logs'
23
23
  require 'auth0/api/v2/log_streams'
24
24
  require 'auth0/api/v2/resource_servers'
25
25
  require 'auth0/api/v2/guardian'
26
+ require 'auth0/api/v2/attack_protection'
26
27
 
27
28
  module Auth0
28
29
  module Api
@@ -53,6 +54,7 @@ module Auth0
53
54
  include Auth0::Api::V2::ResourceServers
54
55
  include Auth0::Api::V2::Tenants
55
56
  include Auth0::Api::V2::Tickets
57
+ include Auth0::Api::V2::AttackProtection
56
58
  end
57
59
  end
58
60
  end
data/lib/auth0/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # current version of gem
2
2
  module Auth0
3
- VERSION = '5.6.1'.freeze
3
+ VERSION = '5.7.0'.freeze
4
4
  end
@@ -17,14 +17,14 @@ describe Auth0::Api::V2::Actions do
17
17
 
18
18
  it 'is expected to get /api/v2/actions with custom parameters' do
19
19
  expect(@instance).to receive(:get).with(
20
- '/api/v2/actions/actions',
20
+ '/api/v2/actions/actions', {
21
21
  trigger_id: 'post-login',
22
22
  action_name: 'loginHandler',
23
23
  deployed: true,
24
24
  per_page: 10,
25
25
  page: 1,
26
26
  installed: true
27
- )
27
+ })
28
28
  expect do
29
29
  @instance.actions(
30
30
  'post-login',
@@ -71,9 +71,9 @@ describe Auth0::Api::V2::Actions do
71
71
 
72
72
  it 'is expected to post to /api/v2/actions' do
73
73
  expect(@instance).to receive(:post).with(
74
- '/api/v2/actions',
74
+ '/api/v2/actions', {
75
75
  name: 'test_org'
76
- )
76
+ })
77
77
  expect do
78
78
  @instance.create_action(
79
79
  name: 'test_org'
@@ -141,10 +141,10 @@ describe Auth0::Api::V2::Actions do
141
141
 
142
142
  it 'is expected to call get request to /api/v2/actions/actions/{id}/versions' do
143
143
  expect(@instance).to receive(:get).with(
144
- '/api/v2/actions/actions/123/versions',
144
+ '/api/v2/actions/actions/123/versions', {
145
145
  per_page: nil,
146
146
  page: nil
147
- )
147
+ })
148
148
  expect { @instance.actions_versions('123') }.not_to raise_error
149
149
  end
150
150
 
@@ -154,10 +154,10 @@ describe Auth0::Api::V2::Actions do
154
154
 
155
155
  it 'is expected to get /api/v2/actions/actions/{id}/versions with custom parameters' do
156
156
  expect(@instance).to receive(:get).with(
157
- '/api/v2/actions/actions/123/versions',
157
+ '/api/v2/actions/actions/123/versions', {
158
158
  per_page: 10,
159
159
  page: 1
160
- )
160
+ })
161
161
  expect do
162
162
  @instance.actions_versions(
163
163
  '123',
@@ -176,10 +176,10 @@ describe Auth0::Api::V2::Actions do
176
176
 
177
177
  it 'is expected to call get request to /api/v2/actions/triggers/{id}/bindings' do
178
178
  expect(@instance).to receive(:get).with(
179
- '/api/v2/actions/triggers/123/bindings',
179
+ '/api/v2/actions/triggers/123/bindings', {
180
180
  per_page: nil,
181
181
  page: nil
182
- )
182
+ })
183
183
  expect { @instance.trigger_bindings('123') }.not_to raise_error
184
184
  end
185
185
 
@@ -189,10 +189,10 @@ describe Auth0::Api::V2::Actions do
189
189
 
190
190
  it 'is expected to get /api/v2/actions/triggers/{id}/bindings with custom parameters' do
191
191
  expect(@instance).to receive(:get).with(
192
- '/api/v2/actions/triggers/123/bindings',
192
+ '/api/v2/actions/triggers/123/bindings', {
193
193
  per_page: 10,
194
194
  page: 1
195
- )
195
+ })
196
196
  expect do
197
197
  @instance.trigger_bindings(
198
198
  '123',
@@ -278,7 +278,7 @@ describe Auth0::Api::V2::Actions do
278
278
  it 'is expected to post to /api/v2/actions/{id}/test' do
279
279
  expect(@instance).to receive(:post).with(
280
280
  '/api/v2/actions/actions/123/test',
281
- name: 'test_org'
281
+ { name: 'test_org' }
282
282
  )
283
283
  expect do
284
284
  @instance.test_action(
@@ -0,0 +1,132 @@
1
+ require 'spec_helper'
2
+
3
+ describe Auth0::Api::V2::AttackProtection do
4
+ before :all do
5
+ dummy_instance = DummyClass.new
6
+ dummy_instance.extend(Auth0::Api::V2::AttackProtection)
7
+ @instance = dummy_instance
8
+ end
9
+
10
+ context '.get breached-password-detection' do
11
+ it 'responds to a breached_password_detection method' do
12
+ expect(@instance).to respond_to(:breached_password_detection)
13
+ end
14
+
15
+ it 'responds to get_breached_password_detection_settings' do
16
+ expect(@instance).to respond_to(:get_breached_password_detection_settings)
17
+ end
18
+
19
+ it 'is expected to get /api/v2/attack-protection/breached-password' do
20
+ expect(@instance).to receive(:get).with(
21
+ '/api/v2/attack-protection/breached-password-detection'
22
+ )
23
+
24
+ expect { @instance.breached_password_detection }.not_to raise_error
25
+ end
26
+ end
27
+
28
+ context '.patch breached-password-detection' do
29
+ it 'responds to a patch_breached_password_detection method' do
30
+ expect(@instance).to respond_to(:patch_breached_password_detection)
31
+ end
32
+
33
+ it 'responds to a update_breached_password_detection_settings method' do
34
+ expect(@instance).to respond_to(:update_breached_password_detection_settings)
35
+ end
36
+
37
+ it 'is expected to patch /api/v2/attack-protection/breached-password-detection' do
38
+ expect(@instance).to receive(:patch).with(
39
+ '/api/v2/attack-protection/breached-password-detection',
40
+ {
41
+ enabled: true
42
+ }
43
+ )
44
+
45
+ @instance.patch_breached_password_detection({
46
+ enabled: true
47
+ })
48
+ end
49
+ end
50
+
51
+ context '.get brute_force_protection' do
52
+ it 'responds to brute_force_protection' do
53
+ expect(@instance).to respond_to(:brute_force_protection)
54
+ end
55
+
56
+ it 'responds to get_brute_force_protection_settings' do
57
+ expect(@instance).to respond_to(:get_brute_force_protection_settings)
58
+ end
59
+
60
+ it 'is expected to get /api/v2/attack-protection/brute-force-protection' do
61
+ expect(@instance).to receive(:get).with(
62
+ '/api/v2/attack-protection/brute-force-protection'
63
+ )
64
+
65
+ expect { @instance.brute_force_protection }.not_to raise_error
66
+ end
67
+ end
68
+
69
+ context '.patch brute-force-protection' do
70
+ it 'responds to patch_brute-force-protection' do
71
+ expect(@instance).to respond_to(:patch_brute_force_protection)
72
+ end
73
+
74
+ it 'responds to update_brute_force_protection_settings' do
75
+ expect(@instance).to respond_to(:update_brute_force_protection_settings)
76
+ end
77
+
78
+ it 'is expected to respond to patch /api/v2/attack-protection/brute-force-protection' do
79
+ expect(@instance).to receive(:patch).with(
80
+ '/api/v2/attack-protection/brute-force-protection',
81
+ {
82
+ enabled: true
83
+ }
84
+ )
85
+
86
+ @instance.patch_brute_force_protection({
87
+ enabled: true
88
+ })
89
+ end
90
+ end
91
+
92
+ context '.get suspicious-ip-throttling' do
93
+ it 'responds to suspicious_ip_throttling' do
94
+ expect(@instance).to respond_to(:suspicious_ip_throttling)
95
+ end
96
+
97
+ it 'responds to get_suspicious_ip_throttling_settings' do
98
+ expect(@instance).to respond_to(:get_suspicious_ip_throttling_settings)
99
+ end
100
+
101
+ it 'is expected to get /api/v2/attack-protection/suspicious-ip-throttling' do
102
+ expect(@instance).to receive(:get).with(
103
+ '/api/v2/attack-protection/suspicious-ip-throttling'
104
+ )
105
+
106
+ expect { @instance.suspicious_ip_throttling }.not_to raise_error
107
+ end
108
+ end
109
+
110
+ context '.patch suspicious-ip-throttling' do
111
+ it 'responds to patch_suspicious_ip_throttling' do
112
+ expect(@instance).to respond_to(:patch_suspicious_ip_throttling)
113
+ end
114
+
115
+ it 'responds to update_suspicious_ip_throttling_settings' do
116
+ expect(@instance).to respond_to(:update_suspicious_ip_throttling_settings)
117
+ end
118
+
119
+ it 'is expected to patch /api/v2/attack-protection/suspicious-ip-throttling' do
120
+ expect(@instance).to receive(:patch).with(
121
+ '/api/v2/attack-protection/suspicious-ip-throttling',
122
+ {
123
+ enabled: true
124
+ }
125
+ )
126
+
127
+ @instance.patch_suspicious_ip_throttling({
128
+ enabled: true
129
+ })
130
+ end
131
+ end
132
+ end
@@ -9,7 +9,7 @@ describe Auth0::Api::V2::Blacklists do
9
9
  context '.blacklisted_tokens' do
10
10
  it { expect(@instance).to respond_to(:blacklisted_tokens) }
11
11
  it 'is expected to call /api/v2/blacklists/tokens' do
12
- expect(@instance).to receive(:get).with('/api/v2/blacklists/tokens', aud: nil)
12
+ expect(@instance).to receive(:get).with('/api/v2/blacklists/tokens', { aud: nil })
13
13
  expect { @instance.blacklisted_tokens }.not_to raise_error
14
14
  end
15
15
  end
@@ -17,7 +17,7 @@ describe Auth0::Api::V2::Blacklists do
17
17
  context '.add_token.to_blacklist' do
18
18
  it { expect(@instance).to respond_to(:add_token_to_blacklist) }
19
19
  it 'is expected to call post to /api/v2/blacklists/tokens' do
20
- expect(@instance).to receive(:post).with('/api/v2/blacklists/tokens', aud: 'aud', jti: 'jti')
20
+ expect(@instance).to receive(:post).with('/api/v2/blacklists/tokens', { aud: 'aud', jti: 'jti' })
21
21
  @instance.add_token_to_blacklist('jti', 'aud')
22
22
  end
23
23
  it { expect { @instance.add_token_to_blacklist('', '') }.to raise_error 'Must specify a valid JTI' }
@@ -24,8 +24,9 @@ describe Auth0::Api::V2::Branding do
24
24
  it { expect(@instance).to respond_to(:patch_branding) }
25
25
  it 'is expected to call post /api/v2/branding' do
26
26
  expect(@instance).to receive(:patch).with(
27
- '/api/v2/branding',
28
- template: 'Test'
27
+ '/api/v2/branding', {
28
+ template: 'Test'
29
+ }
29
30
  )
30
31
  expect { @instance.patch_branding({ template: 'Test' }) }.not_to raise_error
31
32
  end
@@ -52,7 +53,7 @@ describe Auth0::Api::V2::Branding do
52
53
  it { expect(@instance).to respond_to(:put_branding_templates_for_universal_login) }
53
54
  it 'is expected to call put /api/v2/branding/templates/universal-login' do
54
55
  expect(@instance).to receive(:put).with(
55
- '/api/v2/branding/templates/universal-login', template: 'Template'
56
+ '/api/v2/branding/templates/universal-login', { template: 'Template' }
56
57
  )
57
58
  expect do
58
59
  @instance.put_branding_templates_for_universal_login(template: 'Template')