clerk-sdk-ruby 4.0.0.beta3 → 4.0.0.beta4
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/.env.example +3 -0
- data/.github/workflows/main.yml +22 -14
- data/.gitignore +7 -1
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +26 -3
- data/Gemfile.lock +269 -13
- data/Guardfile +14 -0
- data/README.md +71 -11
- data/Rakefile +50 -6
- data/apps/rack/app.rb +67 -0
- data/apps/rack/config.ru +17 -0
- data/apps/rack/middleware/disable_paths.rb +13 -0
- data/apps/rails-api/.dockerignore +41 -0
- data/apps/rails-api/.gitattributes +9 -0
- data/apps/rails-api/.gitignore +32 -0
- data/apps/rails-api/.kamal/hooks/docker-setup.sample +3 -0
- data/apps/rails-api/.kamal/hooks/post-deploy.sample +14 -0
- data/apps/rails-api/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/apps/rails-api/.kamal/hooks/pre-build.sample +51 -0
- data/apps/rails-api/.kamal/hooks/pre-connect.sample +47 -0
- data/apps/rails-api/.kamal/hooks/pre-deploy.sample +109 -0
- data/apps/rails-api/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/apps/rails-api/.kamal/secrets +17 -0
- data/apps/rails-api/.rubocop.yml +8 -0
- data/apps/rails-api/.ruby-version +1 -0
- data/apps/rails-api/Dockerfile +69 -0
- data/apps/rails-api/Gemfile +54 -0
- data/apps/rails-api/Gemfile.lock +374 -0
- data/apps/rails-api/README.md +24 -0
- data/apps/rails-api/Rakefile +6 -0
- data/apps/rails-api/app/controllers/application_controller.rb +3 -0
- data/apps/rails-api/app/controllers/home_controller.rb +5 -0
- data/apps/rails-api/app/jobs/application_job.rb +7 -0
- data/apps/rails-api/app/mailers/application_mailer.rb +4 -0
- data/apps/rails-api/app/models/application_record.rb +3 -0
- data/apps/rails-api/app/views/layouts/mailer.html.erb +13 -0
- data/apps/rails-api/app/views/layouts/mailer.text.erb +1 -0
- data/apps/rails-api/bin/brakeman +7 -0
- data/apps/rails-api/bin/bundle +109 -0
- data/apps/rails-api/bin/dev +2 -0
- data/apps/rails-api/bin/docker-entrypoint +14 -0
- data/apps/rails-api/bin/jobs +6 -0
- data/apps/rails-api/bin/kamal +27 -0
- data/apps/rails-api/bin/rails +4 -0
- data/apps/rails-api/bin/rake +4 -0
- data/apps/rails-api/bin/rubocop +8 -0
- data/apps/rails-api/bin/setup +34 -0
- data/apps/rails-api/bin/thrust +5 -0
- data/apps/rails-api/config/application.rb +36 -0
- data/apps/rails-api/config/boot.rb +4 -0
- data/apps/rails-api/config/cable.yml +17 -0
- data/apps/rails-api/config/cache.yml +16 -0
- data/apps/rails-api/config/credentials.yml.enc +1 -0
- data/apps/rails-api/config/database.yml +41 -0
- data/apps/rails-api/config/deploy.yml +116 -0
- data/apps/rails-api/config/environment.rb +5 -0
- data/apps/rails-api/config/environments/development.rb +70 -0
- data/apps/rails-api/config/environments/production.rb +88 -0
- data/apps/rails-api/config/environments/test.rb +53 -0
- data/apps/rails-api/config/initializers/cors.rb +16 -0
- data/apps/rails-api/config/initializers/filter_parameter_logging.rb +8 -0
- data/apps/rails-api/config/initializers/inflections.rb +16 -0
- data/apps/rails-api/config/locales/en.yml +31 -0
- data/apps/rails-api/config/puma.rb +41 -0
- data/apps/rails-api/config/queue.yml +18 -0
- data/apps/rails-api/config/recurring.yml +10 -0
- data/apps/rails-api/config/routes.rb +10 -0
- data/apps/rails-api/config/storage.yml +34 -0
- data/apps/rails-api/config.ru +6 -0
- data/apps/rails-api/db/cable_schema.rb +11 -0
- data/apps/rails-api/db/cache_schema.rb +14 -0
- data/apps/rails-api/db/queue_schema.rb +129 -0
- data/apps/rails-api/db/seeds.rb +9 -0
- data/apps/rails-api/public/robots.txt +1 -0
- data/apps/rails-api/test/controllers/home_controller_test.rb +7 -0
- data/apps/rails-api/test/test_helper.rb +15 -0
- data/apps/rails-full/.dockerignore +47 -0
- data/apps/rails-full/.gitattributes +9 -0
- data/apps/rails-full/.gitignore +34 -0
- data/apps/rails-full/.kamal/hooks/docker-setup.sample +3 -0
- data/apps/rails-full/.kamal/hooks/post-deploy.sample +14 -0
- data/apps/rails-full/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/apps/rails-full/.kamal/hooks/pre-build.sample +51 -0
- data/apps/rails-full/.kamal/hooks/pre-connect.sample +47 -0
- data/apps/rails-full/.kamal/hooks/pre-deploy.sample +109 -0
- data/apps/rails-full/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/apps/rails-full/.kamal/secrets +17 -0
- data/apps/rails-full/.rubocop.yml +8 -0
- data/apps/rails-full/.ruby-version +1 -0
- data/apps/rails-full/Dockerfile +72 -0
- data/apps/rails-full/Gemfile +70 -0
- data/apps/rails-full/Gemfile.lock +429 -0
- data/apps/rails-full/README.md +24 -0
- data/apps/rails-full/Rakefile +6 -0
- data/apps/rails-full/app/assets/stylesheets/application.css +10 -0
- data/apps/rails-full/app/controllers/application_controller.rb +6 -0
- data/apps/rails-full/app/controllers/home_controller.rb +11 -0
- data/apps/rails-full/app/helpers/application_helper.rb +2 -0
- data/apps/rails-full/app/helpers/home_helper.rb +2 -0
- data/apps/rails-full/app/javascript/application.js +3 -0
- data/apps/rails-full/app/javascript/controllers/application.js +9 -0
- data/apps/rails-full/app/javascript/controllers/hello_controller.js +7 -0
- data/apps/rails-full/app/javascript/controllers/index.js +4 -0
- data/apps/rails-full/app/jobs/application_job.rb +7 -0
- data/apps/rails-full/app/mailers/application_mailer.rb +4 -0
- data/apps/rails-full/app/models/application_record.rb +3 -0
- data/apps/rails-full/app/views/home/index.html.erb +7 -0
- data/apps/rails-full/app/views/layouts/application.html.erb +60 -0
- data/apps/rails-full/app/views/layouts/mailer.html.erb +13 -0
- data/apps/rails-full/app/views/layouts/mailer.text.erb +1 -0
- data/apps/rails-full/app/views/pwa/manifest.json.erb +22 -0
- data/apps/rails-full/app/views/pwa/service-worker.js +26 -0
- data/apps/rails-full/bin/brakeman +7 -0
- data/apps/rails-full/bin/bundle +109 -0
- data/apps/rails-full/bin/dev +2 -0
- data/apps/rails-full/bin/docker-entrypoint +14 -0
- data/apps/rails-full/bin/importmap +4 -0
- data/apps/rails-full/bin/jobs +6 -0
- data/apps/rails-full/bin/kamal +27 -0
- data/apps/rails-full/bin/rails +4 -0
- data/apps/rails-full/bin/rake +4 -0
- data/apps/rails-full/bin/rubocop +8 -0
- data/apps/rails-full/bin/setup +34 -0
- data/apps/rails-full/bin/thrust +5 -0
- data/apps/rails-full/config/application.rb +31 -0
- data/apps/rails-full/config/boot.rb +4 -0
- data/apps/rails-full/config/cable.yml +17 -0
- data/apps/rails-full/config/cache.yml +16 -0
- data/apps/rails-full/config/credentials.yml.enc +1 -0
- data/apps/rails-full/config/database.yml +41 -0
- data/apps/rails-full/config/deploy.yml +116 -0
- data/apps/rails-full/config/environment.rb +5 -0
- data/apps/rails-full/config/environments/development.rb +72 -0
- data/apps/rails-full/config/environments/production.rb +91 -0
- data/apps/rails-full/config/environments/test.rb +53 -0
- data/apps/rails-full/config/importmap.rb +7 -0
- data/apps/rails-full/config/initializers/assets.rb +7 -0
- data/apps/rails-full/config/initializers/clerk.rb +4 -0
- data/apps/rails-full/config/initializers/content_security_policy.rb +25 -0
- data/apps/rails-full/config/initializers/filter_parameter_logging.rb +8 -0
- data/apps/rails-full/config/initializers/inflections.rb +16 -0
- data/apps/rails-full/config/locales/en.yml +31 -0
- data/apps/rails-full/config/puma.rb +41 -0
- data/apps/rails-full/config/queue.yml +18 -0
- data/apps/rails-full/config/recurring.yml +10 -0
- data/apps/rails-full/config/routes.rb +15 -0
- data/apps/rails-full/config/storage.yml +34 -0
- data/apps/rails-full/config.ru +6 -0
- data/apps/rails-full/db/cable_schema.rb +11 -0
- data/apps/rails-full/db/cache_schema.rb +14 -0
- data/apps/rails-full/db/queue_schema.rb +129 -0
- data/apps/rails-full/db/seeds.rb +9 -0
- data/apps/rails-full/public/400.html +114 -0
- data/apps/rails-full/public/404.html +114 -0
- data/apps/rails-full/public/406-unsupported-browser.html +114 -0
- data/apps/rails-full/public/422.html +114 -0
- data/apps/rails-full/public/500.html +114 -0
- data/apps/rails-full/public/icon.png +0 -0
- data/apps/rails-full/public/icon.svg +3 -0
- data/apps/rails-full/public/robots.txt +1 -0
- data/apps/rails-full/test/application_system_test_case.rb +5 -0
- data/apps/rails-full/test/controllers/home_controller_test.rb +7 -0
- data/apps/rails-full/test/test_helper.rb +15 -0
- data/apps/sinatra/app.rb +29 -0
- data/apps/sinatra/config.ru +2 -0
- data/apps/sinatra/views/index.erb +44 -0
- data/clerk-sdk-ruby.gemspec +2 -1
- data/lib/clerk/authenticatable.rb +14 -79
- data/lib/clerk/authenticate_context.rb +164 -181
- data/lib/clerk/authenticate_request.rb +238 -230
- data/lib/clerk/configuration.rb +78 -0
- data/lib/clerk/constants.rb +68 -46
- data/lib/clerk/error.rb +17 -0
- data/lib/clerk/jwks_cache.rb +27 -22
- data/lib/clerk/proxy.rb +135 -0
- data/lib/clerk/rack.rb +2 -0
- data/lib/clerk/rack_middleware.rb +88 -73
- data/lib/clerk/rails.rb +3 -0
- data/lib/clerk/railtie.rb +7 -6
- data/lib/clerk/sdk.rb +46 -156
- data/lib/clerk/sinatra.rb +52 -0
- data/lib/clerk/utils.rb +52 -6
- data/lib/clerk/version.rb +1 -1
- data/lib/clerk.rb +15 -51
- metadata +187 -25
- data/CODEOWNERS +0 -1
- data/lib/clerk/errors.rb +0 -22
- data/lib/clerk/rack_middleware_v2.rb +0 -167
- data/lib/clerk/resources/allowlist.rb +0 -16
- data/lib/clerk/resources/allowlist_identifiers.rb +0 -16
- data/lib/clerk/resources/clients.rb +0 -23
- data/lib/clerk/resources/email_addresses.rb +0 -17
- data/lib/clerk/resources/emails.rb +0 -16
- data/lib/clerk/resources/jwks.rb +0 -18
- data/lib/clerk/resources/organizations.rb +0 -73
- data/lib/clerk/resources/phone_numbers.rb +0 -17
- data/lib/clerk/resources/plural_resource.rb +0 -38
- data/lib/clerk/resources/sessions.rb +0 -26
- data/lib/clerk/resources/singular_resource.rb +0 -14
- data/lib/clerk/resources/users.rb +0 -37
- data/lib/clerk/resources.rb +0 -10
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.0.0.
|
4
|
+
version: 4.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clerk
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-06 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -44,6 +43,20 @@ dependencies:
|
|
44
43
|
- - "~>"
|
45
44
|
- !ruby/object:Gem::Version
|
46
45
|
version: '2.5'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: clerk-http-client
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.0.1
|
53
|
+
type: :runtime
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.0.1
|
47
60
|
- !ruby/object:Gem::Dependency
|
48
61
|
name: concurrent-ruby
|
49
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,23 +99,183 @@ dependencies:
|
|
86
99
|
- - "~>"
|
87
100
|
- !ruby/object:Gem::Version
|
88
101
|
version: 0.9.4
|
89
|
-
description: Client SDK for the Clerk
|
102
|
+
description: Client SDK for the Clerk
|
90
103
|
email:
|
91
104
|
- ruby-sdk@clerk.dev
|
92
105
|
executables: []
|
93
106
|
extensions: []
|
94
107
|
extra_rdoc_files: []
|
95
108
|
files:
|
109
|
+
- ".env.example"
|
96
110
|
- ".github/workflows/main.yml"
|
97
111
|
- ".github/workflows/semgrep.yml"
|
98
112
|
- ".gitignore"
|
113
|
+
- ".rspec"
|
114
|
+
- ".ruby-version"
|
99
115
|
- CHANGELOG.md
|
100
|
-
- CODEOWNERS
|
101
116
|
- Gemfile
|
102
117
|
- Gemfile.lock
|
118
|
+
- Guardfile
|
103
119
|
- LICENSE.txt
|
104
120
|
- README.md
|
105
121
|
- Rakefile
|
122
|
+
- apps/rack/app.rb
|
123
|
+
- apps/rack/config.ru
|
124
|
+
- apps/rack/middleware/disable_paths.rb
|
125
|
+
- apps/rails-api/.dockerignore
|
126
|
+
- apps/rails-api/.gitattributes
|
127
|
+
- apps/rails-api/.gitignore
|
128
|
+
- apps/rails-api/.kamal/hooks/docker-setup.sample
|
129
|
+
- apps/rails-api/.kamal/hooks/post-deploy.sample
|
130
|
+
- apps/rails-api/.kamal/hooks/post-proxy-reboot.sample
|
131
|
+
- apps/rails-api/.kamal/hooks/pre-build.sample
|
132
|
+
- apps/rails-api/.kamal/hooks/pre-connect.sample
|
133
|
+
- apps/rails-api/.kamal/hooks/pre-deploy.sample
|
134
|
+
- apps/rails-api/.kamal/hooks/pre-proxy-reboot.sample
|
135
|
+
- apps/rails-api/.kamal/secrets
|
136
|
+
- apps/rails-api/.rubocop.yml
|
137
|
+
- apps/rails-api/.ruby-version
|
138
|
+
- apps/rails-api/Dockerfile
|
139
|
+
- apps/rails-api/Gemfile
|
140
|
+
- apps/rails-api/Gemfile.lock
|
141
|
+
- apps/rails-api/README.md
|
142
|
+
- apps/rails-api/Rakefile
|
143
|
+
- apps/rails-api/app/controllers/application_controller.rb
|
144
|
+
- apps/rails-api/app/controllers/home_controller.rb
|
145
|
+
- apps/rails-api/app/jobs/application_job.rb
|
146
|
+
- apps/rails-api/app/mailers/application_mailer.rb
|
147
|
+
- apps/rails-api/app/models/application_record.rb
|
148
|
+
- apps/rails-api/app/views/layouts/mailer.html.erb
|
149
|
+
- apps/rails-api/app/views/layouts/mailer.text.erb
|
150
|
+
- apps/rails-api/bin/brakeman
|
151
|
+
- apps/rails-api/bin/bundle
|
152
|
+
- apps/rails-api/bin/dev
|
153
|
+
- apps/rails-api/bin/docker-entrypoint
|
154
|
+
- apps/rails-api/bin/jobs
|
155
|
+
- apps/rails-api/bin/kamal
|
156
|
+
- apps/rails-api/bin/rails
|
157
|
+
- apps/rails-api/bin/rake
|
158
|
+
- apps/rails-api/bin/rubocop
|
159
|
+
- apps/rails-api/bin/setup
|
160
|
+
- apps/rails-api/bin/thrust
|
161
|
+
- apps/rails-api/config.ru
|
162
|
+
- apps/rails-api/config/application.rb
|
163
|
+
- apps/rails-api/config/boot.rb
|
164
|
+
- apps/rails-api/config/cable.yml
|
165
|
+
- apps/rails-api/config/cache.yml
|
166
|
+
- apps/rails-api/config/credentials.yml.enc
|
167
|
+
- apps/rails-api/config/database.yml
|
168
|
+
- apps/rails-api/config/deploy.yml
|
169
|
+
- apps/rails-api/config/environment.rb
|
170
|
+
- apps/rails-api/config/environments/development.rb
|
171
|
+
- apps/rails-api/config/environments/production.rb
|
172
|
+
- apps/rails-api/config/environments/test.rb
|
173
|
+
- apps/rails-api/config/initializers/cors.rb
|
174
|
+
- apps/rails-api/config/initializers/filter_parameter_logging.rb
|
175
|
+
- apps/rails-api/config/initializers/inflections.rb
|
176
|
+
- apps/rails-api/config/locales/en.yml
|
177
|
+
- apps/rails-api/config/puma.rb
|
178
|
+
- apps/rails-api/config/queue.yml
|
179
|
+
- apps/rails-api/config/recurring.yml
|
180
|
+
- apps/rails-api/config/routes.rb
|
181
|
+
- apps/rails-api/config/storage.yml
|
182
|
+
- apps/rails-api/db/cable_schema.rb
|
183
|
+
- apps/rails-api/db/cache_schema.rb
|
184
|
+
- apps/rails-api/db/queue_schema.rb
|
185
|
+
- apps/rails-api/db/seeds.rb
|
186
|
+
- apps/rails-api/public/robots.txt
|
187
|
+
- apps/rails-api/test/controllers/home_controller_test.rb
|
188
|
+
- apps/rails-api/test/test_helper.rb
|
189
|
+
- apps/rails-full/.dockerignore
|
190
|
+
- apps/rails-full/.gitattributes
|
191
|
+
- apps/rails-full/.gitignore
|
192
|
+
- apps/rails-full/.kamal/hooks/docker-setup.sample
|
193
|
+
- apps/rails-full/.kamal/hooks/post-deploy.sample
|
194
|
+
- apps/rails-full/.kamal/hooks/post-proxy-reboot.sample
|
195
|
+
- apps/rails-full/.kamal/hooks/pre-build.sample
|
196
|
+
- apps/rails-full/.kamal/hooks/pre-connect.sample
|
197
|
+
- apps/rails-full/.kamal/hooks/pre-deploy.sample
|
198
|
+
- apps/rails-full/.kamal/hooks/pre-proxy-reboot.sample
|
199
|
+
- apps/rails-full/.kamal/secrets
|
200
|
+
- apps/rails-full/.rubocop.yml
|
201
|
+
- apps/rails-full/.ruby-version
|
202
|
+
- apps/rails-full/Dockerfile
|
203
|
+
- apps/rails-full/Gemfile
|
204
|
+
- apps/rails-full/Gemfile.lock
|
205
|
+
- apps/rails-full/README.md
|
206
|
+
- apps/rails-full/Rakefile
|
207
|
+
- apps/rails-full/app/assets/stylesheets/application.css
|
208
|
+
- apps/rails-full/app/controllers/application_controller.rb
|
209
|
+
- apps/rails-full/app/controllers/home_controller.rb
|
210
|
+
- apps/rails-full/app/helpers/application_helper.rb
|
211
|
+
- apps/rails-full/app/helpers/home_helper.rb
|
212
|
+
- apps/rails-full/app/javascript/application.js
|
213
|
+
- apps/rails-full/app/javascript/controllers/application.js
|
214
|
+
- apps/rails-full/app/javascript/controllers/hello_controller.js
|
215
|
+
- apps/rails-full/app/javascript/controllers/index.js
|
216
|
+
- apps/rails-full/app/jobs/application_job.rb
|
217
|
+
- apps/rails-full/app/mailers/application_mailer.rb
|
218
|
+
- apps/rails-full/app/models/application_record.rb
|
219
|
+
- apps/rails-full/app/views/home/index.html.erb
|
220
|
+
- apps/rails-full/app/views/layouts/application.html.erb
|
221
|
+
- apps/rails-full/app/views/layouts/mailer.html.erb
|
222
|
+
- apps/rails-full/app/views/layouts/mailer.text.erb
|
223
|
+
- apps/rails-full/app/views/pwa/manifest.json.erb
|
224
|
+
- apps/rails-full/app/views/pwa/service-worker.js
|
225
|
+
- apps/rails-full/bin/brakeman
|
226
|
+
- apps/rails-full/bin/bundle
|
227
|
+
- apps/rails-full/bin/dev
|
228
|
+
- apps/rails-full/bin/docker-entrypoint
|
229
|
+
- apps/rails-full/bin/importmap
|
230
|
+
- apps/rails-full/bin/jobs
|
231
|
+
- apps/rails-full/bin/kamal
|
232
|
+
- apps/rails-full/bin/rails
|
233
|
+
- apps/rails-full/bin/rake
|
234
|
+
- apps/rails-full/bin/rubocop
|
235
|
+
- apps/rails-full/bin/setup
|
236
|
+
- apps/rails-full/bin/thrust
|
237
|
+
- apps/rails-full/config.ru
|
238
|
+
- apps/rails-full/config/application.rb
|
239
|
+
- apps/rails-full/config/boot.rb
|
240
|
+
- apps/rails-full/config/cable.yml
|
241
|
+
- apps/rails-full/config/cache.yml
|
242
|
+
- apps/rails-full/config/credentials.yml.enc
|
243
|
+
- apps/rails-full/config/database.yml
|
244
|
+
- apps/rails-full/config/deploy.yml
|
245
|
+
- apps/rails-full/config/environment.rb
|
246
|
+
- apps/rails-full/config/environments/development.rb
|
247
|
+
- apps/rails-full/config/environments/production.rb
|
248
|
+
- apps/rails-full/config/environments/test.rb
|
249
|
+
- apps/rails-full/config/importmap.rb
|
250
|
+
- apps/rails-full/config/initializers/assets.rb
|
251
|
+
- apps/rails-full/config/initializers/clerk.rb
|
252
|
+
- apps/rails-full/config/initializers/content_security_policy.rb
|
253
|
+
- apps/rails-full/config/initializers/filter_parameter_logging.rb
|
254
|
+
- apps/rails-full/config/initializers/inflections.rb
|
255
|
+
- apps/rails-full/config/locales/en.yml
|
256
|
+
- apps/rails-full/config/puma.rb
|
257
|
+
- apps/rails-full/config/queue.yml
|
258
|
+
- apps/rails-full/config/recurring.yml
|
259
|
+
- apps/rails-full/config/routes.rb
|
260
|
+
- apps/rails-full/config/storage.yml
|
261
|
+
- apps/rails-full/db/cable_schema.rb
|
262
|
+
- apps/rails-full/db/cache_schema.rb
|
263
|
+
- apps/rails-full/db/queue_schema.rb
|
264
|
+
- apps/rails-full/db/seeds.rb
|
265
|
+
- apps/rails-full/public/400.html
|
266
|
+
- apps/rails-full/public/404.html
|
267
|
+
- apps/rails-full/public/406-unsupported-browser.html
|
268
|
+
- apps/rails-full/public/422.html
|
269
|
+
- apps/rails-full/public/500.html
|
270
|
+
- apps/rails-full/public/icon.png
|
271
|
+
- apps/rails-full/public/icon.svg
|
272
|
+
- apps/rails-full/public/robots.txt
|
273
|
+
- apps/rails-full/test/application_system_test_case.rb
|
274
|
+
- apps/rails-full/test/controllers/home_controller_test.rb
|
275
|
+
- apps/rails-full/test/test_helper.rb
|
276
|
+
- apps/sinatra/app.rb
|
277
|
+
- apps/sinatra/config.ru
|
278
|
+
- apps/sinatra/views/index.erb
|
106
279
|
- bin/console
|
107
280
|
- bin/setup
|
108
281
|
- clerk-sdk-ruby.gemspec
|
@@ -112,26 +285,17 @@ files:
|
|
112
285
|
- lib/clerk/authenticatable.rb
|
113
286
|
- lib/clerk/authenticate_context.rb
|
114
287
|
- lib/clerk/authenticate_request.rb
|
288
|
+
- lib/clerk/configuration.rb
|
115
289
|
- lib/clerk/constants.rb
|
116
|
-
- lib/clerk/
|
290
|
+
- lib/clerk/error.rb
|
117
291
|
- lib/clerk/jwks_cache.rb
|
292
|
+
- lib/clerk/proxy.rb
|
293
|
+
- lib/clerk/rack.rb
|
118
294
|
- lib/clerk/rack_middleware.rb
|
119
|
-
- lib/clerk/
|
295
|
+
- lib/clerk/rails.rb
|
120
296
|
- lib/clerk/railtie.rb
|
121
|
-
- lib/clerk/resources.rb
|
122
|
-
- lib/clerk/resources/allowlist.rb
|
123
|
-
- lib/clerk/resources/allowlist_identifiers.rb
|
124
|
-
- lib/clerk/resources/clients.rb
|
125
|
-
- lib/clerk/resources/email_addresses.rb
|
126
|
-
- lib/clerk/resources/emails.rb
|
127
|
-
- lib/clerk/resources/jwks.rb
|
128
|
-
- lib/clerk/resources/organizations.rb
|
129
|
-
- lib/clerk/resources/phone_numbers.rb
|
130
|
-
- lib/clerk/resources/plural_resource.rb
|
131
|
-
- lib/clerk/resources/sessions.rb
|
132
|
-
- lib/clerk/resources/singular_resource.rb
|
133
|
-
- lib/clerk/resources/users.rb
|
134
297
|
- lib/clerk/sdk.rb
|
298
|
+
- lib/clerk/sinatra.rb
|
135
299
|
- lib/clerk/utils.rb
|
136
300
|
- lib/clerk/version.rb
|
137
301
|
homepage: https://github.com/clerkinc/clerk-sdk-ruby
|
@@ -141,7 +305,6 @@ metadata:
|
|
141
305
|
homepage_uri: https://github.com/clerkinc/clerk-sdk-ruby
|
142
306
|
source_code_uri: https://github.com/clerkinc/clerk-sdk-ruby
|
143
307
|
changelog_uri: https://github.com/clerkinc/clerk-sdk-ruby/blob/main/CHANGELOG.md
|
144
|
-
post_install_message:
|
145
308
|
rdoc_options: []
|
146
309
|
require_paths:
|
147
310
|
- lib
|
@@ -152,12 +315,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
315
|
version: 2.4.0
|
153
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
317
|
requirements:
|
155
|
-
- - "
|
318
|
+
- - ">="
|
156
319
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
320
|
+
version: '0'
|
158
321
|
requirements: []
|
159
|
-
rubygems_version: 3.2
|
160
|
-
signing_key:
|
322
|
+
rubygems_version: 3.6.2
|
161
323
|
specification_version: 4
|
162
324
|
summary: Clerk SDK for Ruby.
|
163
325
|
test_files: []
|
data/CODEOWNERS
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
* @clerkinc/backend
|
data/lib/clerk/errors.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Clerk
|
2
|
-
module Errors
|
3
|
-
class Base < StandardError
|
4
|
-
attr_reader :status
|
5
|
-
|
6
|
-
def initialize(msg, status:)
|
7
|
-
@errors = msg["errors"]
|
8
|
-
@status = status
|
9
|
-
super(msg.merge("status" => status))
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Fatal < Base
|
14
|
-
end
|
15
|
-
|
16
|
-
class Authentication < Base
|
17
|
-
end
|
18
|
-
|
19
|
-
class Configuration < StandardError
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,167 +0,0 @@
|
|
1
|
-
require "clerk"
|
2
|
-
require_relative "authenticate_context"
|
3
|
-
require_relative "authenticate_request"
|
4
|
-
|
5
|
-
module Clerk
|
6
|
-
class ProxyV2
|
7
|
-
CACHE_TTL = 60 # seconds
|
8
|
-
|
9
|
-
attr_reader :session_claims, :session_token
|
10
|
-
|
11
|
-
def initialize(session_claims: nil, session_token: nil)
|
12
|
-
@session_claims = session_claims
|
13
|
-
@session_token = session_token
|
14
|
-
@session = nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def session
|
18
|
-
return nil if @session_claims.nil?
|
19
|
-
|
20
|
-
@session ||= verify_session
|
21
|
-
end
|
22
|
-
|
23
|
-
def verify_session
|
24
|
-
return nil if @session_claims.nil?
|
25
|
-
|
26
|
-
sdk.sessions.verify_token(@session_claims["sid"], @session_token)
|
27
|
-
end
|
28
|
-
|
29
|
-
def user
|
30
|
-
return nil if user_id.nil?
|
31
|
-
|
32
|
-
@user ||= fetch_user(user_id)
|
33
|
-
end
|
34
|
-
|
35
|
-
def user_id
|
36
|
-
return nil if @session_claims.nil?
|
37
|
-
|
38
|
-
@session_claims["sub"]
|
39
|
-
end
|
40
|
-
|
41
|
-
def org
|
42
|
-
return nil if org_id.nil?
|
43
|
-
|
44
|
-
@org ||= fetch_org(org_id)
|
45
|
-
end
|
46
|
-
|
47
|
-
def org_id
|
48
|
-
return nil if user_id.nil?
|
49
|
-
|
50
|
-
@session_claims["org_id"]
|
51
|
-
end
|
52
|
-
|
53
|
-
def org_role
|
54
|
-
return nil if @session_claims.nil?
|
55
|
-
|
56
|
-
@session_claims["org_role"]
|
57
|
-
end
|
58
|
-
|
59
|
-
def org_permissions
|
60
|
-
return nil if @session_claims.nil?
|
61
|
-
|
62
|
-
@session_claims["org_permissions"]
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def fetch_user(user_id)
|
68
|
-
cached_fetch("clerk_user:#{user_id}") do
|
69
|
-
sdk.users.find(user_id)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def fetch_org(org_id)
|
74
|
-
cached_fetch("clerk_org:#{org_id}") do
|
75
|
-
sdk.organizations.find(org_id)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def cached_fetch(key, &block)
|
80
|
-
if store = Clerk.configuration.middleware_cache_store
|
81
|
-
store.fetch(key, expires_in: CACHE_TTL, &block)
|
82
|
-
else
|
83
|
-
yield
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def sdk
|
88
|
-
@sdk ||= Clerk::SDK.new
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
class RackMiddlewareV2
|
93
|
-
def initialize(app)
|
94
|
-
@app = app
|
95
|
-
@excluded_routes = {}
|
96
|
-
@excluded_routes_wildcards = []
|
97
|
-
|
98
|
-
Clerk.configuration.excluded_routes.each do |route|
|
99
|
-
route = route.strip
|
100
|
-
|
101
|
-
if route.ends_with?("/*")
|
102
|
-
@excluded_routes_wildcards << route[0..-2]
|
103
|
-
else
|
104
|
-
@excluded_routes[route] = true
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
@excluded_routes_wildcards.uniq!
|
109
|
-
end
|
110
|
-
|
111
|
-
def call(env)
|
112
|
-
env = env
|
113
|
-
req = Rack::Request.new(env)
|
114
|
-
|
115
|
-
if @excluded_routes[req.path]
|
116
|
-
return @app.call(env)
|
117
|
-
end
|
118
|
-
|
119
|
-
@excluded_routes_wildcards.each do |route|
|
120
|
-
return @app.call(env) if req.path.starts_with?(route)
|
121
|
-
end
|
122
|
-
|
123
|
-
env["clerk"] = Clerk::ProxyV2.new
|
124
|
-
|
125
|
-
auth_context = AuthenticateContext.new(req, Clerk.configuration)
|
126
|
-
auth_request = AuthenticateRequest.new(auth_context)
|
127
|
-
|
128
|
-
status, auth_request_headers, body = auth_request.resolve(env)
|
129
|
-
return [status, auth_request_headers, body] if status
|
130
|
-
|
131
|
-
status, headers, body = @app.call(env)
|
132
|
-
|
133
|
-
if !auth_request_headers.empty?
|
134
|
-
# Remove them to avoid overriding existing cookies set in headers by other middlewares
|
135
|
-
auth_request_cookies = auth_request_headers.delete(COOKIE_HEADER)
|
136
|
-
# merge non-cookie related headers into response headers
|
137
|
-
headers.merge!(auth_request_headers)
|
138
|
-
|
139
|
-
set_cookie_headers!(headers, auth_request_cookies) if auth_request_cookies
|
140
|
-
end
|
141
|
-
|
142
|
-
[status, headers, body]
|
143
|
-
end
|
144
|
-
|
145
|
-
private
|
146
|
-
|
147
|
-
def set_cookie_headers!(headers, cookie_headers)
|
148
|
-
cookie_headers.each do |cookie_header|
|
149
|
-
cookie_key = cookie_header.split(';')[0].split('=')[0]
|
150
|
-
cookie = Rack::Utils.parse_cookies_header(cookie_header)
|
151
|
-
cookie_params = convert_http_cookie_to_cookie_setter_params(cookie, cookie_key)
|
152
|
-
Rack::Utils.set_cookie_header!(headers, cookie_key, cookie_params)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def convert_http_cookie_to_cookie_setter_params(cookie, cookie_key)
|
157
|
-
# convert cookie to to match cookie setter method params (lowercase symbolized keys with `:value` key)
|
158
|
-
cookie_params = cookie.transform_keys { |k| k.downcase.to_sym }
|
159
|
-
# drop the current cookie name key to avoid polluting the expected cookie params
|
160
|
-
cookie_params[:value] = cookie.delete(cookie_key)
|
161
|
-
# fix issue with cookie expiration expected to be Date type
|
162
|
-
cookie_params[:expires] = Date.parse(cookie_params[:expires]) if cookie_params[:expires]
|
163
|
-
|
164
|
-
cookie_params
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "singular_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class Allowlist
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@resource = SingularResource.new(client, "beta_features/allowlist")
|
11
|
-
end
|
12
|
-
|
13
|
-
def_delegators :@resource, :update
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class AllowlistIdentifiers
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@resource = PluralResource.new(client, "allowlist_identifiers")
|
11
|
-
end
|
12
|
-
|
13
|
-
def_delegators :@resource, :all, :create, :delete
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class Clients
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
@resource = PluralResource.new(client, "clients")
|
12
|
-
end
|
13
|
-
|
14
|
-
def verify_token(token)
|
15
|
-
@client.request(:post, "#{@resource.collection_path}/verify",
|
16
|
-
body: {token: token})
|
17
|
-
end
|
18
|
-
|
19
|
-
def_delegators :@resource, :all, :find
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class EmailAddresses
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
@resource = PluralResource.new(client, "email_addresses")
|
12
|
-
end
|
13
|
-
|
14
|
-
def_delegators :@resource, :find, :create, :update, :delete
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class Emails
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@resource = PluralResource.new(client, "emails")
|
11
|
-
end
|
12
|
-
|
13
|
-
def_delegators :@resource, :create
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/clerk/resources/jwks.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class JWKS
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
end
|
12
|
-
|
13
|
-
def all(timeout: 5)
|
14
|
-
@client.request(:get, "jwks", timeout: timeout)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class Organizations
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
@resource = PluralResource.new(client, "organizations")
|
12
|
-
end
|
13
|
-
|
14
|
-
def_delegators :@resource, :all, :find, :create, :update, :delete
|
15
|
-
|
16
|
-
def update_metadata(org_id, private_metadata: {}, public_metadata: {})
|
17
|
-
data = {}
|
18
|
-
data["private_metadata"] = private_metadata.to_json if !private_metadata.empty?
|
19
|
-
data["public_metadata"] = public_metadata.to_json if !public_metadata.empty?
|
20
|
-
|
21
|
-
@client.request(:patch, "#{@resource.resource_path(org_id)}/metadata", body: data)
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# Invitations
|
26
|
-
#
|
27
|
-
def pending_invitations(org_id, query_params = {})
|
28
|
-
@client.request(:get, "#{invitations_path(org_id)}/pending", query: query_params)
|
29
|
-
end
|
30
|
-
|
31
|
-
def create_invitation(org_id, data)
|
32
|
-
@client.request(:post, invitations_path(org_id), body: data)
|
33
|
-
end
|
34
|
-
|
35
|
-
def revoke_invitation(org_id, invitation_id, data)
|
36
|
-
@client.request(:post, "#{invitations_path(org_id, invitation_id)}/revoke", body: data)
|
37
|
-
end
|
38
|
-
|
39
|
-
#
|
40
|
-
# Memberships
|
41
|
-
#
|
42
|
-
def memberships(org_id, query_params = {})
|
43
|
-
@client.request(:get, memberships_path(org_id), query: query_params)
|
44
|
-
end
|
45
|
-
|
46
|
-
def create_membership(org_id, data)
|
47
|
-
@client.request(:post, memberships_path(org_id), body: data)
|
48
|
-
end
|
49
|
-
|
50
|
-
def update_membership(org_id, user_id, data)
|
51
|
-
@client.request(:patch, memberships_path(org_id, user_id), body: data)
|
52
|
-
end
|
53
|
-
|
54
|
-
def delete_membership(org_id, user_id)
|
55
|
-
@client.request(:delete, memberships_path(org_id, user_id))
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def invitations_path(org_id, invitation_id=nil)
|
61
|
-
path = "#{@resource.resource_path(org_id)}/invitations"
|
62
|
-
path << "/#{invitation_id}" if invitation_id
|
63
|
-
path
|
64
|
-
end
|
65
|
-
|
66
|
-
def memberships_path(org_id, user_id=nil)
|
67
|
-
path = "#{@resource.resource_path(org_id)}/memberships"
|
68
|
-
path << "/#{user_id}" if user_id
|
69
|
-
path
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class PhoneNumbers
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
@resource = PluralResource.new(client, "phone_numbers")
|
12
|
-
end
|
13
|
-
|
14
|
-
def_delegators :@resource, :find, :create, :update, :delete
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|