workos 2.5.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -11
- data/lib/workos/audit_log_export.rb +55 -0
- data/lib/workos/audit_logs.rb +107 -0
- data/lib/workos/client.rb +2 -0
- data/lib/workos/errors.rb +15 -1
- data/lib/workos/organizations.rb +4 -1
- data/lib/workos/types/audit_log_export_struct.rb +17 -0
- data/lib/workos/types.rb +1 -0
- data/lib/workos/version.rb +1 -1
- data/lib/workos/webhooks.rb +49 -2
- data/lib/workos.rb +2 -0
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +5 -5
- data/spec/lib/workos/audit_logs_spec.rb +149 -0
- data/spec/lib/workos/organizations_spec.rb +73 -9
- data/spec/lib/workos/webhooks_spec.rb +130 -84
- data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml +59 -0
- data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml +60 -0
- data/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml +59 -0
- data/spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml +76 -0
- data/spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml +78 -0
- data/spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml +73 -0
- data/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml +155 -0
- data/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml +154 -0
- data/spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml +79 -0
- data/spec/support/webhook_payload.txt +1 -1
- metadata +26 -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
|
-
|
10
|
-
|
11
|
-
organization
|
12
|
-
|
13
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
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
|
@@ -5,98 +5,70 @@ require 'json'
|
|
5
5
|
require 'openssl'
|
6
6
|
|
7
7
|
describe WorkOS::Webhooks do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
value: '
|
42
|
-
|
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
|
-
|
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
|