workos 5.18.0 → 5.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7bcbc31ee2fd99bc75f92dd89397a5acb223fcd12f7ce5d24e396b966240cb1
4
- data.tar.gz: 7f21e67f61a6d63c746e50dd3e6753acea90ab39d765bdd0c4f9566b5b0135e5
3
+ metadata.gz: b64aa946db63d75ad0e7b560a904f441d2acfe4f320138c90884c5382a8da26e
4
+ data.tar.gz: 9038133e40d856eee210c2298739995e3aa8cceae91b1415542955c6bea16226
5
5
  SHA512:
6
- metadata.gz: f48581ece4c6ee347403cdc865b4bb6ed0637ad7fec62ecd7926016f709988cd9106d37f8a138bbddf15a8fa0aa95fa65c3d496356fb6bcb56ce70163f1c0004
7
- data.tar.gz: ed1e358de54b404eca9ef2036dae4a4a777b519d4c00583a789221cb08393e5d4a8fbe79dfc5fe1ed632522ae02734fb1b3145a649fa6c1e0813b2d25fab4719
6
+ metadata.gz: c16ee35f4494b5acd119ae6a354d0ba3fa7d9e892310d8388133ff54c0e0930f3d19a20c96d3ebe5b99d7fccd8acf213eb78e6d679967c972c4c4abc15ad3cfd
7
+ data.tar.gz: 88a97b1723b6dd505b19e8911c6eccef2b2adda01e996959cffa73ec82d71bf85d1011e517f660085d5c388f6474dad2eb7f0b78352e5f5b458671510b936813
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (5.18.0)
4
+ workos (5.19.0)
5
5
  encryptor (~> 3.0)
6
6
  jwt (~> 2.8)
7
7
 
@@ -278,9 +278,20 @@ module WorkOS
278
278
  # @param [String] client_id The WorkOS client ID for the environment
279
279
  # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
280
280
  # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
281
+ # @param [Hash] session An optional hash that determines whether the session should be sealed and
282
+ # the optional cookie password.
281
283
  #
282
284
  # @return WorkOS::AuthenticationResponse
283
- def authenticate_with_password(email:, password:, client_id:, ip_address: nil, user_agent: nil)
285
+ def authenticate_with_password(
286
+ email:,
287
+ password:,
288
+ client_id:,
289
+ ip_address: nil,
290
+ user_agent: nil,
291
+ session: nil
292
+ )
293
+ validate_session(session)
294
+
284
295
  response = execute_request(
285
296
  request: post_request(
286
297
  path: '/user_management/authenticate',
@@ -296,7 +307,7 @@ module WorkOS
296
307
  ),
297
308
  )
298
309
 
299
- WorkOS::AuthenticationResponse.new(response.body)
310
+ WorkOS::AuthenticationResponse.new(response.body, session)
300
311
  end
301
312
 
302
313
  # Authenticate a user using OAuth or an organization's SSO connection.
@@ -317,9 +328,7 @@ module WorkOS
317
328
  user_agent: nil,
318
329
  session: nil
319
330
  )
320
- if session && (session[:seal_session] == true) && session[:cookie_password].nil?
321
- raise ArgumentError, 'cookie_password is required when sealing session'
322
- end
331
+ validate_session(session)
323
332
 
324
333
  response = execute_request(
325
334
  request: post_request(
@@ -357,9 +366,7 @@ module WorkOS
357
366
  user_agent: nil,
358
367
  session: nil
359
368
  )
360
- if session && (session[:seal_session] == true) && session[:cookie_password].nil?
361
- raise ArgumentError, 'cookie_password is required when sealing session'
362
- end
369
+ validate_session(session)
363
370
 
364
371
  response = execute_request(
365
372
  request: post_request(
@@ -388,16 +395,22 @@ module WorkOS
388
395
  # @param [String] link_authorization_code Used to link an OAuth profile to an existing user,
389
396
  # after having completed a Magic Code challenge.
390
397
  # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
398
+ # @param [Hash] session An optional hash that determines whether the session should be sealed and
399
+ # the optional cookie password.
391
400
  #
392
401
  # @return WorkOS::AuthenticationResponse
402
+ # rubocop:disable Metrics/ParameterLists
393
403
  def authenticate_with_magic_auth(
394
404
  code:,
395
405
  email:,
396
406
  client_id:,
397
407
  ip_address: nil,
398
408
  user_agent: nil,
399
- link_authorization_code: nil
409
+ link_authorization_code: nil,
410
+ session: nil
400
411
  )
412
+ validate_session(session)
413
+
401
414
  response = execute_request(
402
415
  request: post_request(
403
416
  path: '/user_management/authenticate',
@@ -414,8 +427,9 @@ module WorkOS
414
427
  ),
415
428
  )
416
429
 
417
- WorkOS::AuthenticationResponse.new(response.body)
430
+ WorkOS::AuthenticationResponse.new(response.body, session)
418
431
  end
432
+ # rubocop:enable Metrics/ParameterLists
419
433
 
420
434
  # Authenticate a user into an organization they are a member of.
421
435
  #
@@ -424,6 +438,8 @@ module WorkOS
424
438
  # @param [String] pending_authentication_token The pending authentication token
425
439
  # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
426
440
  # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
441
+ # @param [Hash] session An optional hash that determines whether the session should be sealed and
442
+ # the optional cookie password.
427
443
  #
428
444
  # @return WorkOS::AuthenticationResponse
429
445
  def authenticate_with_organization_selection(
@@ -431,8 +447,11 @@ module WorkOS
431
447
  organization_id:,
432
448
  pending_authentication_token:,
433
449
  ip_address: nil,
434
- user_agent: nil
450
+ user_agent: nil,
451
+ session: nil
435
452
  )
453
+ validate_session(session)
454
+
436
455
  response = execute_request(
437
456
  request: post_request(
438
457
  path: '/user_management/authenticate',
@@ -448,7 +467,7 @@ module WorkOS
448
467
  ),
449
468
  )
450
469
 
451
- WorkOS::AuthenticationResponse.new(response.body)
470
+ WorkOS::AuthenticationResponse.new(response.body, session)
452
471
  end
453
472
 
454
473
  # Authenticate a user using TOTP.
@@ -461,16 +480,22 @@ module WorkOS
461
480
  # authentication request.
462
481
  # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
463
482
  # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
483
+ # @param [Hash] session An optional hash that determines whether the session should be sealed and
484
+ # the optional cookie password.
464
485
  #
465
486
  # @return WorkOS::AuthenticationResponse
487
+ # rubocop:disable Metrics/ParameterLists
466
488
  def authenticate_with_totp(
467
489
  code:,
468
490
  client_id:,
469
491
  pending_authentication_token:,
470
492
  authentication_challenge_id:,
471
493
  ip_address: nil,
472
- user_agent: nil
494
+ user_agent: nil,
495
+ session: nil
473
496
  )
497
+ validate_session(session)
498
+
474
499
  response = execute_request(
475
500
  request: post_request(
476
501
  path: '/user_management/authenticate',
@@ -487,8 +512,9 @@ module WorkOS
487
512
  ),
488
513
  )
489
514
 
490
- WorkOS::AuthenticationResponse.new(response.body)
515
+ WorkOS::AuthenticationResponse.new(response.body, session)
491
516
  end
517
+ # rubocop:enable Metrics/ParameterLists
492
518
 
493
519
  # Authenticate a user using Email Verification Code.
494
520
  #
@@ -498,6 +524,8 @@ module WorkOS
498
524
  # authentication attempt due to an unverified email address.
499
525
  # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate.
500
526
  # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate.
527
+ # @param [Hash] session An optional hash that determines whether the session should be sealed and
528
+ # the optional cookie password.
501
529
  #
502
530
  # @return WorkOS::AuthenticationResponse
503
531
  def authenticate_with_email_verification(
@@ -505,8 +533,11 @@ module WorkOS
505
533
  client_id:,
506
534
  pending_authentication_token:,
507
535
  ip_address: nil,
508
- user_agent: nil
536
+ user_agent: nil,
537
+ session: nil
509
538
  )
539
+ validate_session(session)
540
+
510
541
  response = execute_request(
511
542
  request: post_request(
512
543
  path: '/user_management/authenticate',
@@ -522,7 +553,7 @@ module WorkOS
522
553
  ),
523
554
  )
524
555
 
525
- WorkOS::AuthenticationResponse.new(response.body)
556
+ WorkOS::AuthenticationResponse.new(response.body, session)
526
557
  end
527
558
 
528
559
  # Get the logout URL for a session
@@ -1082,6 +1113,12 @@ module WorkOS
1082
1113
 
1083
1114
  private
1084
1115
 
1116
+ def validate_session(session)
1117
+ return unless session && (session[:seal_session] == true) && session[:cookie_password].nil?
1118
+
1119
+ raise ArgumentError, 'cookie_password is required when sealing session'
1120
+ end
1121
+
1085
1122
  def validate_authorization_url_arguments(
1086
1123
  provider:,
1087
1124
  connection_id:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkOS
4
- VERSION = '5.18.0'
4
+ VERSION = '5.19.0'
5
5
  end
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.18.0
4
+ version: 5.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-22 00:00:00.000000000 Z
11
+ date: 2025-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: encryptor