stytch 7.0.0 → 7.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71b6a2f2ae456fe72ab960116272b1d51430fe267a8d1f4d917ef97ccf6bcdc4
4
- data.tar.gz: 03e9769f00c629efc6fbc062ad3bf6176d90d394d7b381110c7bcf10338497f9
3
+ metadata.gz: 11c676836879020ec0d87cbe9d7017ccfc777f27d4e73db695cd991a416589b6
4
+ data.tar.gz: e58761d69d0cb5f4c1a9f72d09bd1017a9dab222da4924570ebba7c26a4e1bb4
5
5
  SHA512:
6
- metadata.gz: ee454ad14f2c2d64938bc9bb3d7cb05232b58bd935ad2095640f7a5ae04fbb6f4b562e516b81baa3dd864389e20de1a83f9c8cee2299f0ee6e395422d7111453
7
- data.tar.gz: d92587695642d6e4890fb66d8ae0934c01b5aa07bb32d2db1506aadb2fbd570984a0d4ce06d5efb9d6b5382238293d872f399e4390ff60aae3a0605e75934a03
6
+ metadata.gz: e0d885c1e262b76649e01ffcbe64a6a31a78e183ff35d0128da9983e51dcc70e7bc7b7c9608983f8a516ac93a47cc9c51424c72aa73d7e1fc81218f83c31cfda
7
+ data.tar.gz: a88377ca19b824229fa2d0c3e2958c92f14e3926371f852ea39e12bbe3e10b5d3a70f859971196c48d425a0129ce5f0b79b527e96f1af09fc7f8c8edb124191f
@@ -490,11 +490,6 @@ module StytchB2B
490
490
  # member_id::
491
491
  # Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
492
492
  # The type of this field is +String+.
493
- # preserve_existing_sessions::
494
- # (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
495
- # by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
496
- # authentication factors with the affected SSO connection IDs will be revoked.
497
- # The type of this field is +Boolean+.
498
493
  # name::
499
494
  # The name of the Member.
500
495
  #
@@ -541,8 +536,13 @@ module StytchB2B
541
536
  # authentication factors with the affected connection ID. You can preserve these sessions by passing in the
542
537
  # `preserve_existing_sessions` parameter with a value of `true`.
543
538
  #
544
- # If this field is provided, the logged-in Member must have permission to perform the `update.settings.roles` action on the `stytch.member` Resource.
539
+ # If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the `update.settings.roles` action on the `stytch.member` Resource.
545
540
  # The type of this field is nilable list of +String+.
541
+ # preserve_existing_sessions::
542
+ # (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
543
+ # by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
544
+ # authentication factors with the affected SSO connection IDs will be revoked.
545
+ # The type of this field is nilable +Boolean+.
546
546
  #
547
547
  # == Returns:
548
548
  # An object with the following fields:
@@ -567,7 +567,6 @@ module StytchB2B
567
567
  def update(
568
568
  organization_id:,
569
569
  member_id:,
570
- preserve_existing_sessions:,
571
570
  name: nil,
572
571
  trusted_metadata: nil,
573
572
  untrusted_metadata: nil,
@@ -575,13 +574,12 @@ module StytchB2B
575
574
  mfa_phone_number: nil,
576
575
  mfa_enrolled: nil,
577
576
  roles: nil,
577
+ preserve_existing_sessions: nil,
578
578
  method_options: nil
579
579
  )
580
580
  headers = {}
581
581
  headers = headers.merge(method_options.to_headers) unless method_options.nil?
582
- request = {
583
- preserve_existing_sessions: preserve_existing_sessions
584
- }
582
+ request = {}
585
583
  request[:name] = name unless name.nil?
586
584
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
587
585
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
@@ -589,6 +587,7 @@ module StytchB2B
589
587
  request[:mfa_phone_number] = mfa_phone_number unless mfa_phone_number.nil?
590
588
  request[:mfa_enrolled] = mfa_enrolled unless mfa_enrolled.nil?
591
589
  request[:roles] = roles unless roles.nil?
590
+ request[:preserve_existing_sessions] = preserve_existing_sessions unless preserve_existing_sessions.nil?
592
591
 
593
592
  put_request("/v1/b2b/organizations/#{organization_id}/members/#{member_id}", request, headers)
594
593
  end
@@ -102,11 +102,6 @@ module StytchB2B
102
102
  # organization_id::
103
103
  # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
104
104
  # The type of this field is +String+.
105
- # preserve_existing_sessions::
106
- # (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
107
- # by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
108
- # authentication factors with the affected SSO connection IDs will be revoked.
109
- # The type of this field is +Boolean+.
110
105
  # md_5_config::
111
106
  # Optional parameters for MD-5 hash types.
112
107
  # The type of this field is nilable +MD5Config+ (+object+).
@@ -143,6 +138,11 @@ module StytchB2B
143
138
  # authentication factors with the affected connection ID. You can preserve these sessions by passing in the
144
139
  # `preserve_existing_sessions` parameter with a value of `true`.
145
140
  # The type of this field is nilable list of +String+.
141
+ # preserve_existing_sessions::
142
+ # (Coming Soon) Whether to preserve existing sessions when explicit Roles that are revoked are also implicitly assigned
143
+ # by SSO connection or SSO group. Defaults to `false` - that is, existing Member Sessions that contain SSO
144
+ # authentication factors with the affected SSO connection IDs will be revoked.
145
+ # The type of this field is nilable +Boolean+.
146
146
  #
147
147
  # == Returns:
148
148
  # An object with the following fields:
@@ -169,7 +169,6 @@ module StytchB2B
169
169
  hash:,
170
170
  hash_type:,
171
171
  organization_id:,
172
- preserve_existing_sessions:,
173
172
  md_5_config: nil,
174
173
  argon_2_config: nil,
175
174
  sha_1_config: nil,
@@ -178,15 +177,15 @@ module StytchB2B
178
177
  name: nil,
179
178
  trusted_metadata: nil,
180
179
  untrusted_metadata: nil,
181
- roles: nil
180
+ roles: nil,
181
+ preserve_existing_sessions: nil
182
182
  )
183
183
  headers = {}
184
184
  request = {
185
185
  email_address: email_address,
186
186
  hash: hash,
187
187
  hash_type: hash_type,
188
- organization_id: organization_id,
189
- preserve_existing_sessions: preserve_existing_sessions
188
+ organization_id: organization_id
190
189
  }
191
190
  request[:md_5_config] = md_5_config unless md_5_config.nil?
192
191
  request[:argon_2_config] = argon_2_config unless argon_2_config.nil?
@@ -197,6 +196,7 @@ module StytchB2B
197
196
  request[:trusted_metadata] = trusted_metadata unless trusted_metadata.nil?
198
197
  request[:untrusted_metadata] = untrusted_metadata unless untrusted_metadata.nil?
199
198
  request[:roles] = roles unless roles.nil?
199
+ request[:preserve_existing_sessions] = preserve_existing_sessions unless preserve_existing_sessions.nil?
200
200
 
201
201
  post_request('/v1/b2b/passwords/migrate', request, headers)
202
202
  end
@@ -380,7 +380,7 @@ module StytchB2B
380
380
  )
381
381
  end
382
382
 
383
- decoded_jwt = authenticate_jwt_local(session_jwt: session_jwt, authorization_check: authorization_check)
383
+ decoded_jwt = authenticate_jwt_local(session_jwt, max_token_age_seconds: max_token_age_seconds, authorization_check: authorization_check)
384
384
  return decoded_jwt unless decoded_jwt.nil?
385
385
 
386
386
  authenticate(
@@ -215,7 +215,7 @@ module Stytch
215
215
  )
216
216
  end
217
217
 
218
- session = authenticate_jwt_local(session_jwt)
218
+ session = authenticate_jwt_local(session_jwt, max_token_age_seconds: max_token_age_seconds)
219
219
  if !session.nil?
220
220
  { 'session' => session }
221
221
  else
@@ -237,6 +237,7 @@ module Stytch
237
237
  # Parse a JWT and verify the signature locally (without calling /authenticate in the API)
238
238
  # Uses the cached value to get the JWK but if it is unavailable, it calls the get_jwks()
239
239
  # function to get the JWK
240
+ # This method never authenticates a JWT directly with the API
240
241
  # If max_token_age_seconds is not supplied 300 seconds will be used as the default.
241
242
  def authenticate_jwt_local(session_jwt, max_token_age_seconds: nil)
242
243
  max_token_age_seconds = 300 if max_token_age_seconds.nil?
@@ -245,6 +246,7 @@ module Stytch
245
246
  begin
246
247
  decoded_token = JWT.decode session_jwt, nil, true,
247
248
  { jwks: @jwks_loader, iss: issuer, verify_iss: true, aud: @project_id, verify_aud: true, algorithms: ['RS256'] }
249
+
248
250
  session = decoded_token[0]
249
251
  iat_time = Time.at(session['iat']).to_datetime
250
252
  return nil unless iat_time + max_token_age_seconds >= Time.now
@@ -272,15 +274,17 @@ module Stytch
272
274
  reserved_claims = ['aud', 'exp', 'iat', 'iss', 'jti', 'nbf', 'sub', stytch_claim]
273
275
  custom_claims = jwt.reject { |key, _| reserved_claims.include?(key) }
274
276
  {
275
- 'session_id' => jwt[stytch_claim]['id'],
276
- 'user_id' => jwt['sub'],
277
- 'started_at' => jwt[stytch_claim]['started_at'],
278
- 'last_accessed_at' => jwt[stytch_claim]['last_accessed_at'],
279
- # For JWTs that include it, prefer the inner expires_at claim.
280
- 'expires_at' => expires_at,
281
- 'attributes' => jwt[stytch_claim]['attributes'],
282
- 'authentication_factors' => jwt[stytch_claim]['authentication_factors'],
283
- 'custom_claims' => custom_claims
277
+ 'session' => {
278
+ 'session_id' => jwt[stytch_claim]['id'],
279
+ 'user_id' => jwt['sub'],
280
+ 'started_at' => jwt[stytch_claim]['started_at'],
281
+ 'last_accessed_at' => jwt[stytch_claim]['last_accessed_at'],
282
+ # For JWTs that include it, prefer the inner expires_at claim.
283
+ 'expires_at' => expires_at,
284
+ 'attributes' => jwt[stytch_claim]['attributes'],
285
+ 'authentication_factors' => jwt[stytch_claim]['authentication_factors'],
286
+ 'custom_claims' => custom_claims
287
+ }
284
288
  }
285
289
  end
286
290
  # ENDMANUAL(Sessions::authenticate_jwt)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '7.0.0'
4
+ VERSION = '7.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-13 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday