workos 5.29.0 → 5.31.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.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -1
- data/.github/workflows/ci.yml +2 -2
- data/.github/workflows/release.yml +1 -1
- data/Gemfile.lock +3 -3
- data/context7.json +4 -0
- data/lib/workos/directory_sync.rb +1 -1
- data/lib/workos/directory_user.rb +18 -2
- data/lib/workos/profile.rb +3 -1
- data/lib/workos/user_management/session.rb +57 -0
- data/lib/workos/user_management.rb +36 -0
- data/lib/workos/version.rb +1 -1
- data/spec/lib/workos/directory_user_spec.rb +13 -3
- data/spec/lib/workos/sso_spec.rb +6 -0
- data/spec/lib/workos/user_management_spec.rb +39 -0
- data/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +1 -1
- data/spec/support/fixtures/vcr_cassettes/sso/profile.yml +1 -1
- data/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml +38 -0
- data/spec/support/profile.txt +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72ac2923fd0b63753144e3395e07af49589481edabf18df1c4d959ea92b56400
|
|
4
|
+
data.tar.gz: f9950ef319ff6001fd2ad1ce7d3f0ab2282e9fc8abc7f0c41fba69bc53bfb175
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b29d2a45d77c3242d2a970c14c30ed9b082cb8a2fb9447c32b8cb02d642deca29e7d044646deeba9a2de25ed971a801418b50e461ab6784fefa89353891eabb8
|
|
7
|
+
data.tar.gz: ef16608e192c0c8dffa249b8f37a83efa36897dfff75f87779c4cde3117fe2518f6535db63590465f8fcffe41cbf556397cc9b107c6f2cda2715dd324b651b00
|
data/.github/CODEOWNERS
CHANGED
data/.github/workflows/ci.yml
CHANGED
|
@@ -20,8 +20,8 @@ jobs:
|
|
|
20
20
|
- '3.1'
|
|
21
21
|
- '3.2'
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
24
|
-
- uses: ruby/setup-ruby@
|
|
23
|
+
- uses: actions/checkout@v6
|
|
24
|
+
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
|
|
25
25
|
with:
|
|
26
26
|
ruby-version: ${{ matrix.ruby }}
|
|
27
27
|
bundler-cache: true
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
workos (5.
|
|
4
|
+
workos (5.31.0)
|
|
5
5
|
encryptor (~> 3.0)
|
|
6
6
|
jwt (~> 2.8)
|
|
7
7
|
|
|
@@ -20,7 +20,7 @@ GEM
|
|
|
20
20
|
encryptor (3.0.0)
|
|
21
21
|
hashdiff (1.1.0)
|
|
22
22
|
json (2.9.1)
|
|
23
|
-
jwt (2.10.
|
|
23
|
+
jwt (2.10.2)
|
|
24
24
|
base64
|
|
25
25
|
language_server-protocol (3.17.0.3)
|
|
26
26
|
parallel (1.26.3)
|
|
@@ -31,7 +31,7 @@ GEM
|
|
|
31
31
|
racc (1.8.1)
|
|
32
32
|
rainbow (3.1.1)
|
|
33
33
|
regexp_parser (2.10.0)
|
|
34
|
-
rexml (3.4.
|
|
34
|
+
rexml (3.4.2)
|
|
35
35
|
rspec (3.9.0)
|
|
36
36
|
rspec-core (~> 3.9.0)
|
|
37
37
|
rspec-expectations (~> 3.9.0)
|
data/context7.json
ADDED
|
@@ -115,7 +115,7 @@ module WorkOS
|
|
|
115
115
|
# @param [Hash] options An options hash
|
|
116
116
|
# @option options [String] directory The ID of the directory whose
|
|
117
117
|
# directory users will be retrieved.
|
|
118
|
-
# @option options [String]
|
|
118
|
+
# @option options [String] group The ID of the directory group whose
|
|
119
119
|
# directory users will be retrieved.
|
|
120
120
|
# @option options [String] limit Maximum number of records to return.
|
|
121
121
|
# @option options [String] order The order in which to paginate records
|
|
@@ -8,7 +8,7 @@ module WorkOS
|
|
|
8
8
|
include HashProvider
|
|
9
9
|
|
|
10
10
|
attr_accessor :id, :idp_id, :email, :emails, :first_name, :last_name, :job_title, :username, :state,
|
|
11
|
-
:groups, :role, :custom_attributes, :raw_attributes, :directory_id, :organization_id,
|
|
11
|
+
:groups, :role, :roles, :custom_attributes, :raw_attributes, :directory_id, :organization_id,
|
|
12
12
|
:created_at, :updated_at
|
|
13
13
|
|
|
14
14
|
# rubocop:disable Metrics/AbcSize
|
|
@@ -37,6 +37,7 @@ module WorkOS
|
|
|
37
37
|
@state = hash[:state]
|
|
38
38
|
@groups = hash[:groups]
|
|
39
39
|
@role = hash[:role]
|
|
40
|
+
@roles = hash[:roles]
|
|
40
41
|
@custom_attributes = hash[:custom_attributes]
|
|
41
42
|
@raw_attributes = hash[:raw_attributes]
|
|
42
43
|
@created_at = hash[:created_at]
|
|
@@ -47,6 +48,13 @@ module WorkOS
|
|
|
47
48
|
# rubocop:enable Metrics/AbcSize
|
|
48
49
|
|
|
49
50
|
def to_json(*)
|
|
51
|
+
base_attributes.
|
|
52
|
+
merge(authorization_attributes)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def base_attributes
|
|
50
58
|
{
|
|
51
59
|
id: id,
|
|
52
60
|
directory_id: directory_id,
|
|
@@ -60,7 +68,6 @@ module WorkOS
|
|
|
60
68
|
username: username,
|
|
61
69
|
state: state,
|
|
62
70
|
groups: groups,
|
|
63
|
-
role: role,
|
|
64
71
|
custom_attributes: custom_attributes,
|
|
65
72
|
raw_attributes: raw_attributes,
|
|
66
73
|
created_at: created_at,
|
|
@@ -68,6 +75,15 @@ module WorkOS
|
|
|
68
75
|
}
|
|
69
76
|
end
|
|
70
77
|
|
|
78
|
+
def authorization_attributes
|
|
79
|
+
{
|
|
80
|
+
role: role,
|
|
81
|
+
roles: roles,
|
|
82
|
+
}
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
public
|
|
86
|
+
|
|
71
87
|
# @deprecated Will be removed in a future major version. Use {#email} instead.
|
|
72
88
|
def primary_email
|
|
73
89
|
primary_email = (emails || []).find { |email| email[:primary] }
|
data/lib/workos/profile.rb
CHANGED
|
@@ -9,7 +9,7 @@ module WorkOS
|
|
|
9
9
|
class Profile
|
|
10
10
|
include HashProvider
|
|
11
11
|
|
|
12
|
-
attr_accessor :id, :email, :first_name, :last_name, :role, :groups, :organization_id,
|
|
12
|
+
attr_accessor :id, :email, :first_name, :last_name, :role, :roles, :groups, :organization_id,
|
|
13
13
|
:connection_id, :connection_type, :idp_id, :custom_attributes, :raw_attributes
|
|
14
14
|
|
|
15
15
|
# rubocop:disable Metrics/AbcSize
|
|
@@ -21,6 +21,7 @@ module WorkOS
|
|
|
21
21
|
@first_name = hash[:first_name]
|
|
22
22
|
@last_name = hash[:last_name]
|
|
23
23
|
@role = hash[:role]
|
|
24
|
+
@roles = hash[:roles]
|
|
24
25
|
@groups = hash[:groups]
|
|
25
26
|
@organization_id = hash[:organization_id]
|
|
26
27
|
@connection_id = hash[:connection_id]
|
|
@@ -42,6 +43,7 @@ module WorkOS
|
|
|
42
43
|
first_name: first_name,
|
|
43
44
|
last_name: last_name,
|
|
44
45
|
role: role,
|
|
46
|
+
roles: roles,
|
|
45
47
|
groups: groups,
|
|
46
48
|
organization_id: organization_id,
|
|
47
49
|
connection_id: connection_id,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module WorkOS
|
|
4
|
+
module UserManagement
|
|
5
|
+
# The Session class provides a lightweight wrapper around
|
|
6
|
+
# a WorkOS Session resource. This class is not meant to be instantiated
|
|
7
|
+
# in user space, and is instantiated internally but exposed.
|
|
8
|
+
class Session
|
|
9
|
+
include HashProvider
|
|
10
|
+
attr_accessor :id, :object, :user_id, :organization_id, :status, :auth_method,
|
|
11
|
+
:ip_address, :user_agent, :expires_at, :ended_at, :created_at, :updated_at
|
|
12
|
+
|
|
13
|
+
# rubocop:disable Metrics/AbcSize
|
|
14
|
+
def initialize(json)
|
|
15
|
+
hash = JSON.parse(json, symbolize_names: true)
|
|
16
|
+
|
|
17
|
+
@id = hash[:id]
|
|
18
|
+
@object = hash[:object]
|
|
19
|
+
@user_id = hash[:user_id]
|
|
20
|
+
@organization_id = hash[:organization_id]
|
|
21
|
+
@status = hash[:status]
|
|
22
|
+
@auth_method = hash[:auth_method]
|
|
23
|
+
@ip_address = hash[:ip_address]
|
|
24
|
+
@user_agent = hash[:user_agent]
|
|
25
|
+
@expires_at = hash[:expires_at]
|
|
26
|
+
@ended_at = hash[:ended_at]
|
|
27
|
+
@created_at = hash[:created_at]
|
|
28
|
+
@updated_at = hash[:updated_at]
|
|
29
|
+
end
|
|
30
|
+
# rubocop:enable Metrics/AbcSize
|
|
31
|
+
|
|
32
|
+
def to_json(*)
|
|
33
|
+
{
|
|
34
|
+
id: id,
|
|
35
|
+
object: object,
|
|
36
|
+
user_id: user_id,
|
|
37
|
+
organization_id: organization_id,
|
|
38
|
+
status: status,
|
|
39
|
+
auth_method: auth_method,
|
|
40
|
+
ip_address: ip_address,
|
|
41
|
+
user_agent: user_agent,
|
|
42
|
+
expires_at: expires_at,
|
|
43
|
+
ended_at: ended_at,
|
|
44
|
+
created_at: created_at,
|
|
45
|
+
updated_at: updated_at,
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Revoke this session
|
|
50
|
+
#
|
|
51
|
+
# @return [Bool] - returns `true` if successful
|
|
52
|
+
def revoke
|
|
53
|
+
WorkOS::UserManagement.revoke_session(session_id: id)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -7,6 +7,8 @@ module WorkOS
|
|
|
7
7
|
# The UserManagement module provides convenience methods for working with the
|
|
8
8
|
# WorkOS User platform. You'll need a valid API key.
|
|
9
9
|
module UserManagement
|
|
10
|
+
autoload :Session, 'workos/user_management/session'
|
|
11
|
+
|
|
10
12
|
module Types
|
|
11
13
|
# The ProviderEnum is a declaration of a
|
|
12
14
|
# fixed set of values for User Management Providers.
|
|
@@ -740,6 +742,40 @@ module WorkOS
|
|
|
740
742
|
)
|
|
741
743
|
end
|
|
742
744
|
|
|
745
|
+
# Get all sessions for a user
|
|
746
|
+
#
|
|
747
|
+
# @param [String] user_id The id for the user.
|
|
748
|
+
# @param [Hash] options
|
|
749
|
+
# @option options [String] limit Maximum number of records to return.
|
|
750
|
+
# @option options [String] order The order in which to paginate records
|
|
751
|
+
# @option options [String] before Pagination cursor to receive records
|
|
752
|
+
# before a provided Session ID.
|
|
753
|
+
# @option options [String] after Pagination cursor to receive records
|
|
754
|
+
# after a provided Session ID.
|
|
755
|
+
#
|
|
756
|
+
# @return [WorkOS::Types::ListStruct<WorkOS::UserManagement::Session>]
|
|
757
|
+
def list_sessions(user_id:, options: {})
|
|
758
|
+
options[:order] ||= 'desc'
|
|
759
|
+
response = execute_request(
|
|
760
|
+
request: get_request(
|
|
761
|
+
path: "/user_management/users/#{user_id}/sessions",
|
|
762
|
+
auth: true,
|
|
763
|
+
params: options,
|
|
764
|
+
),
|
|
765
|
+
)
|
|
766
|
+
|
|
767
|
+
parsed_response = JSON.parse(response.body)
|
|
768
|
+
|
|
769
|
+
sessions = parsed_response['data'].map do |session|
|
|
770
|
+
::WorkOS::UserManagement::Session.new(session.to_json)
|
|
771
|
+
end
|
|
772
|
+
|
|
773
|
+
WorkOS::Types::ListStruct.new(
|
|
774
|
+
data: sessions,
|
|
775
|
+
list_metadata: parsed_response['list_metadata'],
|
|
776
|
+
)
|
|
777
|
+
end
|
|
778
|
+
|
|
743
779
|
# Gets an email verification object
|
|
744
780
|
#
|
|
745
781
|
# @param [String] id The unique ID of the EmailVerification object.
|
data/lib/workos/version.rb
CHANGED
|
@@ -37,13 +37,23 @@ describe WorkOS::DirectoryUser do
|
|
|
37
37
|
it 'returns no role' do
|
|
38
38
|
user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}')
|
|
39
39
|
expect(user.role).to eq(nil)
|
|
40
|
+
expect(user.roles).to eq(nil)
|
|
40
41
|
end
|
|
41
42
|
end
|
|
42
43
|
|
|
43
|
-
context 'with a role' do
|
|
44
|
-
it 'returns the role slug' do
|
|
45
|
-
user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"member"},"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}')
|
|
44
|
+
context 'with a single role' do
|
|
45
|
+
it 'returns the highest priority role slug and roles array' do
|
|
46
|
+
user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"member"},"roles":[{"slug":"member"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}')
|
|
46
47
|
expect(user.role).to eq({ slug: 'member' })
|
|
48
|
+
expect(user.roles).to eq([{ slug: 'member' }])
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
context 'with multiple roles' do
|
|
53
|
+
it 'returns the highest priority role slug and roles array' do
|
|
54
|
+
user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"admin"},"roles":[{"slug":"member"}, {"slug":"admin"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}')
|
|
55
|
+
expect(user.role).to eq({ slug: 'admin' })
|
|
56
|
+
expect(user.roles).to eq([{ slug: 'member' }, { slug: 'admin' }])
|
|
47
57
|
end
|
|
48
58
|
end
|
|
49
59
|
end
|
data/spec/lib/workos/sso_spec.rb
CHANGED
|
@@ -305,6 +305,9 @@ describe WorkOS::SSO do
|
|
|
305
305
|
role: {
|
|
306
306
|
slug: 'member',
|
|
307
307
|
},
|
|
308
|
+
roles: [{
|
|
309
|
+
slug: 'member',
|
|
310
|
+
}],
|
|
308
311
|
groups: nil,
|
|
309
312
|
organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB',
|
|
310
313
|
custom_attributes: {},
|
|
@@ -380,6 +383,9 @@ describe WorkOS::SSO do
|
|
|
380
383
|
role: {
|
|
381
384
|
slug: 'admin',
|
|
382
385
|
},
|
|
386
|
+
roles: [{
|
|
387
|
+
slug: 'admin',
|
|
388
|
+
}],
|
|
383
389
|
groups: %w[Admins Developers],
|
|
384
390
|
organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB',
|
|
385
391
|
custom_attributes: {
|
|
@@ -1797,6 +1797,45 @@ describe WorkOS::UserManagement do
|
|
|
1797
1797
|
end
|
|
1798
1798
|
end
|
|
1799
1799
|
|
|
1800
|
+
describe '.list_sessions' do
|
|
1801
|
+
context 'with a valid user_id' do
|
|
1802
|
+
it 'returns a list of sessions' do
|
|
1803
|
+
VCR.use_cassette('user_management/list_sessions/valid') do
|
|
1804
|
+
result = described_class.list_sessions(
|
|
1805
|
+
user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44',
|
|
1806
|
+
)
|
|
1807
|
+
|
|
1808
|
+
expect(result.data).to be_an(Array)
|
|
1809
|
+
expect(result.data.first).to be_a(WorkOS::UserManagement::Session)
|
|
1810
|
+
expect(result.data.first.id).to eq('session_01H96FETXGTW2S0V5V9XPSM6H44')
|
|
1811
|
+
expect(result.data.first.status).to eq('active')
|
|
1812
|
+
expect(result.data.first.auth_method).to eq('password')
|
|
1813
|
+
end
|
|
1814
|
+
end
|
|
1815
|
+
|
|
1816
|
+
it 'returns sessions that can be revoked' do
|
|
1817
|
+
VCR.use_cassette('user_management/list_sessions/valid') do
|
|
1818
|
+
result = described_class.list_sessions(
|
|
1819
|
+
user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44',
|
|
1820
|
+
)
|
|
1821
|
+
session = result.data.first
|
|
1822
|
+
|
|
1823
|
+
expect(described_class).to receive(:post_request) do |options|
|
|
1824
|
+
expect(options[:path]).to eq('/user_management/sessions/revoke')
|
|
1825
|
+
expect(options[:body]).to eq({ session_id: 'session_01H96FETXGTW2S0V5V9XPSM6H44' })
|
|
1826
|
+
expect(options[:auth]).to be true
|
|
1827
|
+
end.and_return(double('request'))
|
|
1828
|
+
|
|
1829
|
+
expect(described_class).to receive(:execute_request).and_return(
|
|
1830
|
+
double('response', is_a?: true),
|
|
1831
|
+
)
|
|
1832
|
+
|
|
1833
|
+
expect(session.revoke).to be true
|
|
1834
|
+
end
|
|
1835
|
+
end
|
|
1836
|
+
end
|
|
1837
|
+
end
|
|
1838
|
+
|
|
1800
1839
|
describe '.get_logout_url' do
|
|
1801
1840
|
it 'returns a logout url for the given session ID' do
|
|
1802
1841
|
result = described_class.get_logout_url(
|
|
@@ -74,7 +74,7 @@ http_interactions:
|
|
|
74
74
|
- 72abbbf2b93e8ca5-EWR
|
|
75
75
|
body:
|
|
76
76
|
encoding: ASCII-8BIT
|
|
77
|
-
string: '{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Bob
|
|
77
|
+
string: '{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","role":{"slug":"member"},"roles":[{"slug":"member"}],"raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Bob
|
|
78
78
|
Bob Fakename","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Fakename","created_at":"2021-05-05T16:06:24+0000","firstName":"Bob","updated_at":"2021-11-11T05:08:14+0000","workEmail":"bob.fakename@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
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
80
|
- Infra","role":{"slug":"member"},"created_at":"2021-07-19T17:57:55.893Z","updated_at":"2022-01-24T11:23:01.333Z","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}}]}'
|
|
@@ -67,7 +67,7 @@ http_interactions:
|
|
|
67
67
|
body:
|
|
68
68
|
encoding: UTF-8
|
|
69
69
|
string:
|
|
70
|
-
'{"object":"profile","id":"prof_01EEJTY9SZ1R350RB7B73SNBKF","organization_id":"org_01FG53X8636WSNW2WEKB2C31ZB","connection_id":"conn_01E83FVYZHY7DM4S9503JHV0R5","connection_type":"GoogleOAuth","idp_id":"116485463307139932699","email":"bob.loblaw@workos.com","first_name":"Bob","last_name":"Loblaw","role":{"slug":"member"},"custom_attributes":{},"raw_attributes":{"hd":"workos.com","id":"116485463307139932699","name":"Bob
|
|
70
|
+
'{"object":"profile","id":"prof_01EEJTY9SZ1R350RB7B73SNBKF","organization_id":"org_01FG53X8636WSNW2WEKB2C31ZB","connection_id":"conn_01E83FVYZHY7DM4S9503JHV0R5","connection_type":"GoogleOAuth","idp_id":"116485463307139932699","email":"bob.loblaw@workos.com","first_name":"Bob","last_name":"Loblaw","role":{"slug":"member"},"roles":[{"slug":"member"}],"custom_attributes":{},"raw_attributes":{"hd":"workos.com","id":"116485463307139932699","name":"Bob
|
|
71
71
|
Loblaw","email":"bob.loblaw@workos.com","locale":"en","picture":"https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c","given_name":"Bob","family_name":"Loblaw","verified_email":true}}'
|
|
72
72
|
http_version:
|
|
73
73
|
recorded_at: Tue, 18 May 2021 22:55:21 GMT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44/sessions?order=desc
|
|
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.0.2; arm64-darwin22; v2.16.0
|
|
18
|
+
Authorization:
|
|
19
|
+
- Bearer <API_KEY>
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Date:
|
|
26
|
+
- Mon, 05 Jan 2026 12:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json; charset=utf-8
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- keep-alive
|
|
33
|
+
body:
|
|
34
|
+
encoding: ASCII-8BIT
|
|
35
|
+
string: '{"object":"list","data":[{"object":"session","id":"session_01H96FETXGTW2S0V5V9XPSM6H44","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0","ip_address":"192.168.1.1","organization_id":"org_01H96FETXGTW2SXRA136PCMAQJ0","user_id":"user_01H7TVSKS45SDHN5V9XPSM6H44","auth_method":"password","status":"active","expires_at":"2027-01-02T03:47:13.027Z","ended_at":null,"created_at":"2026-01-02T03:47:13.024Z","updated_at":"2026-01-05T02:56:09.379Z"}],"list_metadata":{"before":null,"after":null}}'
|
|
36
|
+
http_version:
|
|
37
|
+
recorded_at: Mon, 05 Jan 2026 12:00:00 GMT
|
|
38
|
+
recorded_with: VCR 5.0.0
|
data/spec/support/profile.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"profile":{"object":"profile","id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","organization_id":"org_01FG53X8636WSNW2WEKB2C31ZB","connection_id":"conn_01EMH8WAK20T42N2NBMNBCYHAG","connection_type":"OktaSAML","last_name":"Demo","role":{"slug": "admin"},"groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","custom_attributes":{"license": "professional"},"raw_attributes":{"id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","last_name":"Demo","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","license": "professional"}},"access_token":"01DVX6QBS3EG6FHY2ESAA5Q65X"}
|
|
1
|
+
{"profile":{"object":"profile","id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","organization_id":"org_01FG53X8636WSNW2WEKB2C31ZB","connection_id":"conn_01EMH8WAK20T42N2NBMNBCYHAG","connection_type":"OktaSAML","last_name":"Demo","role":{"slug": "admin"},"roles":[{"slug": "admin"}],"groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","custom_attributes":{"license": "professional"},"raw_attributes":{"id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","last_name":"Demo","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","license": "professional"}},"access_token":"01DVX6QBS3EG6FHY2ESAA5Q65X"}
|
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.31.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: 2026-01-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: encryptor
|
|
@@ -132,6 +132,7 @@ files:
|
|
|
132
132
|
- bin/build
|
|
133
133
|
- bin/console
|
|
134
134
|
- bin/publish
|
|
135
|
+
- context7.json
|
|
135
136
|
- lib/workos.rb
|
|
136
137
|
- lib/workos/audit_log_export.rb
|
|
137
138
|
- lib/workos/audit_logs.rb
|
|
@@ -181,6 +182,7 @@ files:
|
|
|
181
182
|
- lib/workos/user.rb
|
|
182
183
|
- lib/workos/user_and_token.rb
|
|
183
184
|
- lib/workos/user_management.rb
|
|
185
|
+
- lib/workos/user_management/session.rb
|
|
184
186
|
- lib/workos/user_response.rb
|
|
185
187
|
- lib/workos/verify_challenge.rb
|
|
186
188
|
- lib/workos/version.rb
|
|
@@ -360,6 +362,7 @@ files:
|
|
|
360
362
|
- spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml
|
|
361
363
|
- spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml
|
|
362
364
|
- spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml
|
|
365
|
+
- spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml
|
|
363
366
|
- spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml
|
|
364
367
|
- spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml
|
|
365
368
|
- spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml
|
|
@@ -599,6 +602,7 @@ test_files:
|
|
|
599
602
|
- spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml
|
|
600
603
|
- spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml
|
|
601
604
|
- spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml
|
|
605
|
+
- spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml
|
|
602
606
|
- spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml
|
|
603
607
|
- spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml
|
|
604
608
|
- spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml
|