workos 2.5.1 → 2.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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +13 -11
  3. data/lib/workos/audit_log_export.rb +55 -0
  4. data/lib/workos/audit_logs.rb +107 -0
  5. data/lib/workos/client.rb +2 -0
  6. data/lib/workos/errors.rb +15 -1
  7. data/lib/workos/organizations.rb +4 -1
  8. data/lib/workos/types/audit_log_export_struct.rb +17 -0
  9. data/lib/workos/types/intent_enum.rb +1 -0
  10. data/lib/workos/types.rb +1 -0
  11. data/lib/workos/version.rb +1 -1
  12. data/lib/workos/webhooks.rb +49 -2
  13. data/lib/workos.rb +2 -0
  14. data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +5 -5
  15. data/spec/lib/workos/audit_logs_spec.rb +149 -0
  16. data/spec/lib/workos/organizations_spec.rb +73 -9
  17. data/spec/lib/workos/portal_spec.rb +15 -0
  18. data/spec/lib/workos/webhooks_spec.rb +130 -84
  19. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml +59 -0
  20. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml +60 -0
  21. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml +59 -0
  22. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml +76 -0
  23. data/spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml +78 -0
  24. data/spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml +73 -0
  25. data/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml +155 -0
  26. data/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml +154 -0
  27. data/spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml +79 -0
  28. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml +72 -0
  29. data/spec/support/webhook_payload.txt +1 -1
  30. metadata +28 -3
@@ -6,16 +6,80 @@ describe WorkOS::Organizations do
6
6
 
7
7
  describe '.create_organization' do
8
8
  context 'with valid payload' do
9
- it 'creates an organization' do
10
- VCR.use_cassette 'organization/create' do
11
- organization = described_class.create_organization(
12
- domains: ['example.io'],
13
- name: 'Test Organization',
14
- )
9
+ context 'with no idempotency key' do
10
+ it 'creates an organization' do
11
+ VCR.use_cassette 'organization/create' do
12
+ organization = described_class.create_organization(
13
+ domains: ['example.io'],
14
+ name: 'Test Organization',
15
+ )
15
16
 
16
- expect(organization.id).to eq('org_01FCPEJXEZR4DSBA625YMGQT9N')
17
- expect(organization.name).to eq('Test Organization')
18
- expect(organization.domains.first[:domain]).to eq('example.io')
17
+ expect(organization.id).to eq('org_01FCPEJXEZR4DSBA625YMGQT9N')
18
+ expect(organization.name).to eq('Test Organization')
19
+ expect(organization.domains.first[:domain]).to eq('example.io')
20
+ end
21
+ end
22
+ end
23
+
24
+ context 'with idempotency key' do
25
+ context 'when idempotency key is used once' do
26
+ it 'creates an organization' do
27
+ VCR.use_cassette 'organization/create_with_idempotency_key' do
28
+ organization = described_class.create_organization(
29
+ domains: ['example.io'],
30
+ name: 'Test Organization',
31
+ idempotency_key: 'key',
32
+ )
33
+
34
+ expect(organization.name).to eq('Test Organization')
35
+ expect(organization.domains.first[:domain]).to eq('example.io')
36
+ end
37
+ end
38
+ end
39
+
40
+ context 'when idempotency key is used more than once' do
41
+ context 'with duplicate event payloads' do
42
+ it 'returns the already created organization' do
43
+ VCR.use_cassette 'organization/create_with_duplicate_idempotency_key_and_payload' do
44
+ organization1 = described_class.create_organization(
45
+ domains: ['example.com'],
46
+ name: 'Test Organization',
47
+ idempotency_key: 'foo',
48
+ )
49
+
50
+ organization2 = described_class.create_organization(
51
+ domains: ['example.com'],
52
+ name: 'Test Organization',
53
+ idempotency_key: 'foo',
54
+ )
55
+
56
+ expect(organization1.id).to eq(organization2.id)
57
+ end
58
+ end
59
+ end
60
+
61
+ context 'with different event payloads' do
62
+ it 'raises an error' do
63
+ VCR.use_cassette 'organization/create_with_duplicate_idempotency_key_and_different_payload' do
64
+ described_class.create_organization(
65
+ domains: ['example.me'],
66
+ name: 'Test Organization',
67
+ idempotency_key: 'bar',
68
+ )
69
+
70
+ expect do
71
+ described_class.create_organization(
72
+ domains: ['example.me'],
73
+ name: 'Organization Test',
74
+ idempotency_key: 'bar',
75
+ )
76
+ end.to raise_error(
77
+ WorkOS::InvalidRequestError,
78
+ /Status 400, Another idempotency key \(bar\) with different request parameters was found. Please use a different idempotency key./,
79
+ )
80
+ end
81
+ end
82
+ end
19
83
  end
20
84
  end
21
85
  end
@@ -37,6 +37,21 @@ describe WorkOS::Portal do
37
37
  end
38
38
  end
39
39
  end
40
+
41
+ describe 'with the audit_logs intent' do
42
+ it 'returns an Admin Portal link' do
43
+ VCR.use_cassette 'portal/generate_link_audit_logs', match_requests_on: %i[path body] do
44
+ portal_link = described_class.generate_link(
45
+ intent: 'audit_logs',
46
+ organization: organization,
47
+ )
48
+
49
+ expect(portal_link).to eq(
50
+ 'https://id.workos.com/portal/launch?secret=secret',
51
+ )
52
+ end
53
+ end
54
+ end
40
55
  end
41
56
 
42
57
  describe 'with an invalid organization' do
@@ -5,98 +5,70 @@ require 'json'
5
5
  require 'openssl'
6
6
 
7
7
  describe WorkOS::Webhooks do
8
- describe '.construct_event' do
9
- before(:each) do
10
- @payload = File.read("#{SPEC_ROOT}/support/webhook_payload.txt")
11
- @secret = 'secret'
12
- @timestamp = Time.at(Time.now.to_i * 1000)
13
- unhashed_string = "#{@timestamp.to_i}.#{@payload}"
14
- digest = OpenSSL::Digest.new('sha256')
15
- @signature_hash = OpenSSL::HMAC.hexdigest(digest, @secret, unhashed_string)
16
- @expectation = {
17
- id: 'directory_user_01FAEAJCR3ZBZ30D8BD1924TVG',
18
- state: 'active',
8
+ before(:each) do
9
+ @payload = File.read("#{SPEC_ROOT}/support/webhook_payload.txt")
10
+ @secret = 'secret'
11
+ @timestamp = Time.at(Time.now.to_i * 1000)
12
+ unhashed_string = "#{@timestamp.to_i}.#{@payload}"
13
+ digest = OpenSSL::Digest.new('sha256')
14
+ @signature_hash = OpenSSL::HMAC.hexdigest(digest, @secret, unhashed_string)
15
+ @expectation = {
16
+ id: 'directory_user_01FAEAJCR3ZBZ30D8BD1924TVG',
17
+ state: 'active',
18
+ emails: [{
19
+ type: 'work',
20
+ value: 'blair@foo-corp.com',
21
+ primary: true,
22
+ }],
23
+ idp_id: '00u1e8mutl6wlH3lL4x7',
24
+ object: 'directory_user',
25
+ username: 'blair@foo-corp.com',
26
+ last_name: 'Lunchford',
27
+ first_name: 'Blair',
28
+ directory_id: 'directory_01F9M7F68PZP8QXP8G7X5QRHS7',
29
+ raw_attributes: {
30
+ name: {
31
+ givenName: 'Blair',
32
+ familyName: 'Lunchford',
33
+ middleName: 'Elizabeth',
34
+ honorificPrefix: 'Ms.',
35
+ },
36
+ title: 'Developer Success Engineer',
37
+ active: true,
19
38
  emails: [{
20
39
  type: 'work',
21
40
  value: 'blair@foo-corp.com',
22
41
  primary: true,
23
42
  }],
24
- idp_id: '00u1e8mutl6wlH3lL4x7',
25
- object: 'directory_user',
26
- username: 'blair@foo-corp.com',
27
- last_name: 'Lunceford',
28
- first_name: 'Blair',
29
- directory_id: 'directory_01F9M7F68PZP8QXP8G7X5QRHS7',
30
- raw_attributes: {
31
- name: {
32
- givenName: 'Blair',
33
- familyName: 'Lunceford',
34
- middleName: 'Elizabeth',
35
- honorificPrefix: 'Ms.',
36
- },
37
- title: 'Developer Success Engineer',
38
- active: true,
39
- emails: [{
40
- type: 'work',
41
- value: 'blair@foo-corp.com',
42
- primary: true,
43
- }],
44
- groups: [],
45
- locale: 'en-US',
46
- schemas: [
47
- 'urn:ietf:params:scim:schemas:core:2.0:User',
48
- 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'
49
- ],
50
- userName: 'blair@foo-corp.com',
51
- addresses: [{
52
- region: 'CO',
53
- primary: true,
54
- locality: 'Steamboat Springs',
55
- postalCode: '80487',
56
- }],
57
- externalId: '00u1e8mutl6wlH3lL4x7',
58
- displayName: 'Blair Lunceford',
59
- "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
60
- manager: {
61
- value: '2',
62
- displayName: 'Kathleen Chung',
63
- },
64
- division: 'Engineering',
65
- department: 'Customer Success',
43
+ groups: [],
44
+ locale: 'en-US',
45
+ schemas: [
46
+ 'urn:ietf:params:scim:schemas:core:2.0:User',
47
+ 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'
48
+ ],
49
+ userName: 'blair@foo-corp.com',
50
+ addresses: [{
51
+ region: 'CA',
52
+ primary: true,
53
+ locality: 'San Francisco',
54
+ postalCode: '94016',
55
+ }],
56
+ externalId: '00u1e8mutl6wlH3lL4x7',
57
+ displayName: 'Blair Lunchford',
58
+ "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
59
+ manager: {
60
+ value: '2',
61
+ displayName: 'Kate Chapman',
66
62
  },
63
+ division: 'Engineering',
64
+ department: 'Customer Success',
67
65
  },
68
- }
69
- end
70
-
71
- context 'with the correct payload, sig_header, and secret' do
72
- it 'returns a webhook event' do
73
- webhook = described_class.construct_event(
74
- payload: @payload,
75
- sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}",
76
- secret: @secret,
77
- )
78
-
79
- expect(webhook.data).to eq(@expectation)
80
- expect(webhook.event).to eq('dsync.user.created')
81
- expect(webhook.id).to eq('wh_123')
82
- end
83
- end
84
-
85
- context 'with the correct payload, sig_header, secret, and tolerance' do
86
- it 'returns a webhook event' do
87
- webhook = described_class.construct_event(
88
- payload: @payload,
89
- sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}",
90
- secret: @secret,
91
- tolerance: 300,
92
- )
93
-
94
- expect(webhook.data).to eq(@expectation)
95
- expect(webhook.event).to eq('dsync.user.created')
96
- expect(webhook.id).to eq('wh_123')
97
- end
98
- end
66
+ },
67
+ }
68
+ end
99
69
 
70
+ # rubocop:disable Metrics/BlockLength
71
+ shared_examples 'WorkOS-Signature header failures' do
100
72
  context 'with an empty header' do
101
73
  it 'raises an error' do
102
74
  expect do
@@ -187,4 +159,78 @@ describe WorkOS::Webhooks do
187
159
  end
188
160
  end
189
161
  end
162
+ # rubocop:enable Metrics/BlockLength
163
+
164
+ describe '.construct_event' do
165
+ it_behaves_like 'WorkOS-Signature header failures'
166
+
167
+ context 'with the correct payload, sig_header, and secret' do
168
+ it 'returns a webhook event' do
169
+ webhook = described_class.construct_event(
170
+ payload: @payload,
171
+ sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}",
172
+ secret: @secret,
173
+ )
174
+
175
+ expect(webhook.data).to eq(@expectation)
176
+ expect(webhook.event).to eq('dsync.user.created')
177
+ expect(webhook.id).to eq('wh_123')
178
+ end
179
+ end
180
+
181
+ context 'with the correct payload, sig_header, secret, and tolerance' do
182
+ it 'returns a webhook event' do
183
+ webhook = described_class.construct_event(
184
+ payload: @payload,
185
+ sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}",
186
+ secret: @secret,
187
+ tolerance: 300,
188
+ )
189
+
190
+ expect(webhook.data).to eq(@expectation)
191
+ expect(webhook.event).to eq('dsync.user.created')
192
+ expect(webhook.id).to eq('wh_123')
193
+ end
194
+ end
195
+ end
196
+
197
+ describe '.verify_header' do
198
+ it_behaves_like 'WorkOS-Signature header failures'
199
+
200
+ it 'returns true when the signature is valid' do
201
+ described_class.verify_header(
202
+ payload: @payload,
203
+ sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}",
204
+ secret: @secret,
205
+ )
206
+ end
207
+ end
208
+
209
+ describe '.get_timestamp_and_signature_hash' do
210
+ it_behaves_like 'WorkOS-Signature header failures'
211
+
212
+ it 'returns the timestamp and signature when the signature is valid' do
213
+ timestamp_int = @timestamp.to_i
214
+ timestamp_and_signature = described_class.get_timestamp_and_signature_hash(
215
+ sig_header: "t=#{timestamp_int}, v1=#{@signature_hash}",
216
+ )
217
+
218
+ expect(timestamp_and_signature).to eq([timestamp_int.to_s, @signature_hash])
219
+ end
220
+ end
221
+
222
+ describe '.compute_signature' do
223
+ it_behaves_like 'WorkOS-Signature header failures'
224
+
225
+ it 'returns the computed signature' do
226
+ timestamp_int = @timestamp.to_i
227
+ signature = described_class.compute_signature(
228
+ timestamp: timestamp_int.to_s,
229
+ payload: @payload,
230
+ secret: @secret,
231
+ )
232
+
233
+ expect(signature).to eq(@signature_hash)
234
+ end
235
+ end
190
236
  end
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/audit_logs/events
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"organization_id":"org_123","event":{"action":"user.signed_in","occurred_at":"2022-08-22T15:04:19.704Z","actor":{"id":"user_123","type":"user","name":"User","metadata":{"foo":"bar"}},"targets":[{"id":"team_123","type":"team","name":"Team","metadata":{"foo":"bar"}}],"context":{"location":"1.1.1.1","user_agent":"Mozilla"}}}'
9
+ headers:
10
+ Content-Type: "application/json"
11
+ Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
12
+ Accept: "*/*"
13
+ User-Agent: "WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1"
14
+ Authorization: "Bearer example_api_key"
15
+ response:
16
+ status:
17
+ code: 201
18
+ message: Created
19
+ headers:
20
+ Server:
21
+ - Cowboy
22
+ Connection:
23
+ - keep-alive
24
+ Access-Control-Allow-Origin:
25
+ - https://dashboard.workos.com
26
+ Vary:
27
+ - Origin, Accept-Encoding
28
+ Access-Control-Allow-Credentials:
29
+ - "true"
30
+ X-Dns-Prefetch-Control:
31
+ - "off"
32
+ X-Frame-Options:
33
+ - SAMEORIGIN
34
+ Strict-Transport-Security:
35
+ - max-age=15552000; includeSubDomains
36
+ X-Download-Options:
37
+ - noopen
38
+ X-Content-Type-Options:
39
+ - nosniff
40
+ X-Xss-Protection:
41
+ - 1; mode=block
42
+ X-Request-Id:
43
+ - 1cf9b8e7-5910-4a6d-a333-46bcf841422e
44
+ Content-Type:
45
+ - application/json; charset=utf-8
46
+ Content-Length:
47
+ - "16"
48
+ Etag:
49
+ - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA"
50
+ Date:
51
+ - Sat, 11 Jan 2020 04:22:48 GMT
52
+ Via:
53
+ - 1.1 vegur
54
+ body:
55
+ encoding: UTF-8
56
+ string: '{"success":true}'
57
+ http_version:
58
+ recorded_at: Sat, 11 Jan 2020 04:22:48 GMT
59
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/audit_logs/events
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"organization_id":"org_123","event":{"action":"user.signed_in","occurred_at":"2022-08-22T15:04:19.704Z","actor":{"id":"user_123","type":"user","name":"User","metadata":{"foo":"bar"}},"targets":[{"id":"team_123","type":"team","name":"Team","metadata":{"foo":"bar"}}],"context":{"location":"1.1.1.1","user_agent":"Mozilla"}}}'
9
+ headers:
10
+ Content-Type: "application/json"
11
+ Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
12
+ Accept: "*/*"
13
+ User-Agent: "WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1"
14
+ Authorization: "Bearer example_api_key"
15
+ Idempotency-Key: "idempotency_key"
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - Cowboy
23
+ Connection:
24
+ - keep-alive
25
+ Access-Control-Allow-Origin:
26
+ - https://dashboard.workos.com
27
+ Vary:
28
+ - Origin, Accept-Encoding
29
+ Access-Control-Allow-Credentials:
30
+ - "true"
31
+ X-Dns-Prefetch-Control:
32
+ - "off"
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ Strict-Transport-Security:
36
+ - max-age=15552000; includeSubDomains
37
+ X-Download-Options:
38
+ - noopen
39
+ X-Content-Type-Options:
40
+ - nosniff
41
+ X-Xss-Protection:
42
+ - 1; mode=block
43
+ X-Request-Id:
44
+ - 1cf9b8e7-5910-4a6d-a333-46bcf841422e
45
+ Content-Type:
46
+ - application/json; charset=utf-8
47
+ Content-Length:
48
+ - "16"
49
+ Etag:
50
+ - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA"
51
+ Date:
52
+ - Sat, 11 Jan 2020 04:22:48 GMT
53
+ Via:
54
+ - 1.1 vegur
55
+ body:
56
+ encoding: UTF-8
57
+ string: '{"success":true}'
58
+ http_version:
59
+ recorded_at: Sat, 11 Jan 2020 04:22:48 GMT
60
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/audit_logs/events
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"organization_id":"org_123","event":{"action":"user.signed_in","occurred_at":"2022-08-22T15:04:19.704Z","actor":{"id":"user_123","type":"user","name":"User","metadata":{"foo":"bar"}},"targets":[{"id":"team_123","type":"team","name":"Team","metadata":{"foo":"bar"}}],"context":{"location":"1.1.1.1","user_agent":"Mozilla"}}}'
9
+ headers:
10
+ Content-Type: "application/json"
11
+ Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
12
+ Accept: "*/*"
13
+ User-Agent: "WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1"
14
+ Authorization: "Bearer example_api_key"
15
+ response:
16
+ status:
17
+ code: 400
18
+ message: Bad Request
19
+ headers:
20
+ Server:
21
+ - Cowboy
22
+ Connection:
23
+ - keep-alive
24
+ Access-Control-Allow-Origin:
25
+ - https://dashboard.workos.com
26
+ Vary:
27
+ - Origin, Accept-Encoding
28
+ Access-Control-Allow-Credentials:
29
+ - "true"
30
+ X-Dns-Prefetch-Control:
31
+ - "off"
32
+ X-Frame-Options:
33
+ - SAMEORIGIN
34
+ Strict-Transport-Security:
35
+ - max-age=15552000; includeSubDomains
36
+ X-Download-Options:
37
+ - noopen
38
+ X-Content-Type-Options:
39
+ - nosniff
40
+ X-Xss-Protection:
41
+ - 1; mode=block
42
+ X-Request-Id:
43
+ - 1cf9b8e7-5910-4a6d-a333-46bcf841422e
44
+ Content-Type:
45
+ - application/json; charset=utf-8
46
+ Content-Length:
47
+ - "16"
48
+ Etag:
49
+ - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA"
50
+ Date:
51
+ - Sat, 11 Jan 2020 04:22:48 GMT
52
+ Via:
53
+ - 1.1 vegur
54
+ body:
55
+ encoding: UTF-8
56
+ string: '{"code":"invalid_audit_log","message":"Invalid Audit Log event","errors":[{"instancePath":"/targets/0/type","schemaPath":"#/properties/targets/allOf/0/contains/properties/type/const","keyword":"const","params":{"allowValues":["team"]},"message":"must be equal to constant","schema":"team","parentSchema":{"enum":["team"],"type":"string"},"data":"user"}]}'
57
+ http_version:
58
+ recorded_at: Sat, 11 Jan 2020 04:22:48 GMT
59
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/audit_logs/exports
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"organization_id":"org_123","range_start":"2022-06-22T15:04:19.704Z","range_end":"2022-08-22T15:04:19.704Z"}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1
18
+ Authorization:
19
+ - "Bearer example_api_key"
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Date:
26
+ - Mon, 22 Aug 2022 17:47:49 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - "26"
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 73ed6f92c9161847-ATL
35
+ Etag:
36
+ - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw"
37
+ Strict-Transport-Security:
38
+ - max-age=15552000; includeSubDomains
39
+ Vary:
40
+ - Origin, Accept-Encoding
41
+ Via:
42
+ - 1.1 spaces-router (a302eeabfffb)
43
+ Cf-Cache-Status:
44
+ - DYNAMIC
45
+ Access-Control-Allow-Credentials:
46
+ - "true"
47
+ Content-Security-Policy:
48
+ - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self'
49
+ https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src
50
+ 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
51
+ Expect-Ct:
52
+ - max-age=0
53
+ Referrer-Policy:
54
+ - no-referrer
55
+ X-Content-Type-Options:
56
+ - nosniff
57
+ X-Dns-Prefetch-Control:
58
+ - "off"
59
+ X-Download-Options:
60
+ - noopen
61
+ X-Frame-Options:
62
+ - SAMEORIGIN
63
+ X-Permitted-Cross-Domain-Policies:
64
+ - none
65
+ X-Request-Id:
66
+ - eb09b349-08f4-b79b-ccb2-87fa4609c1ee
67
+ X-Xss-Protection:
68
+ - "0"
69
+ Server:
70
+ - cloudflare
71
+ body:
72
+ encoding: UTF-8
73
+ string: '{"object":"audit_log_export","id":"audit_log_export_123","state":"pending","created_at":"2022-08-22T15:04:19.704Z","updated_at":"2022-08-22T15:04:19.704Z"}'
74
+ http_version:
75
+ recorded_at: Mon, 22 Aug 2022 17:47:49 GMT
76
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,78 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/audit_logs/exports
6
+ body:
7
+ encoding: UTF-8
8
+ string:
9
+ '{"organization_id":"org_123","range_start":"2022-06-22T15:04:19.704Z","range_end":"2022-08-22T15:04:19.704Z","actions":["user.signed_in"],"actors":["Jon
10
+ Smith"],"targets":["user","team"]}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ User-Agent:
19
+ - WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1
20
+ Authorization:
21
+ - "Bearer example_api_key"
22
+ response:
23
+ status:
24
+ code: 201
25
+ message: Created
26
+ headers:
27
+ Date:
28
+ - Mon, 22 Aug 2022 17:47:49 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - "26"
33
+ Connection:
34
+ - keep-alive
35
+ Cf-Ray:
36
+ - 73ed6f92c9161847-ATL
37
+ Etag:
38
+ - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Via:
44
+ - 1.1 spaces-router (a302eeabfffb)
45
+ Cf-Cache-Status:
46
+ - DYNAMIC
47
+ Access-Control-Allow-Credentials:
48
+ - "true"
49
+ Content-Security-Policy:
50
+ - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self'
51
+ https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src
52
+ 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
53
+ Expect-Ct:
54
+ - max-age=0
55
+ Referrer-Policy:
56
+ - no-referrer
57
+ X-Content-Type-Options:
58
+ - nosniff
59
+ X-Dns-Prefetch-Control:
60
+ - "off"
61
+ X-Download-Options:
62
+ - noopen
63
+ X-Frame-Options:
64
+ - SAMEORIGIN
65
+ X-Permitted-Cross-Domain-Policies:
66
+ - none
67
+ X-Request-Id:
68
+ - eb09b349-08f4-b79b-ccb2-87fa4609c1ee
69
+ X-Xss-Protection:
70
+ - "0"
71
+ Server:
72
+ - cloudflare
73
+ body:
74
+ encoding: UTF-8
75
+ string: '{"object":"audit_log_export","id":"audit_log_export_123","state":"pending","created_at":"2022-08-22T15:04:19.704Z","updated_at":"2022-08-22T15:04:19.704Z"}'
76
+ http_version:
77
+ recorded_at: Mon, 22 Aug 2022 17:47:49 GMT
78
+ recorded_with: VCR 5.0.0