stytch 4.5.1 → 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: c9ca2dc75f2ca25b9f0609990b4c9df3599138f64eeefe06770fde654f70d55c
4
- data.tar.gz: a139d8d8fb73144cbe19a71e54c8f9580e936b5ba2dbddfeeb68e3d86893ac59
3
+ metadata.gz: 89ba7dd82a7b83f59993ca690783c18a24d88db3983f368f9f4776b1602da32f
4
+ data.tar.gz: c0ffc05e0bf57dffaff54ada79228a529fea488751de7671a0820786ea7aad2c
5
5
  SHA512:
6
- metadata.gz: 2b7b0d1c4cd0ffc3e78b9c683c8874c5752e6f0035c634304508b693512740b370ee0f3dcf4cb2c3d2d5492fbeb7c71f31c4bf9b6a019a8d448722df3ed76cc8
7
- data.tar.gz: cf26ab05e75f8786d7323cdb66f4945a2d74f7ad2e2fb45df20ba42a03e0749f3dbb5328d19fdec13be8e5dfa145c4657828a25e31d1c64ef8e30771d03f6408
6
+ metadata.gz: 3fddea4b5be224b45064351070d4123eedd9595f7c4c504293588be2fea6849c71ca16d00a195f04ef07d70c951a4b69fe941d5b3539a00a7acaf64e8b414217
7
+ data.tar.gz: 22f669434d9db214da10976d041a96759be082877bf4e20df38b822e51824fcb5b4803da7d3ba8c710fd5334224d1718592800a3b6da79f121612a8976560457
data/lib/stytch/client.rb CHANGED
@@ -58,7 +58,7 @@ module Stytch
58
58
  @connection = Faraday.new(url: @api_host) do |builder|
59
59
  block_given? ? yield(builder) : build_default_connection(builder)
60
60
  end
61
- @connection.basic_auth(@project_id, @secret)
61
+ @connection.set_basic_auth(@project_id, @secret)
62
62
  end
63
63
 
64
64
  def build_default_connection(builder)
@@ -7,7 +7,7 @@ require 'uri'
7
7
  require_relative 'version'
8
8
 
9
9
  module Stytch
10
- class Middleware < ::Faraday::Response::Middleware
10
+ class Middleware < ::Faraday::Middleware
11
11
  NETWORK_HEADERS = {
12
12
  'User-Agent' => "Stytch Ruby v#{Stytch::VERSION}",
13
13
  'Content-Type' => 'application/json'
@@ -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 = '4.5.1'
4
+ VERSION = '5.0.1'
5
5
  end
data/lib/stytch.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'faraday'
4
- require 'faraday_middleware'
5
4
 
6
5
  require_relative 'stytch/b2b_client'
7
6
  require_relative 'stytch/client'
data/stytch.gemspec CHANGED
@@ -25,8 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ['lib']
27
27
 
28
- spec.add_dependency 'faraday', '>= 0.17.0', '< 2.0'
29
- spec.add_dependency 'faraday_middleware', '>= 0.14.0', '< 2.0'
28
+ spec.add_dependency 'faraday', '>= 2.0.1', '< 3.0'
30
29
  spec.add_dependency 'json-jwt', '>= 1.13.0'
31
30
  spec.add_dependency 'jwt', '>= 2.3.0'
32
31
 
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: 4.5.1
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-02 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
@@ -16,40 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.17.0
19
+ version: 2.0.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.0'
22
+ version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.17.0
29
+ version: 2.0.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
33
- - !ruby/object:Gem::Dependency
34
- name: faraday_middleware
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 0.14.0
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '2.0'
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 0.14.0
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '2.0'
32
+ version: '3.0'
53
33
  - !ruby/object:Gem::Dependency
54
34
  name: json-jwt
55
35
  requirement: !ruby/object:Gem::Requirement