clerk-sdk-ruby 4.1.0 → 4.2.0
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 +42 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +22 -18
- data/clerk-sdk-ruby.gemspec +3 -3
- data/lib/clerk/authenticate_context.rb +4 -4
- data/lib/clerk/constants.rb +3 -4
- data/lib/clerk/rack_middleware.rb +1 -1
- data/lib/clerk/sdk.rb +3 -3
- data/lib/clerk/utils.rb +22 -0
- data/lib/clerk/version.rb +1 -1
- metadata +7 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d73e8c0d702443d6715799708a1a2dab6de8667c3a9ba655d60e462587eebbb
|
4
|
+
data.tar.gz: 5d6194058d16f155e868199472684f26ec981d9c6a1fe33a433221600ddf10cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f75517c210e9d8811d4a2e3405e4d0c7e9ea3c448cb290d069d51e12897f9363d441f8b1f7b7846b83eaadd5aba4388bb43c83faf116bddf179b6902293c7394
|
7
|
+
data.tar.gz: 780f4cc23e135a8dc90e5a50b19c80022322eb47626d43bacc3b7570c02c2bd88aaa7c4c9bd51b5833b85bcfde70de4c8d7cfa681a9eb2cae92bd54e267888f1
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,47 @@
|
|
1
|
+
## 4.2.0 - 2025-05-20
|
2
|
+
|
3
|
+
- feat: Add explicit support for lowercased headers [https://github.com/clerk/clerk-sdk-ruby/pull/93]
|
4
|
+
- fix: Ensure resiliency of v2 JWT organization claims [https://github.com/clerk/clerk-sdk-ruby/pull/94]
|
5
|
+
- feat: Enable support for older versions of Rack [https://github.com/clerk/clerk-sdk-ruby/pull/95]
|
6
|
+
- chore: Update dependencies
|
7
|
+
|
1
8
|
## 4.1.0 - 2025-04-10
|
2
9
|
|
3
|
-
- feat: Add support for
|
10
|
+
- feat: Add support for token v2 org claims [https://github.com/clerk/clerk-sdk-ruby/pull/89]
|
11
|
+
- feat: Emit `Clerk-Version-API` header [https://github.com/clerk/clerk-sdk-ruby/pull/89]
|
12
|
+
|
13
|
+
## 4.0.1 - 2025-01-27
|
14
|
+
|
15
|
+
- fix: Ensure that the logger was being correctly passed to the API client [https://github.com/clerk/clerk-sdk-ruby/pull/87]
|
16
|
+
- docs: Expand sections within the README [https://github.com/clerk/clerk-sdk-ruby/pull/86]
|
17
|
+
|
18
|
+
## 4.0.0 - 2025-01-27
|
19
|
+
|
20
|
+
- chore: Relese v4.0.0 based on v4.0.0.beta7 [https://github.com/clerk/clerk-sdk-ruby/pull/85]
|
21
|
+
|
22
|
+
## 4.0.0.beta7 - 2025-01-27
|
23
|
+
|
24
|
+
- chore: Bump dependency versions [https://github.com/clerk/clerk-sdk-ruby/pull/82]
|
25
|
+
|
26
|
+
## 4.0.0.beta6 - 2025-01-27
|
27
|
+
|
28
|
+
- feat: Allows for users to be able to skip the automatic addition of the Clerk Middleware via Railties. [https://github.com/clerk/clerk-sdk-ruby/pull/81]
|
29
|
+
- build: Introduces a repeatable release flow. [https://github.com/clerk/clerk-sdk-ruby/pull/81]
|
30
|
+
|
31
|
+
## 4.0.0.beta5 - 2025-01-27
|
32
|
+
|
33
|
+
[BREAKING] This release introduces our new `clerk-http-client` gem, which is a generated directly from the Clerk API OpenAPI specs. This will help to ensure that the SDK is always in sync with the Clerk API.
|
34
|
+
|
35
|
+
- feat: Add support for the `clerk-http-client` gem [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
36
|
+
- feat: Add support for Revalidation [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
37
|
+
- feat: Add support for Rails API mode [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
38
|
+
- feat: Add support for Sinatra [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
39
|
+
- feat: Middleware cache defaults to `Rails.cache` -> `ActiveSupport::Cache::MemoryStore` (if available) -> no caching [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
40
|
+
- chore: Refactor Clerk helper methods for Rails and Rack [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
41
|
+
- fix: Update configuration naming of `api_key` to `secret_key` [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
42
|
+
- docs: Add example applications for Rails, Sinatra, and Rack under `apps/` [https://github.com/clerk/clerk-sdk-ruby/pull/77]
|
43
|
+
|
44
|
+
|
4
45
|
|
5
46
|
## 4.0.0.beta4 - 2025-01-06
|
6
47
|
|
data/Gemfile
CHANGED
@@ -9,13 +9,13 @@ group :development do
|
|
9
9
|
gem "activesupport", "~> 8.0", require: false
|
10
10
|
gem "dotenv", "~> 3.1", require: false
|
11
11
|
gem "puma", "~> 6.4", ">= 6.4.3", require: false
|
12
|
-
gem "rack", "~> 3.1", ">= 3.1.
|
12
|
+
gem "rack", "~> 3.1", ">= 3.1.14", require: false
|
13
13
|
gem "rbs", "~> 3.6"
|
14
14
|
gem "rake", "~> 13.0"
|
15
15
|
gem "rackup", "~> 2.2", require: false
|
16
16
|
gem "rb-fsevent", "~> 0.11", ">= 0.11.2", platform: [:ruby], require: false
|
17
17
|
gem "rerun", "~> 0.14", require: false
|
18
|
-
gem "sinatra", "~> 4.1", require: false
|
18
|
+
gem "sinatra", "~> 4.1", ">= 4.1.1", require: false
|
19
19
|
gem "standard", "~> 1.42"
|
20
20
|
gem "wdm", "~> 0.2", platform: [:mswin, :windows]
|
21
21
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clerk-sdk-ruby (4.
|
4
|
+
clerk-sdk-ruby (4.2.0)
|
5
5
|
clerk-http-client (~> 2.0)
|
6
6
|
concurrent-ruby (~> 1.1)
|
7
7
|
faraday (>= 1.4.1, < 3.0)
|
@@ -130,9 +130,10 @@ GEM
|
|
130
130
|
shellany (~> 0.0)
|
131
131
|
ostruct (0.6.1)
|
132
132
|
parallel (1.26.3)
|
133
|
-
parser (3.3.
|
133
|
+
parser (3.3.8.0)
|
134
134
|
ast (~> 2.4.1)
|
135
135
|
racc
|
136
|
+
prism (1.4.0)
|
136
137
|
pry (0.15.2)
|
137
138
|
coderay (~> 1.1)
|
138
139
|
method_source (~> 1.0)
|
@@ -142,7 +143,7 @@ GEM
|
|
142
143
|
puma (6.5.0)
|
143
144
|
nio4r (~> 2.0)
|
144
145
|
racc (1.8.1)
|
145
|
-
rack (3.1.
|
146
|
+
rack (3.1.15)
|
146
147
|
rack-protection (4.1.1)
|
147
148
|
base64 (>= 0.1.0)
|
148
149
|
logger (>= 1.6.0)
|
@@ -204,21 +205,24 @@ GEM
|
|
204
205
|
rspec-mocks (~> 3.13)
|
205
206
|
rspec-support (~> 3.13)
|
206
207
|
rspec-support (3.13.2)
|
207
|
-
rubocop (1.
|
208
|
+
rubocop (1.75.6)
|
208
209
|
json (~> 2.3)
|
209
|
-
language_server-protocol (
|
210
|
+
language_server-protocol (~> 3.17.0.2)
|
211
|
+
lint_roller (~> 1.1.0)
|
210
212
|
parallel (~> 1.10)
|
211
213
|
parser (>= 3.3.0.2)
|
212
214
|
rainbow (>= 2.2.2, < 4.0)
|
213
215
|
regexp_parser (>= 2.9.3, < 3.0)
|
214
|
-
rubocop-ast (>= 1.
|
216
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
215
217
|
ruby-progressbar (~> 1.7)
|
216
218
|
unicode-display_width (>= 2.4.0, < 4.0)
|
217
|
-
rubocop-ast (1.
|
218
|
-
parser (>= 3.3.
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
rubocop-ast (1.44.1)
|
220
|
+
parser (>= 3.3.7.2)
|
221
|
+
prism (~> 1.4)
|
222
|
+
rubocop-performance (1.25.0)
|
223
|
+
lint_roller (~> 1.1)
|
224
|
+
rubocop (>= 1.75.0, < 2.0)
|
225
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
222
226
|
ruby-progressbar (1.13.0)
|
223
227
|
ruby2_keywords (0.0.5)
|
224
228
|
securerandom (0.4.1)
|
@@ -236,18 +240,18 @@ GEM
|
|
236
240
|
rack-protection (= 4.1.1)
|
237
241
|
rack-session (>= 2.0.0, < 3)
|
238
242
|
tilt (~> 2.0)
|
239
|
-
standard (1.
|
243
|
+
standard (1.50.0)
|
240
244
|
language_server-protocol (~> 3.17.0.2)
|
241
245
|
lint_roller (~> 1.0)
|
242
|
-
rubocop (~> 1.
|
246
|
+
rubocop (~> 1.75.5)
|
243
247
|
standard-custom (~> 1.0.0)
|
244
|
-
standard-performance (~> 1.
|
248
|
+
standard-performance (~> 1.8)
|
245
249
|
standard-custom (1.0.2)
|
246
250
|
lint_roller (~> 1.0)
|
247
251
|
rubocop (~> 1.50)
|
248
|
-
standard-performance (1.
|
252
|
+
standard-performance (1.8.0)
|
249
253
|
lint_roller (~> 1.1)
|
250
|
-
rubocop-performance (~> 1.
|
254
|
+
rubocop-performance (~> 1.25.0)
|
251
255
|
stringio (3.1.2)
|
252
256
|
thor (1.3.2)
|
253
257
|
tilt (2.5.0)
|
@@ -277,7 +281,7 @@ DEPENDENCIES
|
|
277
281
|
guard-rake (~> 1.0)
|
278
282
|
guard-rspec (~> 4.7)
|
279
283
|
puma (~> 6.4, >= 6.4.3)
|
280
|
-
rack (~> 3.1, >= 3.1.
|
284
|
+
rack (~> 3.1, >= 3.1.14)
|
281
285
|
rackup (~> 2.2)
|
282
286
|
rake (~> 13.0)
|
283
287
|
rb-fsevent (~> 0.11, >= 0.11.2)
|
@@ -286,7 +290,7 @@ DEPENDENCIES
|
|
286
290
|
rspec (~> 3.0)
|
287
291
|
rspec-rails (~> 7.1)
|
288
292
|
simplecov
|
289
|
-
sinatra (~> 4.1)
|
293
|
+
sinatra (~> 4.1, >= 4.1.1)
|
290
294
|
standard (~> 1.42)
|
291
295
|
timecop (~> 0.9.4)
|
292
296
|
wdm (~> 0.2)
|
data/clerk-sdk-ruby.gemspec
CHANGED
@@ -10,13 +10,13 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "Clerk SDK for Ruby."
|
12
12
|
spec.description = "Client SDK for the Clerk"
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/clerk/clerk-sdk-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/clerk/clerk-sdk-ruby"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/clerk/clerk-sdk-ruby/blob/main/CHANGELOG.md"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -31,12 +31,12 @@ module Clerk
|
|
31
31
|
})
|
32
32
|
|
33
33
|
@headers = OpenStruct.new({
|
34
|
-
accept: request
|
34
|
+
accept: Utils.retrieve_header_from_request(request, ACCEPT_HEADER),
|
35
35
|
host: request.host,
|
36
|
-
origin: request
|
36
|
+
origin: Utils.retrieve_header_from_request(request, ORIGIN_HEADER),
|
37
37
|
port: request.port,
|
38
|
-
sec_fetch_dest: request
|
39
|
-
session_token_in_header: request
|
38
|
+
sec_fetch_dest: Utils.retrieve_header_from_request(request, SEC_FETCH_DEST_HEADER),
|
39
|
+
session_token_in_header: Utils.retrieve_header_from_request(request, AUTHORIZATION_HEADER).gsub(/bearer/i, "").strip
|
40
40
|
})
|
41
41
|
end
|
42
42
|
|
data/lib/clerk/constants.rb
CHANGED
@@ -12,11 +12,10 @@ module Clerk
|
|
12
12
|
HANDSHAKE_COOKIE_DIRECTIVES_KEY = "handshake"
|
13
13
|
|
14
14
|
# auth debug response headers
|
15
|
-
AUTH_STATUS_HEADER = "
|
16
|
-
AUTH_REASON_HEADER = "
|
17
|
-
AUTH_MESSAGE_HEADER = "
|
15
|
+
AUTH_STATUS_HEADER = "x-clerk-auth-status"
|
16
|
+
AUTH_REASON_HEADER = "x-clerk-auth-reason"
|
17
|
+
AUTH_MESSAGE_HEADER = "x-clerk-auth-message"
|
18
18
|
|
19
|
-
CONTENT_TYPE_HEADER = "Content-Type"
|
20
19
|
SEC_FETCH_DEST_HEADER = "HTTP_SEC_FETCH_DEST"
|
21
20
|
|
22
21
|
# headers used in response - should be lowered case and without http prefix
|
@@ -63,7 +63,7 @@ module Clerk
|
|
63
63
|
def set_cookie_headers!(headers, cookie_headers)
|
64
64
|
cookie_headers.each do |cookie_header|
|
65
65
|
cookie_key = parse_cookie_key(cookie_header)
|
66
|
-
cookie = ::
|
66
|
+
cookie = ::Clerk::Utils.parse_cookies_header(cookie_header)
|
67
67
|
cookie_params = convert_http_cookie_to_cookie_setter_params(cookie_key, cookie)
|
68
68
|
::Rack::Utils.set_cookie_header!(headers, cookie_key, cookie_params)
|
69
69
|
end
|
data/lib/clerk/sdk.rb
CHANGED
@@ -63,9 +63,9 @@ module Clerk
|
|
63
63
|
private
|
64
64
|
|
65
65
|
def compute_org_permissions_from_v2_token(claims)
|
66
|
-
features = claims["fea"].split(",")
|
67
|
-
permissions = claims["o"]["per"].split(",")
|
68
|
-
mappings = claims["o"]["fpm"].split(",")
|
66
|
+
features = claims["fea"] ? claims["fea"].split(",") : []
|
67
|
+
permissions = claims["o"]["per"] ? claims["o"]["per"].split(",") : []
|
68
|
+
mappings = claims["o"]["fpm"] ? claims["o"]["fpm"].split(",") : []
|
69
69
|
org_permissions = []
|
70
70
|
|
71
71
|
mappings.each_with_index do |mapping, i|
|
data/lib/clerk/utils.rb
CHANGED
@@ -28,6 +28,10 @@ module Clerk
|
|
28
28
|
[filtered_routes, filtered_wildcard_routes]
|
29
29
|
end
|
30
30
|
|
31
|
+
def retrieve_header_from_request(request, key)
|
32
|
+
(request.env[key] || request.env[key.downcase]).to_s
|
33
|
+
end
|
34
|
+
|
31
35
|
def retrieve_from_query_string(url, key)
|
32
36
|
::Rack::Utils.parse_query(url.query)[key]
|
33
37
|
end
|
@@ -46,6 +50,24 @@ module Clerk
|
|
46
50
|
def valid_publishable_key_prefix?(publishable_key)
|
47
51
|
publishable_key.start_with?("pk_live_", "pk_test_")
|
48
52
|
end
|
53
|
+
|
54
|
+
# NOTE: This is a copy of Rack::Utils.parse_cookies_header to allow for
|
55
|
+
# compatibility with older versions of Rack.
|
56
|
+
def parse_cookies_header(value)
|
57
|
+
return {} unless value
|
58
|
+
|
59
|
+
value.split(/; */n).each_with_object({}) do |cookie, cookies|
|
60
|
+
next if cookie.empty?
|
61
|
+
key, value = cookie.split('=', 2)
|
62
|
+
cookies[key] = (unescape(value) rescue value) unless cookies.key?(key)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def unescape(s, encoding = Encoding::UTF_8)
|
69
|
+
URI.decode_www_form_component(s, encoding)
|
70
|
+
end
|
49
71
|
end
|
50
72
|
end
|
51
73
|
end
|
data/lib/clerk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clerk-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clerk
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-05-20 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -300,14 +299,13 @@ files:
|
|
300
299
|
- lib/clerk/sinatra.rb
|
301
300
|
- lib/clerk/utils.rb
|
302
301
|
- lib/clerk/version.rb
|
303
|
-
homepage: https://github.com/
|
302
|
+
homepage: https://github.com/clerk/clerk-sdk-ruby
|
304
303
|
licenses:
|
305
304
|
- MIT
|
306
305
|
metadata:
|
307
|
-
homepage_uri: https://github.com/
|
308
|
-
source_code_uri: https://github.com/
|
309
|
-
changelog_uri: https://github.com/
|
310
|
-
post_install_message:
|
306
|
+
homepage_uri: https://github.com/clerk/clerk-sdk-ruby
|
307
|
+
source_code_uri: https://github.com/clerk/clerk-sdk-ruby
|
308
|
+
changelog_uri: https://github.com/clerk/clerk-sdk-ruby/blob/main/CHANGELOG.md
|
311
309
|
rdoc_options: []
|
312
310
|
require_paths:
|
313
311
|
- lib
|
@@ -322,8 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
320
|
- !ruby/object:Gem::Version
|
323
321
|
version: '0'
|
324
322
|
requirements: []
|
325
|
-
rubygems_version: 3.
|
326
|
-
signing_key:
|
323
|
+
rubygems_version: 3.6.2
|
327
324
|
specification_version: 4
|
328
325
|
summary: Clerk SDK for Ruby.
|
329
326
|
test_files: []
|