clerk-sdk-ruby 2.0.0.alpha.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +8 -3
- data/README.md +10 -10
- data/lib/clerk/rack_middleware_v2.rb +15 -2
- data/lib/clerk/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 692cc6e564176d884eb9697a0bfe4a02affda01032c73a9bf704700e45265e4f
|
4
|
+
data.tar.gz: 1f425dd5b92b2bb51e20661d2415c4c1d094c781c2b4a7c0b0199dce29897c74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6497dff3fb8bc8f9a32747dd790a8481571d5b460ee83737c9ca6e43ef98db1dfa5fb8277d10f79b516c62fc58233088dcebd3aa3fd7770ba1f6311d7881b57
|
7
|
+
data.tar.gz: 8ed32ac76cdd9d9c3615375310808919b139bfc22480a2cdcd05cd8ec1a2b3ce68c62864576c91694888e2164856c341577dc89a2adede157996e68421b3fa1f
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
## unreleased
|
2
2
|
|
3
|
-
|
4
|
-
with the new authentication scheme, dubbed *AuthV2*.
|
3
|
+
## 2.0.0 - 2021-10-21
|
5
4
|
|
6
|
-
|
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)
|
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
|
-
|
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
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.
|
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
|
+
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:
|
128
|
+
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubygems_version: 3.2.5
|
131
131
|
signing_key:
|