stytch 5.0.0 → 5.0.1

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: 48c88e32cfa3d135b1049e3c3d8e68883a119dd7d5a2bfcf75b60a576da4dffa
4
- data.tar.gz: c3bce6ed9f922eaaa0aafab1b7f240fddc1f8e6001c192c8e0c41b05a1ac58e5
3
+ metadata.gz: 89ba7dd82a7b83f59993ca690783c18a24d88db3983f368f9f4776b1602da32f
4
+ data.tar.gz: c0ffc05e0bf57dffaff54ada79228a529fea488751de7671a0820786ea7aad2c
5
5
  SHA512:
6
- metadata.gz: 2d876756802645c4e39fc45ea4059001cb55746144c1ff6cc4b2b64ef3d05bacb68b104276e79728cf3ce91decb9bc7143b8c787d133d15d4eb3744a40896b47
7
- data.tar.gz: b3e3ba19c90c0ebe631a2adc97662762932afd3ac3fe48cf4a5dbadae8d43cd01639a2db5e491cf057eee97a23693fb3fd45fd681f4884cd0e2bfbbb618513dd
6
+ metadata.gz: 3fddea4b5be224b45064351070d4123eedd9595f7c4c504293588be2fea6849c71ca16d00a195f04ef07d70c951a4b69fe941d5b3539a00a7acaf64e8b414217
7
+ data.tar.gz: 22f669434d9db214da10976d041a96759be082877bf4e20df38b822e51824fcb5b4803da7d3ba8c710fd5334224d1718592800a3b6da79f121612a8976560457
@@ -137,6 +137,11 @@ module Stytch
137
137
  def marshal_jwt_into_session(jwt)
138
138
  stytch_claim = "https://stytch.com/session"
139
139
  expires_at = jwt[stytch_claim]["expires_at"] || Time.at(jwt["exp"]).to_datetime.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
140
+ # The custom claim set is all the claims in the payload except for the standard claims and
141
+ # the Stytch session claim. The cleanest way to collect those seems to be naming what we want
142
+ # to omit and filtering the rest to collect the custom claims.
143
+ reserved_claims = ['aud', 'exp', 'iat', 'iss', 'jti', 'nbf', 'sub', stytch_claim]
144
+ custom_claims = jwt.reject { |key, _| reserved_claims.include?(key) }
140
145
  return {
141
146
  "session_id" => jwt[stytch_claim]["id"],
142
147
  "user_id" => jwt["sub"],
@@ -146,6 +151,7 @@ module Stytch
146
151
  "expires_at" => expires_at,
147
152
  "attributes" => jwt[stytch_claim]["attributes"],
148
153
  "authentication_factors" => jwt[stytch_claim]["authentication_factors"],
154
+ "custom_claims" => custom_claims,
149
155
  }
150
156
  end
151
157
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '5.0.0'
4
+ VERSION = '5.0.1'
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: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-14 00:00:00.000000000 Z
11
+ date: 2023-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday