workos 2.3.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +4 -1
  4. data/lib/workos/audit_trail.rb +0 -1
  5. data/lib/workos/client.rb +14 -5
  6. data/lib/workos/configuration.rb +17 -0
  7. data/lib/workos/directory_group.rb +5 -1
  8. data/lib/workos/directory_sync.rb +0 -1
  9. data/lib/workos/directory_user.rb +7 -1
  10. data/lib/workos/errors.rb +3 -0
  11. data/lib/workos/mfa.rb +22 -7
  12. data/lib/workos/organizations.rb +0 -1
  13. data/lib/workos/passwordless.rb +0 -1
  14. data/lib/workos/portal.rb +0 -1
  15. data/lib/workos/sso.rb +1 -2
  16. data/lib/workos/types/directory_group_struct.rb +1 -0
  17. data/lib/workos/types/directory_user_struct.rb +2 -0
  18. data/lib/workos/types/{verify_factor_struct.rb → verify_challenge_struct.rb} +3 -3
  19. data/lib/workos/types.rb +1 -1
  20. data/lib/workos/{verify_factor.rb → verify_challenge.rb} +5 -6
  21. data/lib/workos/version.rb +1 -1
  22. data/lib/workos.rb +17 -7
  23. data/spec/lib/workos/configuration_spec.rb +61 -0
  24. data/spec/lib/workos/directory_sync_spec.rb +4 -1
  25. data/spec/lib/workos/mfa_spec.rb +93 -74
  26. data/spec/lib/workos/sso_spec.rb +1 -1
  27. data/spec/spec_helper.rb +2 -2
  28. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml +10 -12
  29. data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +28 -31
  30. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml +2 -2
  31. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml +2 -2
  32. data/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml +2 -2
  33. data/spec/support/fixtures/vcr_cassettes/mfa/{verify_factor_generic_expired.yml → verify_challenge_generic_expired.yml} +2 -2
  34. data/spec/support/fixtures/vcr_cassettes/mfa/{verify_factor_generic_invalid.yml → verify_challenge_generic_invalid.yml} +2 -2
  35. data/spec/support/fixtures/vcr_cassettes/mfa/{verify_factor_generic_valid.yml → verify_challenge_generic_valid.yml} +2 -2
  36. data/spec/support/fixtures/vcr_cassettes/mfa/{verify_factor_generic_valid_is_false.yml → verify_challenge_generic_valid_is_false.yml} +2 -2
  37. data/spec/support/shared_examples/client_spec.rb +14 -0
  38. metadata +16 -16
  39. data/lib/workos/base.rb +0 -18
  40. data/spec/lib/workos/base_spec.rb +0 -30
@@ -4,8 +4,8 @@
4
4
  describe WorkOS::MFA do
5
5
  it_behaves_like 'client'
6
6
 
7
- describe 'enroll_factor valid requests' do
8
- context 'enroll factor using valid generic argument' do
7
+ describe '.enroll_factor' do
8
+ context 'with valid generic argument' do
9
9
  it 'returns a valid factor object' do
10
10
  VCR.use_cassette 'mfa/enroll_factor_generic_valid' do
11
11
  factor = described_class.enroll_factor(
@@ -16,7 +16,7 @@ describe WorkOS::MFA do
16
16
  end
17
17
  end
18
18
 
19
- context 'enroll factor using valid totp arguments' do
19
+ context 'with valid totp arguments' do
20
20
  it 'returns a valid factor object' do
21
21
  VCR.use_cassette 'mfa/enroll_factor_totp_valid' do
22
22
  factor = described_class.enroll_factor(
@@ -29,7 +29,7 @@ describe WorkOS::MFA do
29
29
  end
30
30
  end
31
31
 
32
- context 'enroll factor using valid sms arguments' do
32
+ context 'with valid sms arguments' do
33
33
  it 'returns a valid factor object' do
34
34
  VCR.use_cassette 'mfa/enroll_factor_sms_valid' do
35
35
  factor = described_class.enroll_factor(
@@ -40,10 +40,8 @@ describe WorkOS::MFA do
40
40
  end
41
41
  end
42
42
  end
43
- end
44
43
 
45
- describe 'enroll_factor invalid responses' do
46
- context 'enroll factor throws error if type is not sms or totp' do
44
+ context 'when type is not sms or totp' do
47
45
  it 'returns an error' do
48
46
  expect do
49
47
  described_class.enroll_factor(
@@ -57,7 +55,7 @@ describe WorkOS::MFA do
57
55
  end
58
56
  end
59
57
 
60
- context 'enroll factor throws error if type is not sms or totp' do
58
+ context 'when type is totp but missing arguments' do
61
59
  it 'returns an error' do
62
60
  expect do
63
61
  described_class.enroll_factor(
@@ -70,7 +68,7 @@ describe WorkOS::MFA do
70
68
  )
71
69
  end
72
70
  end
73
- context 'enroll factor throws error if type sms and phone number is nil' do
71
+ context 'when type is sms and phone number is nil' do
74
72
  it 'returns an error' do
75
73
  expect do
76
74
  described_class.enroll_factor(
@@ -84,7 +82,7 @@ describe WorkOS::MFA do
84
82
  end
85
83
  end
86
84
 
87
- describe 'challenge factor with valid request arguments' do
85
+ describe '.challenge_factor' do
88
86
  context 'challenge with totp' do
89
87
  it 'returns challenge factor object for totp' do
90
88
  VCR.use_cassette 'mfa/challenge_factor_totp_valid' do
@@ -118,9 +116,7 @@ describe WorkOS::MFA do
118
116
  end
119
117
  end
120
118
  end
121
- end
122
119
 
123
- describe 'challenge factor with invalid arguments' do
124
120
  context 'challenge with totp mssing authentication_factor_id' do
125
121
  it 'returns argument error' do
126
122
  expect do
@@ -133,48 +129,58 @@ describe WorkOS::MFA do
133
129
  end
134
130
  end
135
131
 
136
- describe 'challenge factor with valid requests' do
137
- context 'verify generic otp' do
138
- it 'returns a true boolean if the challenge has not been verifed yet' do
139
- VCR.use_cassette 'mfa/verify_factor_generic_valid' do
140
- verify_factor = described_class.verify_factor(
132
+ describe '.verify_factor' do
133
+ it 'throws a warning' do
134
+ expect do
135
+ VCR.use_cassette 'mfa/verify_challenge_generic_valid' do
136
+ described_class.verify_factor(
141
137
  authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
142
138
  code: '897792',
143
139
  )
144
- expect(verify_factor.valid == 'true')
145
140
  end
146
- end
141
+ end.to output("[DEPRECATION] `verify_factor` is deprecated. Please use `verify_challenge` instead.\n").to_stderr
147
142
  end
148
143
 
149
- context 'verify generic otp invalid response' do
150
- it 'returns a true boolean if the challenge has not been verifed yet' do
151
- VCR.use_cassette 'mfa/verify_factor_generic_valid_is_false' do
152
- verify_factor = described_class.verify_factor(
153
- authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
154
- code: '897792',
155
- )
156
- expect(verify_factor.valid == 'false')
157
- end
144
+ it 'calls verify_challenge' do
145
+ VCR.use_cassette 'mfa/verify_challenge_generic_valid' do
146
+ verify_factor = described_class.verify_factor(
147
+ authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
148
+ code: '897792',
149
+ )
150
+ expect(verify_factor.valid == 'true')
158
151
  end
159
152
  end
153
+ end
160
154
 
161
- context 'verify generic otp' do
162
- it 'returns error that the challenge has already been verfied' do
163
- VCR.use_cassette 'mfa/verify_factor_generic_invalid' do
164
- expect do
165
- described_class.verify_factor(
155
+ describe '.verify_challenge' do
156
+ context 'with generic otp' do
157
+ context 'and the challenge has not been verified' do
158
+ it 'returns true if the code is correct' do
159
+ VCR.use_cassette 'mfa/verify_challenge_generic_valid' do
160
+ verify_challenge = described_class.verify_challenge(
166
161
  authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
167
162
  code: '897792',
168
163
  )
169
- end.to raise_error(WorkOS::InvalidRequestError)
164
+ expect(verify_challenge.valid == 'true')
165
+ end
166
+ end
167
+
168
+ it 'returns false if the code is incorrect' do
169
+ VCR.use_cassette 'mfa/verify_challenge_generic_valid_is_false' do
170
+ verify_challenge = described_class.verify_challenge(
171
+ authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
172
+ code: '897792',
173
+ )
174
+ expect(verify_challenge.valid == 'false')
175
+ end
170
176
  end
171
177
  end
172
178
 
173
- context 'verify generic otp' do
174
- it 'returns error that the challenge has expired' do
175
- VCR.use_cassette 'mfa/verify_factor_generic_expired' do
179
+ context 'and the challenge has already been verified' do
180
+ it 'returns an error' do
181
+ VCR.use_cassette 'mfa/verify_challenge_generic_invalid' do
176
182
  expect do
177
- described_class.verify_factor(
183
+ described_class.verify_challenge(
178
184
  authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
179
185
  code: '897792',
180
186
  )
@@ -182,51 +188,62 @@ describe WorkOS::MFA do
182
188
  end
183
189
  end
184
190
  end
185
- end
186
- end
187
191
 
188
- describe 'verify_factor with invalid argument' do
189
- context 'missing code argument' do
190
- it 'returns argument error' do
191
- expect do
192
- described_class.verify_factor(
193
- authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
192
+ context 'and the challenge has expired' do
193
+ it 'returns an error' do
194
+ VCR.use_cassette 'mfa/verify_challenge_generic_expired' do
195
+ expect do
196
+ described_class.verify_challenge(
197
+ authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
198
+ code: '897792',
199
+ )
200
+ end.to raise_error(WorkOS::InvalidRequestError)
201
+ end
202
+ end
203
+ end
204
+
205
+ context 'with missing code argument' do
206
+ it 'returns an argument error' do
207
+ expect do
208
+ described_class.verify_challenge(
209
+ authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J',
210
+ )
211
+ end.to raise_error(
212
+ ArgumentError,
213
+ "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments",
194
214
  )
195
- end.to raise_error(
196
- ArgumentError,
197
- "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments",
198
- )
215
+ end
199
216
  end
200
- end
201
217
 
202
- context 'missing authentication_challenge_id argument' do
203
- it 'returns and error' do
204
- expect do
205
- described_class.verify_factor(
206
- code: '897792',
218
+ context 'with missing authentication_challenge_id argument' do
219
+ it 'returns an error' do
220
+ expect do
221
+ described_class.verify_challenge(
222
+ code: '897792',
223
+ )
224
+ end.to raise_error(
225
+ ArgumentError,
226
+ "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments",
207
227
  )
208
- end.to raise_error(
209
- ArgumentError,
210
- "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments",
211
- )
228
+ end
212
229
  end
213
- end
214
230
 
215
- context 'missing code and authentication_challenge_id arguments' do
216
- it 'returns argument error' do
217
- expect do
218
- described_class.verify_factor
219
- end.to raise_error(
220
- ArgumentError,
221
- "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments",
222
- )
231
+ context 'with missing code and authentication_challenge_id arguments' do
232
+ it 'returns an argument error' do
233
+ expect do
234
+ described_class.verify_challenge
235
+ end.to raise_error(
236
+ ArgumentError,
237
+ "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments",
238
+ )
239
+ end
223
240
  end
224
241
  end
225
242
  end
226
243
 
227
- describe 'tests returning and deleting a factor' do
228
- context 'returns a factor' do
229
- it 'uses get_factor to return factor' do
244
+ describe '.get_factor' do
245
+ context 'with a valid id' do
246
+ it 'returns a factor' do
230
247
  VCR.use_cassette 'mfa/get_factor_valid' do
231
248
  factor = described_class.get_factor(
232
249
  id: 'auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M',
@@ -236,8 +253,8 @@ describe WorkOS::MFA do
236
253
  end
237
254
  end
238
255
 
239
- context 'invalid factor request' do
240
- it 'uses get_factor and throws error if id is wrong' do
256
+ context 'with an invalid id' do
257
+ it 'returns an error' do
241
258
  VCR.use_cassette 'mfa/get_factor_invalid' do
242
259
  expect do
243
260
  described_class.get_factor(
@@ -247,7 +264,9 @@ describe WorkOS::MFA do
247
264
  end
248
265
  end
249
266
  end
267
+ end
250
268
 
269
+ describe '.delete_factor' do
251
270
  context 'deletes facotr' do
252
271
  it 'uses delete_factor to delete factor' do
253
272
  VCR.use_cassette 'mfa/delete_factor' do
@@ -330,7 +330,7 @@ describe WorkOS::SSO do
330
330
  let(:request_body) do
331
331
  {
332
332
  client_id: args[:client_id],
333
- client_secret: WorkOS.key,
333
+ client_secret: WorkOS.config.key,
334
334
  code: args[:code],
335
335
  grant_type: 'authorization_code',
336
336
  }
data/spec/spec_helper.rb CHANGED
@@ -25,7 +25,7 @@ SPEC_ROOT = File.dirname __FILE__
25
25
 
26
26
  VCR.configure do |config|
27
27
  config.cassette_library_dir = 'spec/support/fixtures/vcr_cassettes'
28
- config.filter_sensitive_data('<API_KEY>') { WorkOS.key }
28
+ config.filter_sensitive_data('<API_KEY>') { WorkOS.config.key }
29
29
  config.hook_into :webmock
30
30
  end
31
31
 
@@ -51,6 +51,6 @@ RSpec.configure do |config|
51
51
  end
52
52
  end)
53
53
 
54
- config.before(:all) { WorkOS.key ||= '' }
54
+ config.before(:all) { WorkOS.config.key ||= '' }
55
55
  config.before(:each) { VCR.turn_on! }
56
56
  end
@@ -14,7 +14,7 @@ http_interactions:
14
14
  Accept:
15
15
  - "*/*"
16
16
  User-Agent:
17
- - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1
17
+ - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0
18
18
  Authorization:
19
19
  - Bearer <API_KEY>
20
20
  response:
@@ -23,7 +23,7 @@ http_interactions:
23
23
  message: OK
24
24
  headers:
25
25
  Date:
26
- - Tue, 07 Jun 2022 22:28:37 GMT
26
+ - Thu, 14 Jul 2022 16:49:09 GMT
27
27
  Content-Type:
28
28
  - application/json; charset=utf-8
29
29
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
38
38
  ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
39
39
  Etag:
40
- - W/"244-4TugYfq6OLpdb2GYu9NN0Z83S0g"
40
+ - W/"277-8j8DgAIILf/mCF7LCmvrqcqdwK4"
41
41
  Expect-Ct:
42
42
  - max-age=0
43
43
  Referrer-Policy:
@@ -47,7 +47,7 @@ http_interactions:
47
47
  Vary:
48
48
  - Origin, Accept-Encoding
49
49
  Via:
50
- - 1.1 spaces-router (664a92218d61)
50
+ - 1.1 spaces-router (b642bf20b975)
51
51
  X-Content-Type-Options:
52
52
  - nosniff
53
53
  X-Dns-Prefetch-Control:
@@ -59,24 +59,22 @@ http_interactions:
59
59
  X-Permitted-Cross-Domain-Policies:
60
60
  - none
61
61
  X-Request-Id:
62
- - 4a7bfd77-da6c-b1ae-bc39-35a1c175ecf2
62
+ - 0f21c2f3-e24a-e3a2-85d3-41ee9e45b3e2
63
63
  X-Xss-Protection:
64
64
  - '0'
65
65
  Cf-Cache-Status:
66
66
  - DYNAMIC
67
67
  Report-To:
68
- - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=9nQ%2FpfKZE%2BT1W4WrbQGusRS%2FxZHEG7sB0Ps3PUXt4lmPSmC%2FZHLV6KW90D74Y9VQ0QT7q3OIF47yVIwX5fwPKOHMwcOYQv0eyKUrFYxKkNf6QALpJE7%2BVNSUBiEmv3cZ1zOXUFCiuMl2MYygsw%3D%3D"}],"group":"cf-nel","max_age":604800}'
68
+ - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=Hnm%2BEiBTG2ROFxqX2mdwcp0HvQ173SgQlQDCmTmBQEbLv9w2dkcl2qMqYh44OSHRABBCkRfuJ2MtnHuqb6sQ5RjHRMKSCfRqklsOrgd%2FHo0PEE6mW0u%2BlZqBMIlN1BEp"}],"group":"cf-nel","max_age":604800}'
69
69
  Nel:
70
70
  - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
71
71
  Server:
72
72
  - cloudflare
73
73
  Cf-Ray:
74
- - 717cd26458fd671d-DFW
75
- Alt-Svc:
76
- - h3=":443"; ma=86400, h3-29=":443"; ma=86400
74
+ - 72abc002fbd9f039-EWR
77
75
  body:
78
76
  encoding: ASCII-8BIT
79
- string: '{"object":"directory_group","id":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","idp_id":"01jlao4614two3d","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sales","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"01jlao4614two3d","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/uLYJ0Hrx1gXXVg9z-zGLBZET2Wo\"","kind":"admin#directory#group","name":"Sales","email":"sales@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sales@foo-corp.com.test-google-a.com"]}}'
80
- http_version:
81
- recorded_at: Tue, 07 Jun 2022 22:28:37 GMT
77
+ string: '{"object":"directory_group","id":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","idp_id":"01jlao4614two3d","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","organization_id":"org_01EGS4P7QR31EZ4YWD1Z1XA176","name":"Sales","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z","raw_attributes":{"id":"01jlao4614two3d","etag":"\"SEQQBYC70u6XQ2UUjmjNYw6b0a5EzY0mTMShjiZga8A/uLYJ0Hrx1gXXVg9z-zGLBZET2Wo\"","kind":"admin#directory#group","name":"Sales","email":"sales@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sales@foo-corp.com.test-google-a.com"]}}'
78
+ http_version:
79
+ recorded_at: Thu, 14 Jul 2022 16:49:09 GMT
82
80
  recorded_with: VCR 5.0.0
@@ -14,7 +14,7 @@ http_interactions:
14
14
  Accept:
15
15
  - "*/*"
16
16
  User-Agent:
17
- - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0
17
+ - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0
18
18
  Authorization:
19
19
  - Bearer <API_KEY>
20
20
  response:
@@ -23,64 +23,61 @@ http_interactions:
23
23
  message: OK
24
24
  headers:
25
25
  Date:
26
- - Mon, 09 Aug 2021 17:36:13 GMT
26
+ - Thu, 14 Jul 2022 16:46:23 GMT
27
27
  Content-Type:
28
28
  - application/json; charset=utf-8
29
- Transfer-Encoding:
30
- - chunked
29
+ Content-Length:
30
+ - '616'
31
31
  Connection:
32
32
  - keep-alive
33
- Vary:
34
- - Origin, Accept-Encoding
35
33
  Access-Control-Allow-Credentials:
36
34
  - 'true'
37
35
  Content-Security-Policy:
38
36
  - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
39
37
  https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
40
38
  ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
41
- X-Dns-Prefetch-Control:
42
- - 'off'
39
+ Etag:
40
+ - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw"
43
41
  Expect-Ct:
44
42
  - max-age=0
45
- X-Frame-Options:
46
- - SAMEORIGIN
43
+ Referrer-Policy:
44
+ - no-referrer
47
45
  Strict-Transport-Security:
48
46
  - max-age=15552000; includeSubDomains
49
- X-Download-Options:
50
- - noopen
47
+ Vary:
48
+ - Origin, Accept-Encoding
49
+ Via:
50
+ - 1.1 spaces-router (b642bf20b975)
51
51
  X-Content-Type-Options:
52
52
  - nosniff
53
+ X-Dns-Prefetch-Control:
54
+ - 'off'
55
+ X-Download-Options:
56
+ - noopen
57
+ X-Frame-Options:
58
+ - SAMEORIGIN
53
59
  X-Permitted-Cross-Domain-Policies:
54
60
  - none
55
- Referrer-Policy:
56
- - no-referrer
61
+ X-Request-Id:
62
+ - 51a82273-b413-cead-b968-c07ba4d6fd08
57
63
  X-Xss-Protection:
58
64
  - '0'
59
- X-Request-Id:
60
- - 59862449-73e5-4dfd-93ab-3764b1917801
61
- Etag:
62
- - W/"4c3-Ikxt2N0fUuSxCjv+RdYvW8W9Xwo"
63
- Via:
64
- - 1.1 vegur
65
65
  Cf-Cache-Status:
66
66
  - DYNAMIC
67
67
  Report-To:
68
- - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=m6%2FJ3BJ75VMwSOtfDQXjt%2FoL29FI%2Bv5VswhZzg6LVkOQi7nyI19Sks%2FkDGCDrSQ%2FMtyU6DI4OFWR9RB1I04IGdhehsY2oPGugIj%2BhHMiJdQEcE6vPAsuaF1HyVnXGvMgRYdurEW1Jr7rSYBWeA%3D%3D"}],"group":"cf-nel","max_age":604800}'
68
+ - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}'
69
69
  Nel:
70
70
  - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
71
71
  Server:
72
72
  - cloudflare
73
73
  Cf-Ray:
74
- - 67c2bed0ebe6c7e6-DFW
75
- Alt-Svc:
76
- - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443";
77
- ma=86400
74
+ - 72abbbf2b93e8ca5-EWR
78
75
  body:
79
76
  encoding: ASCII-8BIT
80
- string: '{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}],"first_name":"Logan","last_name":"Gingerich","state":"active","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Logan
81
- Paul Gingerich","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Gingerich","createdAt":"2021-05-05T16:06:24+0000","firstName":"Logan","updatedAt":"2021-07-19T19:17:52+0000","workEmail":"logan@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{"department":"Infra"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department
82
- - Infra","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team
83
- - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}}]}'
84
- http_version:
85
- recorded_at: Mon, 09 Aug 2021 17:36:13 GMT
77
+ string: '{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","idp_id":"6092c280a3f1e19ef6d8cef8","username":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}],"first_name":"Logan","last_name":"Gingerich","state":"active","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Logan
78
+ Paul Gingerich","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Gingerich","createdAt":"2021-05-05T16:06:24+0000","firstName":"Logan","updatedAt":"2021-11-11T05:08:14+0000","workEmail":"logan@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{},"created_at":"2021-07-19T17:57:57.268Z","updated_at":"2022-01-24T11:23:01.614Z","groups":[{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","idp_id":"5f696c8e9a63a60e965aaca8","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","name":"Team
79
+ - Platform","created_at":"2021-07-19T17:57:56.580Z","updated_at":"2022-01-24T11:23:01.333Z","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","idp_id":"5f27ada9a5e9bc0001a0ae4a","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","name":"Department
80
+ - Infra","created_at":"2021-07-19T17:57:55.893Z","updated_at":"2022-01-24T11:23:01.333Z","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}}]}'
81
+ http_version:
82
+ recorded_at: Thu, 14 Jul 2022 16:46:23 GMT
86
83
  recorded_with: VCR 5.0.0
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/challenge
5
+ uri: https://api.workos.com/auth/factors/auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M/challenge
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"sms_template":null,"authentication_factor_id":"auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M"}'
8
+ string: '{"sms_template":null}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/challenge
5
+ uri: https://api.workos.com/auth/factors/auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F/challenge
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"sms_template":"Your code is {{code}}","authentication_factor_id":"auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F"}'
8
+ string: '{"sms_template":"Your code is {{code}}"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/challenge
5
+ uri: https://api.workos.com/auth/factors/auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ/challenge
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"sms_template":null,"authentication_factor_id":"auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ"}'
8
+ string: '{"sms_template":null}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/verify
5
+ uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"authentication_challenge_id":"auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J","code":"897792"}'
8
+ string: '{"code":"897792"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/verify
5
+ uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"authentication_challenge_id":"auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J","code":"897792"}'
8
+ string: '{"code":"897792"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/verify
5
+ uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"authentication_challenge_id":"auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J","code":"897792"}'
8
+ string: '{"code":"897792"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.workos.com/auth/factors/verify
5
+ uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"authentication_challenge_id":"auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J","code":"897792"}'
8
+ string: '{"code":"897792"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -13,4 +13,18 @@ RSpec.shared_examples 'client' do
13
13
  it 'returns new instance' do
14
14
  expect(described_class.client.object_id).to_not eq described_class.client.object_id
15
15
  end
16
+
17
+ if RUBY_VERSION >= '2.6.0'
18
+ it 'sets the timeouts, including the write timeout' do
19
+ expect(described_class.client.open_timeout).to_not be_nil
20
+ expect(described_class.client.read_timeout).to_not be_nil
21
+ expect(described_class.client.write_timeout).to_not be_nil
22
+ end
23
+ else
24
+ it 'sets the open and read timeouts, but not the write timeout' do
25
+ expect(described_class.client.open_timeout).to_not be_nil
26
+ expect(described_class.client.read_timeout).to_not be_nil
27
+ expect(described_class.client.write_timeout).to be_nil
28
+ end
29
+ end
16
30
  end