clerk-sdk-ruby 2.9.0 → 2.10.0.beta2
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/CHANGELOG.md +8 -0
 - data/CODEOWNERS +1 -0
 - data/Gemfile.lock +6 -5
 - data/lib/clerk/rack_middleware_v2.rb +28 -8
 - data/lib/clerk/version.rb +1 -1
 - metadata +9 -9
 - data/lib/clerk/proxy.rb +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7a9cc4880855663a951169e9f5898ec94e3693b048e86c84feae5dbfd4aa1318
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 19883dc888a73800890edcf438443fc3ceb529c971829b3b079b884933136417
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e3f51660a5c2e56cffb7e681ddf31b5155d37ed5cd87a85f93be09b39493ee9e82eb7f0cb12fb19089119f296fb58cfdbc43392e6034da0298cfdce60957df86
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c236853329fb8c0ac1d62b9324dda4daab54d4de034b639ea9dc8425440ae3bb30e29c0e795dd1621a3d805801e35744d45943372ec32b39acff842702152428
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ## unreleased
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 2.10.0.beta2 - 2023-03-08
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            - fix: incorrect usage keyword parameter (fix for 2.10.0.beta1)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## 2.10.0.beta1 - 2023-03-08
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            - fix: Change signed-out & interstitial request state conditions [https://github.com/clerkinc/clerk-sdk-ruby/pull/30]
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       3 
11 
     | 
    
         
             
            ## 2.9.0
         
     | 
| 
       4 
12 
     | 
    
         | 
| 
       5 
13 
     | 
    
         
             
            Identical to 2.9.0.beta3
         
     | 
    
        data/CODEOWNERS
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            * @clerkinc/backend-team
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                clerk-sdk-ruby (2. 
     | 
| 
      
 4 
     | 
    
         
            +
                clerk-sdk-ruby (2.10.0.beta2)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  concurrent-ruby (~> 1.1)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  faraday (~> 1.4.1)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  jwt (~> 2.5)
         
     | 
| 
         @@ -10,7 +10,7 @@ GEM 
     | 
|
| 
       10 
10 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
       11 
11 
     | 
    
         
             
              specs:
         
     | 
| 
       12 
12 
     | 
    
         
             
                byebug (11.1.3)
         
     | 
| 
       13 
     | 
    
         
            -
                concurrent-ruby (1. 
     | 
| 
      
 13 
     | 
    
         
            +
                concurrent-ruby (1.2.2)
         
     | 
| 
       14 
14 
     | 
    
         
             
                faraday (1.4.3)
         
     | 
| 
       15 
15 
     | 
    
         
             
                  faraday-em_http (~> 1.0)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  faraday-em_synchrony (~> 1.0)
         
     | 
| 
         @@ -24,14 +24,15 @@ GEM 
     | 
|
| 
       24 
24 
     | 
    
         
             
                faraday-excon (1.1.0)
         
     | 
| 
       25 
25 
     | 
    
         
             
                faraday-net_http (1.0.1)
         
     | 
| 
       26 
26 
     | 
    
         
             
                faraday-net_http_persistent (1.2.0)
         
     | 
| 
       27 
     | 
    
         
            -
                jwt (2. 
     | 
| 
       28 
     | 
    
         
            -
                minitest (5. 
     | 
| 
       29 
     | 
    
         
            -
                multipart-post (2. 
     | 
| 
      
 27 
     | 
    
         
            +
                jwt (2.7.0)
         
     | 
| 
      
 28 
     | 
    
         
            +
                minitest (5.18.0)
         
     | 
| 
      
 29 
     | 
    
         
            +
                multipart-post (2.3.0)
         
     | 
| 
       30 
30 
     | 
    
         
             
                rake (13.0.6)
         
     | 
| 
       31 
31 
     | 
    
         
             
                ruby2_keywords (0.0.5)
         
     | 
| 
       32 
32 
     | 
    
         
             
                timecop (0.9.6)
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
      
 35 
     | 
    
         
            +
              arm64-darwin-22
         
     | 
| 
       35 
36 
     | 
    
         
             
              universal-darwin-21
         
     | 
| 
       36 
37 
     | 
    
         
             
              x86_64-linux
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
         @@ -124,8 +124,12 @@ module Clerk 
     | 
|
| 
       124 
124 
     | 
    
         
             
                      return signed_out(env)  # malformed JSON authorization header
         
     | 
| 
       125 
125 
     | 
    
         
             
                    end
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
       127 
     | 
    
         
            -
                     
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
      
 127 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 128 
     | 
    
         
            +
                      token = verify_token(header_token)
         
     | 
| 
      
 129 
     | 
    
         
            +
                      return signed_in(env, token, header_token) if token
         
     | 
| 
      
 130 
     | 
    
         
            +
                    rescue JWT::ExpiredSignature, JWT::InvalidIatError
         
     | 
| 
      
 131 
     | 
    
         
            +
                      unknown(interstitial: false)
         
     | 
| 
      
 132 
     | 
    
         
            +
                    end
         
     | 
| 
       129 
133 
     | 
    
         | 
| 
       130 
134 
     | 
    
         
             
                    # Clerk.js should refresh the token and retry
         
     | 
| 
       131 
135 
     | 
    
         
             
                    return unknown(interstitial: false)
         
     | 
| 
         @@ -162,10 +166,15 @@ module Clerk 
     | 
|
| 
       162 
166 
     | 
    
         
             
                    return signed_out(env)
         
     | 
| 
       163 
167 
     | 
    
         
             
                  end
         
     | 
| 
       164 
168 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
                   
     | 
| 
      
 169 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 170 
     | 
    
         
            +
                    token = verify_token(cookie_token)
         
     | 
| 
      
 171 
     | 
    
         
            +
                    return signed_out(env) if !token
         
     | 
| 
       166 
172 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
      
 173 
     | 
    
         
            +
                    if token["iat"] && client_uat && Integer(client_uat) <= token["iat"]
         
     | 
| 
      
 174 
     | 
    
         
            +
                      return signed_in(env, token, cookie_token)
         
     | 
| 
      
 175 
     | 
    
         
            +
                    end
         
     | 
| 
      
 176 
     | 
    
         
            +
                  rescue JWT::ExpiredSignature, JWT::InvalidIatError
         
     | 
| 
      
 177 
     | 
    
         
            +
                    unknown(interstitial: true)
         
     | 
| 
       169 
178 
     | 
    
         
             
                  end
         
     | 
| 
       170 
179 
     | 
    
         | 
| 
       171 
180 
     | 
    
         
             
                  unknown(interstitial: true)
         
     | 
| 
         @@ -186,11 +195,11 @@ module Clerk 
     | 
|
| 
       186 
195 
     | 
    
         
             
                end
         
     | 
| 
       187 
196 
     | 
    
         | 
| 
       188 
197 
     | 
    
         
             
                # Outcome C
         
     | 
| 
       189 
     | 
    
         
            -
                def unknown(interstitial: false)
         
     | 
| 
       190 
     | 
    
         
            -
                  return [401,  
     | 
| 
      
 198 
     | 
    
         
            +
                def unknown(interstitial: false, **opts)
         
     | 
| 
      
 199 
     | 
    
         
            +
                  return [401, interstitial_headers(**opts), []] if !interstitial
         
     | 
| 
       191 
200 
     | 
    
         | 
| 
       192 
201 
     | 
    
         
             
                  # Load Clerk.js to update the __session and __client_uat cookies.
         
     | 
| 
       193 
     | 
    
         
            -
                  [401,  
     | 
| 
      
 202 
     | 
    
         
            +
                  [401, interstitial_headers(**opts), [sdk.interstitial]]
         
     | 
| 
       194 
203 
     | 
    
         
             
                end
         
     | 
| 
       195 
204 
     | 
    
         | 
| 
       196 
205 
     | 
    
         
             
                def development_or_staging?
         
     | 
| 
         @@ -231,6 +240,8 @@ module Clerk 
     | 
|
| 
       231 
240 
     | 
    
         | 
| 
       232 
241 
     | 
    
         
             
                  begin
         
     | 
| 
       233 
242 
     | 
    
         
             
                    sdk.verify_token(token)
         
     | 
| 
      
 243 
     | 
    
         
            +
                  rescue JWT::ExpiredSignature, JWT::InvalidIatError => e
         
     | 
| 
      
 244 
     | 
    
         
            +
                    raise e
         
     | 
| 
       234 
245 
     | 
    
         
             
                  rescue JWT::DecodeError, JWT::RequiredDependencyError => e
         
     | 
| 
       235 
246 
     | 
    
         
             
                    false
         
     | 
| 
       236 
247 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -239,5 +250,14 @@ module Clerk 
     | 
|
| 
       239 
250 
     | 
    
         
             
                def sdk
         
     | 
| 
       240 
251 
     | 
    
         
             
                  Clerk::SDK.new
         
     | 
| 
       241 
252 
     | 
    
         
             
                end
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
                def interstitial_headers(reason: nil, message: nil, status: nil)
         
     | 
| 
      
 255 
     | 
    
         
            +
                  {
         
     | 
| 
      
 256 
     | 
    
         
            +
                    "Content-Type" => "text/html",
         
     | 
| 
      
 257 
     | 
    
         
            +
                    "X-Clerk-Auth-Reason" => reason,
         
     | 
| 
      
 258 
     | 
    
         
            +
                    "X-Clerk-Auth-Message" => message,
         
     | 
| 
      
 259 
     | 
    
         
            +
                    "X-Clerk-Auth-Status" => status,
         
     | 
| 
      
 260 
     | 
    
         
            +
                  }.compact
         
     | 
| 
      
 261 
     | 
    
         
            +
                end
         
     | 
| 
       242 
262 
     | 
    
         
             
              end
         
     | 
| 
       243 
263 
     | 
    
         
             
            end
         
     | 
    
        data/lib/clerk/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: clerk-sdk-ruby
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.10.0.beta2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Clerk
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-03-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -90,6 +90,7 @@ files: 
     | 
|
| 
       90 
90 
     | 
    
         
             
            - ".github/workflows/main.yml"
         
     | 
| 
       91 
91 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       92 
92 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
      
 93 
     | 
    
         
            +
            - CODEOWNERS
         
     | 
| 
       93 
94 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       94 
95 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       95 
96 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
         @@ -104,7 +105,6 @@ files: 
     | 
|
| 
       104 
105 
     | 
    
         
             
            - lib/clerk/authenticatable.rb
         
     | 
| 
       105 
106 
     | 
    
         
             
            - lib/clerk/errors.rb
         
     | 
| 
       106 
107 
     | 
    
         
             
            - lib/clerk/jwks_cache.rb
         
     | 
| 
       107 
     | 
    
         
            -
            - lib/clerk/proxy.rb
         
     | 
| 
       108 
108 
     | 
    
         
             
            - lib/clerk/rack_middleware.rb
         
     | 
| 
       109 
109 
     | 
    
         
             
            - lib/clerk/rack_middleware_v2.rb
         
     | 
| 
       110 
110 
     | 
    
         
             
            - lib/clerk/railtie.rb
         
     | 
| 
         @@ -132,7 +132,7 @@ metadata: 
     | 
|
| 
       132 
132 
     | 
    
         
             
              homepage_uri: https://github.com/clerkinc/clerk-sdk-ruby
         
     | 
| 
       133 
133 
     | 
    
         
             
              source_code_uri: https://github.com/clerkinc/clerk-sdk-ruby
         
     | 
| 
       134 
134 
     | 
    
         
             
              changelog_uri: https://github.com/clerkinc/clerk-sdk-ruby/blob/main/CHANGELOG.md
         
     | 
| 
       135 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 135 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       136 
136 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       137 
137 
     | 
    
         
             
            require_paths:
         
     | 
| 
       138 
138 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -143,12 +143,12 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       143 
143 
     | 
    
         
             
                  version: 2.4.0
         
     | 
| 
       144 
144 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       145 
145 
     | 
    
         
             
              requirements:
         
     | 
| 
       146 
     | 
    
         
            -
              - - " 
     | 
| 
      
 146 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       147 
147 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       148 
     | 
    
         
            -
                  version:  
     | 
| 
      
 148 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       149 
149 
     | 
    
         
             
            requirements: []
         
     | 
| 
       150 
     | 
    
         
            -
            rubygems_version: 3.3 
     | 
| 
       151 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 150 
     | 
    
         
            +
            rubygems_version: 3.2.3
         
     | 
| 
      
 151 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       152 
152 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       153 
153 
     | 
    
         
             
            summary: Clerk SDK for Ruby.
         
     | 
| 
       154 
154 
     | 
    
         
             
            test_files: []
         
     | 
    
        data/lib/clerk/proxy.rb
    DELETED
    
    | 
         
            File without changes
         
     |