clerk-sdk-ruby 2.0.0.alpha.1 → 2.0.3

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: 1e7b69485de55997a4dac75759908e7709dcb7fdb83c92fe09d2c4748a0a74f7
4
- data.tar.gz: a0afbe19f7d6a7a9a998e82b798a8a548f051505e14f3b1d50688d2aaa436d7f
3
+ metadata.gz: 692cc6e564176d884eb9697a0bfe4a02affda01032c73a9bf704700e45265e4f
4
+ data.tar.gz: 1f425dd5b92b2bb51e20661d2415c4c1d094c781c2b4a7c0b0199dce29897c74
5
5
  SHA512:
6
- metadata.gz: 062e4297db4b8b20e1a6ed6bf6d69a2b0f2df0f5aecc5d716e6b883877fea484476c9d75bf7e7fda294b88774b707b60fd09a85604f7f9363b1161f622d4947a
7
- data.tar.gz: 50ecd09031d4383b5d136840f8457841253c86122fb3a4a8769d8d86553fb3d2ff9323f0cb98bdde68f4990d2c4cc955b9996a3fca09a0c597e10a7bbb39d8eb
6
+ metadata.gz: f6497dff3fb8bc8f9a32747dd790a8481571d5b460ee83737c9ca6e43ef98db1dfa5fb8277d10f79b516c62fc58233088dcebd3aa3fd7770ba1f6311d7881b57
7
+ data.tar.gz: 8ed32ac76cdd9d9c3615375310808919b139bfc22480a2cdcd05cd8ec1a2b3ce68c62864576c91694888e2164856c341577dc89a2adede157996e68421b3fa1f
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /tmp/
9
9
 
10
10
  .byebug_history
11
+ *.gem
data/CHANGELOG.md CHANGED
@@ -1,13 +1,18 @@
1
1
  ## unreleased
2
2
 
3
- This release (v2) introduces the new networkless middleware which is compatible
4
- with the new authentication scheme, dubbed *AuthV2*.
3
+ ## 2.0.0 - 2021-10-21
5
4
 
6
- It is backwards-incompatible with applications using AuthV1.
5
+ This release introduces the new networkless middleware which works with the new
6
+ authentication scheme, [Auth v2](https://docs.clerk.dev/main-concepts/auth-v2).
7
+
8
+ It is backwards-incompatible with applications using Auth v1.
7
9
 
8
10
  - [BREAKING]: In order to use this version, you must set the authVersion prop
9
11
  accordingly in your frontend: `Clerk.load({authVersion: 2})`
10
12
 
13
+ For more information on Auth v2, please refer to
14
+ https://docs.clerk.dev/main-concepts/auth-v2.
15
+
11
16
  ## 1.0.3 - 2021-07-21
12
17
 
13
18
  - fix: Proper endpoint for oauth_access_token method
data/README.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # Clerk Ruby SDK
2
2
 
3
- **NOTE**: This is the v2 branch of the SDK, which requires that you use AuthV2
4
- in your frontend. This means that you have to set the `authVersion` prop
5
- accordingly in your frontend:
6
-
7
- ```javascript
8
- Clerk.load({authVersion: 2})
9
- ```
10
-
11
- ----------
12
-
13
3
  Thank you for choosing [Clerk](https://clerk.dev/) for your authentication,
14
4
  session & user management needs!
15
5
 
16
6
  This SDK allows you to call the Clerk Backend API from Ruby code without having
17
7
  to implement the calls yourself.
18
8
 
9
+ ---------
10
+
11
+ **Note**: This is the v2 branch, which requires that you use [Auth
12
+ v2](https://docs.clerk.dev/main-concepts/auth-v2).
13
+
14
+ If you're looking for the legacy authentication scheme (Auth v1), refer to the
15
+ [`main`](https://github.com/clerkinc/clerk-sdk-ruby/tree/main) branch.
16
+
17
+ ----------
18
+
19
19
  ## Installation
20
20
 
21
21
  Add this line to your application's Gemfile:
@@ -86,7 +86,7 @@ module Clerk
86
86
  end
87
87
 
88
88
  # in cross-origin XHRs the use of Authorization header is mandatory.
89
- if cross_origin_request?(@req) && @header_token.nil?
89
+ if cross_origin_request?(@req)
90
90
  return signed_out
91
91
  end
92
92
 
@@ -147,8 +147,21 @@ module Clerk
147
147
  end
148
148
 
149
149
  def cross_origin_request?(req)
150
+ # origin contains scheme+host and optionally port (ommitted if 80 or 443)
151
+ # ref. https://www.rfc-editor.org/rfc/rfc6454#section-6.1
150
152
  origin = req.env["HTTP_ORIGIN"]
151
- origin && origin != req.host
153
+ return false if origin.nil?
154
+
155
+ # strip scheme
156
+ origin = origin.strip.sub(/(^\w+:|^)\/\//, '')
157
+ return false if origin.empty?
158
+
159
+ # Rack's host and port helpers are reverse-proxy-aware; that
160
+ # is, they prefer the de-facto X-Forwarded-* headers if they're set
161
+ request_host = req.host
162
+ request_host << ":#{req.port}" if req.port != 80 && req.port != 443
163
+
164
+ origin != request_host
152
165
  end
153
166
 
154
167
  def verify_token(token)
data/lib/clerk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clerk
4
- VERSION = "2.0.0.alpha.1"
4
+ VERSION = "2.0.3"
5
5
  end
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.0.0.alpha.1
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clerk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-11 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: 2.4.0
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ">"
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
- version: 1.3.1
128
+ version: '0'
129
129
  requirements: []
130
130
  rubygems_version: 3.2.5
131
131
  signing_key: