workos 5.9.0 → 5.11.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 +2 -2
- data/lib/workos/client.rb +8 -0
- data/lib/workos/errors.rb +4 -0
- data/lib/workos/organizations.rb +26 -0
- data/lib/workos/role.rb +36 -0
- data/lib/workos/session.rb +3 -4
- data/lib/workos/user_management.rb +6 -2
- data/lib/workos/version.rb +1 -1
- data/lib/workos.rb +2 -0
- data/spec/lib/workos/organizations_spec.rb +18 -0
- data/spec/lib/workos/session_spec.rb +30 -12
- data/spec/lib/workos/user_management_spec.rb +35 -0
- data/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml +82 -0
- data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml +82 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3b8df2a135ab2c2493c5d18c0435f81facd859e396671de49f5407943abfb0b
|
4
|
+
data.tar.gz: 1aa8b210fffda9deece1478ef33d0cc85ac014e8c03bc308d6959ca6984563e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ada12739dd063caf865f32aab5db4376177b6642ada12cd7d5457cdd9a000f5cd419ca39964b3f24cc73801579c4bf8e1d8832a7cc92b2aaaf09b3fb4edf9fb
|
7
|
+
data.tar.gz: 395e87fa94cf398df6febdbbc65616613ad175a8ab624c40fb991509428481178e03ebba613913fd4d050ea62b05f21feeae05478c1efcb86004e127da893af3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
workos (5.
|
4
|
+
workos (5.11.0)
|
5
5
|
encryptor (~> 3.0)
|
6
6
|
jwt (~> 2.8)
|
7
7
|
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
diff-lcs (1.5.1)
|
20
20
|
encryptor (3.0.0)
|
21
21
|
hashdiff (1.1.0)
|
22
|
-
jwt (2.
|
22
|
+
jwt (2.10.1)
|
23
23
|
base64
|
24
24
|
parallel (1.24.0)
|
25
25
|
parser (3.3.0.5)
|
data/lib/workos/client.rb
CHANGED
@@ -109,6 +109,14 @@ module WorkOS
|
|
109
109
|
http_status: http_status,
|
110
110
|
request_id: response['x-request-id'],
|
111
111
|
)
|
112
|
+
when 403
|
113
|
+
raise ForbiddenRequestError.new(
|
114
|
+
message: json['message'],
|
115
|
+
http_status: http_status,
|
116
|
+
request_id: response['x-request-id'],
|
117
|
+
code: json['code'],
|
118
|
+
data: json,
|
119
|
+
)
|
112
120
|
when 404
|
113
121
|
raise NotFoundError.new(
|
114
122
|
message: json['message'],
|
data/lib/workos/errors.rb
CHANGED
@@ -64,6 +64,10 @@ module WorkOS
|
|
64
64
|
# parameters.
|
65
65
|
class InvalidRequestError < WorkOSError; end
|
66
66
|
|
67
|
+
# ForbiddenError is raised when a request is forbidden, likely due to missing a step
|
68
|
+
# (i.e. verifying email ownership before authenticating).
|
69
|
+
class ForbiddenRequestError < WorkOSError; end
|
70
|
+
|
67
71
|
# SignatureVerificationError is raised when the signature verification for a
|
68
72
|
# webhook fails
|
69
73
|
class SignatureVerificationError < WorkOSError; end
|
data/lib/workos/organizations.rb
CHANGED
@@ -180,6 +180,32 @@ module WorkOS
|
|
180
180
|
response.is_a? Net::HTTPSuccess
|
181
181
|
end
|
182
182
|
|
183
|
+
# Retrieve a list of roles for the given organization.
|
184
|
+
#
|
185
|
+
# @param [String] organizationId The ID of the organization to fetch roles for.
|
186
|
+
def list_organization_roles(organization_id:)
|
187
|
+
response = execute_request(
|
188
|
+
request: get_request(
|
189
|
+
path: "/organizations/#{organization_id}/roles",
|
190
|
+
auth: true,
|
191
|
+
),
|
192
|
+
)
|
193
|
+
|
194
|
+
parsed_response = JSON.parse(response.body)
|
195
|
+
|
196
|
+
roles = parsed_response['data'].map do |role|
|
197
|
+
WorkOS::Role.new(role.to_json)
|
198
|
+
end
|
199
|
+
|
200
|
+
WorkOS::Types::ListStruct.new(
|
201
|
+
data: roles,
|
202
|
+
list_metadata: {
|
203
|
+
after: nil,
|
204
|
+
before: nil,
|
205
|
+
},
|
206
|
+
)
|
207
|
+
end
|
208
|
+
|
183
209
|
private
|
184
210
|
|
185
211
|
def check_and_raise_organization_error(response:)
|
data/lib/workos/role.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WorkOS
|
4
|
+
# The Role class provides a lightweight wrapper around
|
5
|
+
# a WorkOS Role resource. This class is not meant to be instantiated
|
6
|
+
# in user space, and is instantiated internally but exposed.
|
7
|
+
class Role
|
8
|
+
include HashProvider
|
9
|
+
|
10
|
+
attr_accessor :id, :name, :slug, :description, :type, :created_at, :updated_at
|
11
|
+
|
12
|
+
def initialize(json)
|
13
|
+
hash = JSON.parse(json, symbolize_names: true)
|
14
|
+
|
15
|
+
@id = hash[:id]
|
16
|
+
@name = hash[:name]
|
17
|
+
@slug = hash[:slug]
|
18
|
+
@description = hash[:description]
|
19
|
+
@type = hash[:type]
|
20
|
+
@created_at = hash[:created_at]
|
21
|
+
@updated_at = hash[:updated_at]
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_json(*)
|
25
|
+
{
|
26
|
+
id: id,
|
27
|
+
name: name,
|
28
|
+
slug: slug,
|
29
|
+
description: description,
|
30
|
+
type: type,
|
31
|
+
created_at: created_at,
|
32
|
+
updated_at: updated_at,
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/workos/session.rb
CHANGED
@@ -101,18 +101,17 @@ module WorkOS
|
|
101
101
|
# rubocop:enable Metrics/PerceivedComplexity
|
102
102
|
|
103
103
|
# Returns a URL to redirect the user to for logging out
|
104
|
+
# @param return_to [String] The URL to redirect the user to after logging out
|
104
105
|
# @return [String] The URL to redirect the user to for logging out
|
105
|
-
|
106
|
-
def get_logout_url
|
106
|
+
def get_logout_url(return_to: nil)
|
107
107
|
auth_response = authenticate
|
108
108
|
|
109
109
|
unless auth_response[:authenticated]
|
110
110
|
raise "Failed to extract session ID for logout URL: #{auth_response[:reason]}"
|
111
111
|
end
|
112
112
|
|
113
|
-
@user_management.get_logout_url(session_id: auth_response[:session_id])
|
113
|
+
@user_management.get_logout_url(session_id: auth_response[:session_id], return_to: return_to)
|
114
114
|
end
|
115
|
-
# rubocop:enable Naming/AccessorMethodName
|
116
115
|
|
117
116
|
# Encrypts and seals data using AES-256-GCM
|
118
117
|
# @param data [Hash] The data to seal
|
@@ -530,13 +530,17 @@ module WorkOS
|
|
530
530
|
#
|
531
531
|
# @param [String] session_id The session ID can be found in the `sid`
|
532
532
|
# claim of the access token
|
533
|
+
# @param [String] return_to The URL to redirect the user to after logging out
|
533
534
|
#
|
534
535
|
# @return String
|
535
|
-
def get_logout_url(session_id:)
|
536
|
+
def get_logout_url(session_id:, return_to: nil)
|
537
|
+
params = { session_id: session_id }
|
538
|
+
params[:return_to] = return_to if return_to
|
539
|
+
|
536
540
|
URI::HTTPS.build(
|
537
541
|
host: WorkOS.config.api_hostname,
|
538
542
|
path: '/user_management/sessions/logout',
|
539
|
-
query:
|
543
|
+
query: URI.encode_www_form(params),
|
540
544
|
).to_s
|
541
545
|
end
|
542
546
|
|
data/lib/workos/version.rb
CHANGED
data/lib/workos.rb
CHANGED
@@ -71,6 +71,7 @@ module WorkOS
|
|
71
71
|
autoload :Profile, 'workos/profile'
|
72
72
|
autoload :ProfileAndToken, 'workos/profile_and_token'
|
73
73
|
autoload :RefreshAuthenticationResponse, 'workos/refresh_authentication_response'
|
74
|
+
autoload :Role, 'workos/role'
|
74
75
|
autoload :Session, 'workos/session'
|
75
76
|
autoload :SSO, 'workos/sso'
|
76
77
|
autoload :Types, 'workos/types'
|
@@ -87,6 +88,7 @@ module WorkOS
|
|
87
88
|
autoload :APIError, 'workos/errors'
|
88
89
|
autoload :AuthenticationError, 'workos/errors'
|
89
90
|
autoload :InvalidRequestError, 'workos/errors'
|
91
|
+
autoload :ForbiddenRequestError, 'workos/errors'
|
90
92
|
autoload :SignatureVerificationError, 'workos/errors'
|
91
93
|
autoload :TimeoutError, 'workos/errors'
|
92
94
|
autoload :NotFoundError, 'workos/errors'
|
@@ -323,4 +323,22 @@ describe WorkOS::Organizations do
|
|
323
323
|
end
|
324
324
|
end
|
325
325
|
end
|
326
|
+
|
327
|
+
describe '.list_organization_roles' do
|
328
|
+
context 'with no options' do
|
329
|
+
it 'returns roles for organization' do
|
330
|
+
expected_metadata = {
|
331
|
+
after: nil,
|
332
|
+
before: nil,
|
333
|
+
}
|
334
|
+
|
335
|
+
VCR.use_cassette 'organization/list_organization_roles' do
|
336
|
+
roles = described_class.list_organization_roles(organization_id: 'org_01JEXP6Z3X7HE4CB6WQSH9ZAFE')
|
337
|
+
|
338
|
+
expect(roles.data.size).to eq(7)
|
339
|
+
expect(roles.list_metadata).to eq(expected_metadata)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
326
344
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe WorkOS::Session do
|
4
|
-
let(:user_management) { instance_double('UserManagement') }
|
5
4
|
let(:client_id) { 'test_client_id' }
|
6
5
|
let(:cookie_password) { 'test_very_long_cookie_password__' }
|
7
6
|
let(:session_data) { 'test_session_data' }
|
@@ -10,11 +9,16 @@ describe WorkOS::Session do
|
|
10
9
|
let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), { kid: 'sso_oidc_key_pair_123', use: 'sig', alg: 'RS256' }) }
|
11
10
|
|
12
11
|
before do
|
13
|
-
allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url)
|
14
12
|
allow(Net::HTTP).to receive(:get).and_return(jwks_hash)
|
15
13
|
end
|
16
14
|
|
17
15
|
describe 'initialize' do
|
16
|
+
let(:user_management) { instance_double('UserManagement') }
|
17
|
+
|
18
|
+
before do
|
19
|
+
allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url)
|
20
|
+
end
|
21
|
+
|
18
22
|
it 'raises an error if cookie_password is nil or empty' do
|
19
23
|
expect do
|
20
24
|
WorkOS::Session.new(
|
@@ -52,6 +56,7 @@ describe WorkOS::Session do
|
|
52
56
|
end
|
53
57
|
|
54
58
|
describe '.authenticate' do
|
59
|
+
let(:user_management) { instance_double('UserManagement') }
|
55
60
|
let(:valid_access_token) do
|
56
61
|
payload = {
|
57
62
|
sid: 'session_id',
|
@@ -71,6 +76,10 @@ describe WorkOS::Session do
|
|
71
76
|
}, cookie_password,)
|
72
77
|
end
|
73
78
|
|
79
|
+
before do
|
80
|
+
allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url)
|
81
|
+
end
|
82
|
+
|
74
83
|
it 'returns NO_SESSION_COOKIE_PROVIDED if session_data is nil' do
|
75
84
|
session = WorkOS::Session.new(
|
76
85
|
user_management: user_management,
|
@@ -135,11 +144,13 @@ end
|
|
135
144
|
end
|
136
145
|
|
137
146
|
describe '.refresh' do
|
147
|
+
let(:user_management) { instance_double('UserManagement') }
|
138
148
|
let(:refresh_token) { 'test_refresh_token' }
|
139
149
|
let(:session_data) { WorkOS::Session.seal_data({ refresh_token: refresh_token, user: 'user' }, cookie_password) }
|
140
150
|
let(:auth_response) { double('AuthResponse', sealed_session: 'new_sealed_session') }
|
141
151
|
|
142
152
|
before do
|
153
|
+
allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url)
|
143
154
|
allow(user_management).to receive(:authenticate_with_refresh_token).and_return(auth_response)
|
144
155
|
end
|
145
156
|
|
@@ -173,26 +184,33 @@ end
|
|
173
184
|
|
174
185
|
describe '.get_logout_url' do
|
175
186
|
let(:session) do
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
187
|
+
WorkOS::Session.new(
|
188
|
+
user_management: WorkOS::UserManagement,
|
189
|
+
client_id: client_id,
|
190
|
+
session_data: session_data,
|
191
|
+
cookie_password: cookie_password,
|
192
|
+
)
|
193
|
+
end
|
183
194
|
|
184
195
|
context 'when authentication is successful' do
|
185
196
|
before do
|
186
197
|
allow(session).to receive(:authenticate).and_return({
|
187
198
|
authenticated: true,
|
188
|
-
session_id: '
|
199
|
+
session_id: 'session_123abc',
|
189
200
|
reason: nil,
|
190
201
|
})
|
191
|
-
allow(user_management).to receive(:get_logout_url).with(session_id: 'session_id').and_return('https://example.com/logout')
|
192
202
|
end
|
193
203
|
|
194
204
|
it 'returns the logout URL' do
|
195
|
-
expect(session.get_logout_url).to eq('https://
|
205
|
+
expect(session.get_logout_url).to eq('https://api.workos.com/user_management/sessions/logout?session_id=session_123abc')
|
206
|
+
end
|
207
|
+
|
208
|
+
context 'when given a return_to URL' do
|
209
|
+
it 'returns the logout URL with the return_to parameter' do
|
210
|
+
expect(session.get_logout_url(return_to: 'https://example.com/signed-out')).to eq(
|
211
|
+
'https://api.workos.com/user_management/sessions/logout?session_id=session_123abc&return_to=https%3A%2F%2Fexample.com%2Fsigned-out',
|
212
|
+
)
|
213
|
+
end
|
196
214
|
end
|
197
215
|
end
|
198
216
|
|
@@ -404,6 +404,20 @@ describe WorkOS::UserManagement do
|
|
404
404
|
end
|
405
405
|
end
|
406
406
|
end
|
407
|
+
|
408
|
+
context 'with an unverified user' do
|
409
|
+
it 'raises a ForbiddenRequestError' do
|
410
|
+
VCR.use_cassette('user_management/authenticate_with_password/unverified') do
|
411
|
+
expect do
|
412
|
+
WorkOS::UserManagement.authenticate_with_password(
|
413
|
+
email: 'unverified@workos.app',
|
414
|
+
password: '7YtYic00VWcXatPb',
|
415
|
+
client_id: 'client_123',
|
416
|
+
)
|
417
|
+
end.to raise_error(WorkOS::ForbiddenRequestError, /Email ownership must be verified before authentication/)
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
407
421
|
end
|
408
422
|
|
409
423
|
describe '.authenticate_with_code' do
|
@@ -1427,4 +1441,25 @@ describe WorkOS::UserManagement do
|
|
1427
1441
|
end
|
1428
1442
|
end
|
1429
1443
|
end
|
1444
|
+
|
1445
|
+
describe '.get_logout_url' do
|
1446
|
+
it 'returns a logout url for the given session ID' do
|
1447
|
+
result = described_class.get_logout_url(
|
1448
|
+
session_id: 'session_01HRX85ATNADY1GQ053AHRFFN6',
|
1449
|
+
)
|
1450
|
+
|
1451
|
+
expect(result).to eq 'https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6'
|
1452
|
+
end
|
1453
|
+
|
1454
|
+
context 'when a `return_to` is given' do
|
1455
|
+
it 'returns a logout url with the `return_to` query parameter' do
|
1456
|
+
result = described_class.get_logout_url(
|
1457
|
+
session_id: 'session_01HRX85ATNADY1GQ053AHRFFN6',
|
1458
|
+
return_to: 'https://example.com/signed-out',
|
1459
|
+
)
|
1460
|
+
|
1461
|
+
expect(result).to eq 'https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6&return_to=https%3A%2F%2Fexample.com%2Fsigned-out'
|
1462
|
+
end
|
1463
|
+
end
|
1464
|
+
end
|
1430
1465
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.workos.com/organizations/org_01JEXP6Z3X7HE4CB6WQSH9ZAFE/roles
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ""
|
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.3.6; arm64-darwin23; v5.9.0
|
18
|
+
Authorization:
|
19
|
+
- Bearer <API_KEY>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Mon, 23 Dec 2024 20:23:07 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Cf-Ray:
|
34
|
+
- 8f6b114e5e60c96a-IAD
|
35
|
+
Cf-Cache-Status:
|
36
|
+
- DYNAMIC
|
37
|
+
Etag:
|
38
|
+
- W/"6b6-bZ2pS5djCBrbcATBSFlbZ90PHB8"
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
Vary:
|
42
|
+
- Origin, Accept-Encoding
|
43
|
+
Access-Control-Allow-Credentials:
|
44
|
+
- "true"
|
45
|
+
Content-Security-Policy:
|
46
|
+
- "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self'
|
47
|
+
https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src
|
48
|
+
'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
|
49
|
+
Expect-Ct:
|
50
|
+
- max-age=0
|
51
|
+
Referrer-Policy:
|
52
|
+
- no-referrer
|
53
|
+
X-Content-Type-Options:
|
54
|
+
- nosniff
|
55
|
+
X-Dns-Prefetch-Control:
|
56
|
+
- "off"
|
57
|
+
X-Download-Options:
|
58
|
+
- noopen
|
59
|
+
X-Frame-Options:
|
60
|
+
- SAMEORIGIN
|
61
|
+
X-Permitted-Cross-Domain-Policies:
|
62
|
+
- none
|
63
|
+
X-Request-Id:
|
64
|
+
- a8db37d7-9244-4e2a-b183-b5e2a67d8104
|
65
|
+
X-Xss-Protection:
|
66
|
+
- "0"
|
67
|
+
Server:
|
68
|
+
- cloudflare
|
69
|
+
body:
|
70
|
+
encoding: ASCII-8BIT
|
71
|
+
string:
|
72
|
+
'{"object":"list","data":[{"object":"role","id":"role_01HS1C7GRJE08PBR3M6Y0ZYGDZ","description":"Write
|
73
|
+
access to every resource available","name":"Admin","slug":"admin","type":"EnvironmentRole","created_at":"2024-03-15T15:38:29.521Z","updated_at":"2024-11-14T17:08:00.556Z"},{"object":"role","id":"role_01JA8GJZRDSZEB9289DQXJ3N9Z","description":"","name":"Billing
|
74
|
+
Manager","slug":"billing","type":"EnvironmentRole","created_at":"2024-10-15T16:36:11.653Z","updated_at":"2024-12-19T21:27:01.286Z"},{"object":"role","id":"role_01HSBH4R6RX0V86S3R590NNZW2","description":"Developer
|
75
|
+
role","name":"Developer","slug":"developer","type":"EnvironmentRole","created_at":"2024-03-19T14:16:46.038Z","updated_at":"2024-03-19T14:16:46.038Z"},{"object":"role","id":"role_01HS4GDWJ8T6NQPTX2D0R5KBHN","description":"Edit
|
76
|
+
and view access to non-critical resources","name":"Editor","slug":"editor","type":"EnvironmentRole","created_at":"2024-03-16T20:49:35.815Z","updated_at":"2024-03-16T20:52:19.410Z"},{"object":"role","id":"role_01HRFZE22WS2MGX6EWAG2JX6NW","description":"The
|
77
|
+
default user role","name":"Member","slug":"member","type":"EnvironmentRole","created_at":"2024-03-08T21:27:47.034Z","updated_at":"2024-08-14T00:27:46.265Z"},{"object":"role","id":"role_01JEYJ2Z5MYG0TZYTDF02MW11N","description":"Manage
|
78
|
+
billing for organization.","name":"Billing manager","slug":"org-billing-manager","type":"OrganizationRole","created_at":"2024-12-12T23:08:28.712Z","updated_at":"2024-12-12T23:08:28.712Z"},{"object":"role","id":"role_01JF0B7MQ9X414WQRAQMQYE1GS","description":"","name":"Platform
|
79
|
+
Manager","slug":"org-platform-manager","type":"OrganizationRole","created_at":"2024-12-13T15:47:10.692Z","updated_at":"2024-12-13T15:47:10.692Z"}]}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Mon, 23 Dec 2024 20:23:07 GMT
|
82
|
+
recorded_with: VCR 5.0.0
|
data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.workos.com/user_management/authenticate
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string:
|
9
|
+
'{"client_id":"client_123","client_secret":"<API_KEY>","email":"unverified@workos.app","password":"7YtYic00VWcXatPb","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0
|
10
|
+
(Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"password"}'
|
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; arm64-darwin21; v2.16.0
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 403
|
23
|
+
message: Email ownership must be verified before authentication.
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Tue, 29 Aug 2023 00:24:25 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Cf-Ray:
|
34
|
+
- 7fe0a6a27b0bc39c-SEA
|
35
|
+
Cf-Cache-Status:
|
36
|
+
- DYNAMIC
|
37
|
+
Etag:
|
38
|
+
- W/"16e-hoaHaR0EhmAH7TaNBOF8B2OHJq4"
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=15552000; includeSubDomains
|
41
|
+
Vary:
|
42
|
+
- Origin, Accept-Encoding
|
43
|
+
Via:
|
44
|
+
- 1.1 spaces-router (devel)
|
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
|
+
- 62990367-ddaf-46b3-a32f-38fc4f29d581
|
67
|
+
X-Xss-Protection:
|
68
|
+
- '0'
|
69
|
+
Set-Cookie:
|
70
|
+
- __cf_bm=IiwoT1XAlPdVWj334oRTocU7zZyvKgYw61o0UoA7GtE-1693268665-0-AZTn/iGDfGV6R5j3aj7lcPod7FB9P3cbHc9pD1oN/U5ZmnUYvpCecp6AL+8p/+/bMuwwGqXGNMSa/eIpa0TVm+I=;
|
71
|
+
path=/; expires=Tue, 29-Aug-23 00:54:25 GMT; domain=.workos.com; HttpOnly;
|
72
|
+
Secure; SameSite=None
|
73
|
+
- __cfruid=beafd87202de7b7d34fd4a1af55696cb5d19364d-1693268665; path=/; domain=.workos.com;
|
74
|
+
HttpOnly; Secure; SameSite=None
|
75
|
+
Server:
|
76
|
+
- cloudflare
|
77
|
+
body:
|
78
|
+
encoding: ASCII-8BIT
|
79
|
+
string: '{"code":"email_verification_required", "message":"Email ownership must be verified before authentication.", "email":"unverified@workos.app", "pending_authentication_token":"RWx94aFHwanPOebv7tKbBkJm0", "email_verification_id":"email_verification_01JG43A0WYAFAPHMNBV5XF2R4M"}'
|
80
|
+
http_version:
|
81
|
+
recorded_at: Tue, 29 Aug 2023 00:24:25 GMT
|
82
|
+
recorded_with: VCR 5.0.0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WorkOS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: encryptor
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/workos/profile.rb
|
166
166
|
- lib/workos/profile_and_token.rb
|
167
167
|
- lib/workos/refresh_authentication_response.rb
|
168
|
+
- lib/workos/role.rb
|
168
169
|
- lib/workos/session.rb
|
169
170
|
- lib/workos/sso.rb
|
170
171
|
- lib/workos/types.rb
|
@@ -267,6 +268,7 @@ files:
|
|
267
268
|
- spec/support/fixtures/vcr_cassettes/organization/get.yml
|
268
269
|
- spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml
|
269
270
|
- spec/support/fixtures/vcr_cassettes/organization/list.yml
|
271
|
+
- spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml
|
270
272
|
- spec/support/fixtures/vcr_cassettes/organization/update.yml
|
271
273
|
- spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml
|
272
274
|
- spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml
|
@@ -300,6 +302,7 @@ files:
|
|
300
302
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml
|
301
303
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml
|
302
304
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml
|
305
|
+
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml
|
303
306
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml
|
304
307
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml
|
305
308
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml
|
@@ -484,6 +487,7 @@ test_files:
|
|
484
487
|
- spec/support/fixtures/vcr_cassettes/organization/get.yml
|
485
488
|
- spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml
|
486
489
|
- spec/support/fixtures/vcr_cassettes/organization/list.yml
|
490
|
+
- spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml
|
487
491
|
- spec/support/fixtures/vcr_cassettes/organization/update.yml
|
488
492
|
- spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml
|
489
493
|
- spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml
|
@@ -517,6 +521,7 @@ test_files:
|
|
517
521
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml
|
518
522
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml
|
519
523
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml
|
524
|
+
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml
|
520
525
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml
|
521
526
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml
|
522
527
|
- spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml
|