th7-clerk-sdk-ruby 4.2.2

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.
Files changed (195) hide show
  1. checksums.yaml +7 -0
  2. data/.env.example +3 -0
  3. data/.github/workflows/main.yml +30 -0
  4. data/.github/workflows/semgrep.yml +24 -0
  5. data/.gitignore +21 -0
  6. data/.rspec +3 -0
  7. data/.ruby-version +1 -0
  8. data/CHANGELOG.md +212 -0
  9. data/Gemfile +33 -0
  10. data/Gemfile.lock +300 -0
  11. data/Guardfile +14 -0
  12. data/LICENSE.txt +21 -0
  13. data/README.md +278 -0
  14. data/Rakefile +56 -0
  15. data/apps/rack/app.rb +67 -0
  16. data/apps/rack/config.ru +17 -0
  17. data/apps/rack/middleware/disable_paths.rb +13 -0
  18. data/apps/rails-api/.dockerignore +41 -0
  19. data/apps/rails-api/.gitattributes +9 -0
  20. data/apps/rails-api/.gitignore +32 -0
  21. data/apps/rails-api/.kamal/hooks/docker-setup.sample +3 -0
  22. data/apps/rails-api/.kamal/hooks/post-deploy.sample +14 -0
  23. data/apps/rails-api/.kamal/hooks/post-proxy-reboot.sample +3 -0
  24. data/apps/rails-api/.kamal/hooks/pre-build.sample +51 -0
  25. data/apps/rails-api/.kamal/hooks/pre-connect.sample +47 -0
  26. data/apps/rails-api/.kamal/hooks/pre-deploy.sample +109 -0
  27. data/apps/rails-api/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  28. data/apps/rails-api/.kamal/secrets +17 -0
  29. data/apps/rails-api/.rubocop.yml +8 -0
  30. data/apps/rails-api/.ruby-version +1 -0
  31. data/apps/rails-api/Dockerfile +69 -0
  32. data/apps/rails-api/Gemfile +54 -0
  33. data/apps/rails-api/Gemfile.lock +374 -0
  34. data/apps/rails-api/README.md +24 -0
  35. data/apps/rails-api/Rakefile +6 -0
  36. data/apps/rails-api/app/controllers/application_controller.rb +3 -0
  37. data/apps/rails-api/app/controllers/home_controller.rb +5 -0
  38. data/apps/rails-api/app/jobs/application_job.rb +7 -0
  39. data/apps/rails-api/app/mailers/application_mailer.rb +4 -0
  40. data/apps/rails-api/app/models/application_record.rb +3 -0
  41. data/apps/rails-api/app/views/layouts/mailer.html.erb +13 -0
  42. data/apps/rails-api/app/views/layouts/mailer.text.erb +1 -0
  43. data/apps/rails-api/bin/brakeman +7 -0
  44. data/apps/rails-api/bin/bundle +109 -0
  45. data/apps/rails-api/bin/dev +2 -0
  46. data/apps/rails-api/bin/docker-entrypoint +14 -0
  47. data/apps/rails-api/bin/jobs +6 -0
  48. data/apps/rails-api/bin/kamal +27 -0
  49. data/apps/rails-api/bin/rails +4 -0
  50. data/apps/rails-api/bin/rake +4 -0
  51. data/apps/rails-api/bin/rubocop +8 -0
  52. data/apps/rails-api/bin/setup +34 -0
  53. data/apps/rails-api/bin/thrust +5 -0
  54. data/apps/rails-api/config/application.rb +36 -0
  55. data/apps/rails-api/config/boot.rb +4 -0
  56. data/apps/rails-api/config/cable.yml +17 -0
  57. data/apps/rails-api/config/cache.yml +16 -0
  58. data/apps/rails-api/config/credentials.yml.enc +1 -0
  59. data/apps/rails-api/config/database.yml +41 -0
  60. data/apps/rails-api/config/deploy.yml +116 -0
  61. data/apps/rails-api/config/environment.rb +5 -0
  62. data/apps/rails-api/config/environments/development.rb +70 -0
  63. data/apps/rails-api/config/environments/production.rb +88 -0
  64. data/apps/rails-api/config/environments/test.rb +53 -0
  65. data/apps/rails-api/config/initializers/cors.rb +16 -0
  66. data/apps/rails-api/config/initializers/filter_parameter_logging.rb +8 -0
  67. data/apps/rails-api/config/initializers/inflections.rb +16 -0
  68. data/apps/rails-api/config/locales/en.yml +31 -0
  69. data/apps/rails-api/config/puma.rb +41 -0
  70. data/apps/rails-api/config/queue.yml +18 -0
  71. data/apps/rails-api/config/recurring.yml +10 -0
  72. data/apps/rails-api/config/routes.rb +10 -0
  73. data/apps/rails-api/config/storage.yml +34 -0
  74. data/apps/rails-api/config.ru +6 -0
  75. data/apps/rails-api/db/cable_schema.rb +11 -0
  76. data/apps/rails-api/db/cache_schema.rb +14 -0
  77. data/apps/rails-api/db/queue_schema.rb +129 -0
  78. data/apps/rails-api/db/seeds.rb +9 -0
  79. data/apps/rails-api/public/robots.txt +1 -0
  80. data/apps/rails-api/test/controllers/home_controller_test.rb +7 -0
  81. data/apps/rails-api/test/test_helper.rb +15 -0
  82. data/apps/rails-full/.dockerignore +47 -0
  83. data/apps/rails-full/.gitattributes +9 -0
  84. data/apps/rails-full/.gitignore +34 -0
  85. data/apps/rails-full/.kamal/hooks/docker-setup.sample +3 -0
  86. data/apps/rails-full/.kamal/hooks/post-deploy.sample +14 -0
  87. data/apps/rails-full/.kamal/hooks/post-proxy-reboot.sample +3 -0
  88. data/apps/rails-full/.kamal/hooks/pre-build.sample +51 -0
  89. data/apps/rails-full/.kamal/hooks/pre-connect.sample +47 -0
  90. data/apps/rails-full/.kamal/hooks/pre-deploy.sample +109 -0
  91. data/apps/rails-full/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  92. data/apps/rails-full/.kamal/secrets +17 -0
  93. data/apps/rails-full/.rubocop.yml +8 -0
  94. data/apps/rails-full/.ruby-version +1 -0
  95. data/apps/rails-full/Dockerfile +72 -0
  96. data/apps/rails-full/Gemfile +70 -0
  97. data/apps/rails-full/Gemfile.lock +429 -0
  98. data/apps/rails-full/README.md +24 -0
  99. data/apps/rails-full/Rakefile +6 -0
  100. data/apps/rails-full/app/assets/stylesheets/application.css +10 -0
  101. data/apps/rails-full/app/controllers/application_controller.rb +6 -0
  102. data/apps/rails-full/app/controllers/home_controller.rb +11 -0
  103. data/apps/rails-full/app/helpers/application_helper.rb +2 -0
  104. data/apps/rails-full/app/helpers/home_helper.rb +2 -0
  105. data/apps/rails-full/app/javascript/application.js +3 -0
  106. data/apps/rails-full/app/javascript/controllers/application.js +9 -0
  107. data/apps/rails-full/app/javascript/controllers/hello_controller.js +7 -0
  108. data/apps/rails-full/app/javascript/controllers/index.js +4 -0
  109. data/apps/rails-full/app/jobs/application_job.rb +7 -0
  110. data/apps/rails-full/app/mailers/application_mailer.rb +4 -0
  111. data/apps/rails-full/app/models/application_record.rb +3 -0
  112. data/apps/rails-full/app/views/home/index.html.erb +7 -0
  113. data/apps/rails-full/app/views/layouts/application.html.erb +60 -0
  114. data/apps/rails-full/app/views/layouts/mailer.html.erb +13 -0
  115. data/apps/rails-full/app/views/layouts/mailer.text.erb +1 -0
  116. data/apps/rails-full/app/views/pwa/manifest.json.erb +22 -0
  117. data/apps/rails-full/app/views/pwa/service-worker.js +26 -0
  118. data/apps/rails-full/bin/brakeman +7 -0
  119. data/apps/rails-full/bin/bundle +109 -0
  120. data/apps/rails-full/bin/dev +2 -0
  121. data/apps/rails-full/bin/docker-entrypoint +14 -0
  122. data/apps/rails-full/bin/importmap +4 -0
  123. data/apps/rails-full/bin/jobs +6 -0
  124. data/apps/rails-full/bin/kamal +27 -0
  125. data/apps/rails-full/bin/rails +4 -0
  126. data/apps/rails-full/bin/rake +4 -0
  127. data/apps/rails-full/bin/rubocop +8 -0
  128. data/apps/rails-full/bin/setup +34 -0
  129. data/apps/rails-full/bin/thrust +5 -0
  130. data/apps/rails-full/config/application.rb +31 -0
  131. data/apps/rails-full/config/boot.rb +4 -0
  132. data/apps/rails-full/config/cable.yml +17 -0
  133. data/apps/rails-full/config/cache.yml +16 -0
  134. data/apps/rails-full/config/credentials.yml.enc +1 -0
  135. data/apps/rails-full/config/database.yml +41 -0
  136. data/apps/rails-full/config/deploy.yml +116 -0
  137. data/apps/rails-full/config/environment.rb +5 -0
  138. data/apps/rails-full/config/environments/development.rb +72 -0
  139. data/apps/rails-full/config/environments/production.rb +91 -0
  140. data/apps/rails-full/config/environments/test.rb +53 -0
  141. data/apps/rails-full/config/importmap.rb +7 -0
  142. data/apps/rails-full/config/initializers/assets.rb +7 -0
  143. data/apps/rails-full/config/initializers/clerk.rb +4 -0
  144. data/apps/rails-full/config/initializers/content_security_policy.rb +25 -0
  145. data/apps/rails-full/config/initializers/filter_parameter_logging.rb +8 -0
  146. data/apps/rails-full/config/initializers/inflections.rb +16 -0
  147. data/apps/rails-full/config/locales/en.yml +31 -0
  148. data/apps/rails-full/config/puma.rb +41 -0
  149. data/apps/rails-full/config/queue.yml +18 -0
  150. data/apps/rails-full/config/recurring.yml +10 -0
  151. data/apps/rails-full/config/routes.rb +15 -0
  152. data/apps/rails-full/config/storage.yml +34 -0
  153. data/apps/rails-full/config.ru +6 -0
  154. data/apps/rails-full/db/cable_schema.rb +11 -0
  155. data/apps/rails-full/db/cache_schema.rb +14 -0
  156. data/apps/rails-full/db/queue_schema.rb +129 -0
  157. data/apps/rails-full/db/seeds.rb +9 -0
  158. data/apps/rails-full/public/400.html +114 -0
  159. data/apps/rails-full/public/404.html +114 -0
  160. data/apps/rails-full/public/406-unsupported-browser.html +114 -0
  161. data/apps/rails-full/public/422.html +114 -0
  162. data/apps/rails-full/public/500.html +114 -0
  163. data/apps/rails-full/public/icon.png +0 -0
  164. data/apps/rails-full/public/icon.svg +3 -0
  165. data/apps/rails-full/public/robots.txt +1 -0
  166. data/apps/rails-full/test/application_system_test_case.rb +5 -0
  167. data/apps/rails-full/test/controllers/home_controller_test.rb +7 -0
  168. data/apps/rails-full/test/test_helper.rb +15 -0
  169. data/apps/sinatra/app.rb +29 -0
  170. data/apps/sinatra/config.ru +8 -0
  171. data/apps/sinatra/views/index.erb +44 -0
  172. data/bin/console +16 -0
  173. data/bin/release +21 -0
  174. data/bin/setup +8 -0
  175. data/clerk-sdk-ruby.gemspec +38 -0
  176. data/docs/clerk-logo-dark.png +0 -0
  177. data/docs/clerk-logo-light.png +0 -0
  178. data/lib/clerk/authenticatable.rb +32 -0
  179. data/lib/clerk/authenticate_context.rb +168 -0
  180. data/lib/clerk/authenticate_request.rb +261 -0
  181. data/lib/clerk/configuration.rb +84 -0
  182. data/lib/clerk/constants.rb +74 -0
  183. data/lib/clerk/error.rb +17 -0
  184. data/lib/clerk/jwks_cache.rb +37 -0
  185. data/lib/clerk/proxy.rb +135 -0
  186. data/lib/clerk/rack.rb +2 -0
  187. data/lib/clerk/rack_middleware.rb +112 -0
  188. data/lib/clerk/rails.rb +3 -0
  189. data/lib/clerk/railtie.rb +15 -0
  190. data/lib/clerk/sdk.rb +84 -0
  191. data/lib/clerk/sinatra.rb +52 -0
  192. data/lib/clerk/utils.rb +73 -0
  193. data/lib/clerk/version.rb +5 -0
  194. data/lib/clerk.rb +27 -0
  195. metadata +340 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fff2a91eeda83a511b3649bf5598e5f5b25d4ce45154c79c7faae647c812266a
4
+ data.tar.gz: 0f0041c52e3e65ca2ef89ad9a11310e66c76a25275b939e441430e63082038c1
5
+ SHA512:
6
+ metadata.gz: b3a82a0037e1e5702c6baaad2b5b7fd6fab6d92ecc990b1e839f56be3efeef9cbe1af03e21f760efd20e914ed6e93eb9f1ed5b8fa43be8a5757dd5dce0ce51ec
7
+ data.tar.gz: a38d3c7dff555dfbe02078179f51ccc88f731e85507696944808f3a0e5bc5122860f10105ab644245306211041c78514b2aacebb846af8297ee7db856657719c
data/.env.example ADDED
@@ -0,0 +1,3 @@
1
+ CLERK_JS_URL=https://YOUR_SUBDOMAIN.clerk.accounts.dev/npm/@clerk/clerk-js@latest/dist/clerk.browser.js
2
+ CLERK_PUBLISHABLE_KEY=pk_test_******
3
+ CLERK_SECRET_KEY=sk_test_******
@@ -0,0 +1,30 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ name: Ruby ${{ matrix.ruby }}
13
+ strategy:
14
+ matrix:
15
+ ruby:
16
+ - "3.3.5"
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ env:
24
+ BUNDLE_FROZEN: false
25
+ with:
26
+ ruby-version: ${{ matrix.ruby }}
27
+ bundler-cache: true
28
+
29
+ - name: Unit Tests
30
+ run: bundle exec rake spec
@@ -0,0 +1,24 @@
1
+ name: Semgrep
2
+ on:
3
+ workflow_dispatch: {}
4
+ pull_request: {}
5
+ push:
6
+ branches:
7
+ - main
8
+ paths:
9
+ - .github/workflows/semgrep.yml
10
+ schedule:
11
+ # random HH:MM to avoid a load spike on GitHub Actions at 00:00
12
+ - cron: '15 18 * * *'
13
+ jobs:
14
+ semgrep:
15
+ name: semgrep/ci
16
+ runs-on: ubuntu-22.04
17
+ env:
18
+ SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
19
+ container:
20
+ image: returntocorp/semgrep
21
+ if: (github.actor != 'dependabot[bot]')
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ - run: semgrep ci
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ .byebug_history
11
+ *.gem
12
+
13
+ .idea
14
+
15
+ # rspec failure tracking
16
+ .rspec_status
17
+
18
+ # Environment variables
19
+ .env
20
+ .env.*
21
+ !.env.example
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.5
data/CHANGELOG.md ADDED
@@ -0,0 +1,212 @@
1
+ ## 4.2.2 - 2025-06-12
2
+
3
+ - chore: Avoid warnings related to ostruct being removed from Ruby standard library
4
+
5
+ ## 4.2.1 - 2025-05-21
6
+
7
+ - fix: Return only lowercase headers (Rack::Lint) [https://github.com/clerk/clerk-sdk-ruby/pull/97]
8
+
9
+ ## 4.2.0 - 2025-05-20
10
+
11
+ - feat: Add explicit support for lowercased headers [https://github.com/clerk/clerk-sdk-ruby/pull/93]
12
+ - fix: Ensure resiliency of v2 JWT organization claims [https://github.com/clerk/clerk-sdk-ruby/pull/94]
13
+ - feat: Enable support for older versions of Rack [https://github.com/clerk/clerk-sdk-ruby/pull/95]
14
+ - chore: Update dependencies
15
+
16
+ ## 4.1.0 - 2025-04-10
17
+
18
+ - feat: Add support for token v2 org claims [https://github.com/clerk/clerk-sdk-ruby/pull/89]
19
+ - feat: Emit `Clerk-Version-API` header [https://github.com/clerk/clerk-sdk-ruby/pull/89]
20
+
21
+ ## 4.0.1 - 2025-01-27
22
+
23
+ - fix: Ensure that the logger was being correctly passed to the API client [https://github.com/clerk/clerk-sdk-ruby/pull/87]
24
+ - docs: Expand sections within the README [https://github.com/clerk/clerk-sdk-ruby/pull/86]
25
+
26
+ ## 4.0.0 - 2025-01-27
27
+
28
+ - chore: Relese v4.0.0 based on v4.0.0.beta7 [https://github.com/clerk/clerk-sdk-ruby/pull/85]
29
+
30
+ ## 4.0.0.beta7 - 2025-01-27
31
+
32
+ - chore: Bump dependency versions [https://github.com/clerk/clerk-sdk-ruby/pull/82]
33
+
34
+ ## 4.0.0.beta6 - 2025-01-27
35
+
36
+ - 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]
37
+ - build: Introduces a repeatable release flow. [https://github.com/clerk/clerk-sdk-ruby/pull/81]
38
+
39
+ ## 4.0.0.beta5 - 2025-01-27
40
+
41
+ [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.
42
+
43
+ - feat: Add support for the `clerk-http-client` gem [https://github.com/clerk/clerk-sdk-ruby/pull/77]
44
+ - feat: Add support for Revalidation [https://github.com/clerk/clerk-sdk-ruby/pull/77]
45
+ - feat: Add support for Rails API mode [https://github.com/clerk/clerk-sdk-ruby/pull/77]
46
+ - feat: Add support for Sinatra [https://github.com/clerk/clerk-sdk-ruby/pull/77]
47
+ - feat: Middleware cache defaults to `Rails.cache` -> `ActiveSupport::Cache::MemoryStore` (if available) -> no caching [https://github.com/clerk/clerk-sdk-ruby/pull/77]
48
+ - chore: Refactor Clerk helper methods for Rails and Rack [https://github.com/clerk/clerk-sdk-ruby/pull/77]
49
+ - fix: Update configuration naming of `api_key` to `secret_key` [https://github.com/clerk/clerk-sdk-ruby/pull/77]
50
+ - docs: Add example applications for Rails, Sinatra, and Rack under `apps/` [https://github.com/clerk/clerk-sdk-ruby/pull/77]
51
+
52
+
53
+
54
+ ## 4.0.0.beta4 - 2025-01-06
55
+
56
+ [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.
57
+
58
+ - feat: Add support for the `clerk-http-client` gem [https://github.com/clerk/clerk-sdk-ruby/pull/77]
59
+ - feat: Add support for Revalidation [https://github.com/clerk/clerk-sdk-ruby/pull/77]
60
+ - feat: Add support for Rails API mode [https://github.com/clerk/clerk-sdk-ruby/pull/77]
61
+ - feat: Add support for Sinatra [https://github.com/clerk/clerk-sdk-ruby/pull/77]
62
+ - feat: Middleware cache defaults to `Rails.cache` -> `ActiveSupport::Cache::MemoryStore` (if available) -> no caching [https://github.com/clerk/clerk-sdk-ruby/pull/77]
63
+ - chore: Refactor Clerk helper methods for Rails and Rack [https://github.com/clerk/clerk-sdk-ruby/pull/77]
64
+ - fix: Update configuration naming of `api_key` to `secret_key` [https://github.com/clerk/clerk-sdk-ruby/pull/77]
65
+ - docs: Add example applications for Rails, Sinatra, and Rack under `apps/` [https://github.com/clerk/clerk-sdk-ruby/pull/77]
66
+
67
+ ## 4.0.0.beta3 - 2024-04-02
68
+
69
+ - fix: Make publishable_key and secret_key required without making the envs required [https://github.com/clerk/clerk-sdk-ruby/pull/53]
70
+
71
+ ## 4.0.0.beta2 - 2024-02-26
72
+
73
+ Note: this is identical to 4.0.0.beta1, which was yanked because it was not generated from the main branch.
74
+
75
+ - feat: replace interstitial with handshake (internal mechanisms) [https://github.com/clerk/clerk-sdk-ruby/pull/45]
76
+ - chore: re-organize and refactor internal code to extract functionality of rack middleware [https://github.com/clerk/clerk-sdk-ruby/pull/45]
77
+ - changed: `CLERK_PUBLISHABLE_KEY` or `publishable_key` in `Clerk.configure` is **required** [https://github.com/clerk/clerk-sdk-ruby/pull/46]
78
+
79
+ ## [YANKED] 4.0.0.beta1 - 2024-02-26
80
+
81
+ - feat: replace interstitial with handshake (internal mechanisms) [https://github.com/clerk/clerk-sdk-ruby/pull/45]
82
+ - chore: re-organize and refactor internal code to extract functionality of rack middleware [https://github.com/clerk/clerk-sdk-ruby/pull/45]
83
+ - changed: `CLERK_PUBLISHABLE_KEY` or `publishable_key` in `Clerk.configure` is **required** [https://github.com/clerk/clerk-sdk-ruby/pull/46]
84
+
85
+ ## 3.2.0 - 2024-04-08
86
+
87
+ - fix: Infinite redirect loop when client_uat=0 and __session exists [https://github.com/clerk/clerk-sdk-ruby/pull/55]
88
+
89
+ ## 3.1.0 - 2024-03-19
90
+
91
+ - fix: Incompatible __client_uat & __session should show interstitial [https://github.com/clerk/clerk-sdk-ruby/pull/51]
92
+ - fix: Incorrect check that lead to infinite redirect loop introduced by [https://github.com/clerk/clerk-sdk-ruby/pull/51]
93
+
94
+ ## 3.0.0 - 2024-01-09
95
+
96
+ Note: this is identical to 2.12.0, which was yanked because it contained a
97
+ breaking change.
98
+
99
+ - feat: Add org role/permission helpers [https://github.com/clerk/clerk-sdk-ruby/pull/40]
100
+ - changed: drop create sms endpoint [https://github.com/clerk/clerk-sdk-ruby/pull/39]
101
+
102
+ ## [YANKED] 2.12.0 - 2024-01-09
103
+
104
+ - feat: Add org role/permission helpers [https://github.com/clerk/clerk-sdk-ruby/pull/40]
105
+ - changed: drop create sms endpoint [https://github.com/clerk/clerk-sdk-ruby/pull/39]
106
+
107
+ ## 2.11.1 - 2023-10-31
108
+
109
+ - fix: Properly set Clerk API key (secret) when using Faraday v2 [https://github.com/clerkinc/clerk-sdk-ruby/pull/37]
110
+
111
+ ## 2.11.0 - 2023-10-27
112
+
113
+ - feat: Added support for Faraday v2 [https://github.com/clerkinc/clerk-sdk-ruby/pull/37]
114
+
115
+ ## 2.10.0 - 2023-04-04
116
+
117
+ Identical to 2.10.0.beta2
118
+
119
+ ## 2.10.0.beta2 - 2023-03-08
120
+
121
+ - fix: incorrect usage keyword parameter (fix for 2.10.0.beta1)
122
+
123
+ ## 2.10.0.beta1 - 2023-03-08
124
+
125
+ - fix: Change signed-out & interstitial request state conditions [https://github.com/clerkinc/clerk-sdk-ruby/pull/30]
126
+
127
+ ## 2.9.0
128
+
129
+ Identical to 2.9.0.beta3
130
+
131
+ ## 2.9.0.beta3 - 2023-01-17
132
+
133
+ ## Changed
134
+
135
+ - internal: Change request payloads to `application/json` content type [https://github.com/clerkinc/clerk-sdk-ruby/pull/29]
136
+
137
+ ## 2.9.0.beta2 - 2023-01-05
138
+
139
+ - feat: Support setting the secret key (previously called Backend API key) using
140
+ the `CLERK_SECRET_KEY` environment variable [https://github.com/clerkinc/clerk-sdk-ruby/pull/28]
141
+
142
+ ## 2.9.0.beta1 - 2022-12-23
143
+
144
+ - fix: Make JWKS cache work across different SDK instances [https://github.com/clerkinc/clerk-sdk-ruby/pull/27]
145
+
146
+ ## 2.8.0 - 2022-11-29
147
+
148
+ - feat: Add support for the users.verify_totp endpoint
149
+
150
+ ## 2.7.0 - 2022-11-02
151
+
152
+ - feat: Add `#clerk_organization` and `#clerk_organization_id` helpers to fetch the current user's active organization [https://github.com/clerkinc/clerk-sdk-ruby/pull/22]
153
+ - feat: Implement Organization Metadata update endpoint [https://github.com/clerkinc/clerk-sdk-ruby/pull/21]
154
+
155
+ ## 2.6.0 - 2022-11-01
156
+
157
+ - feat: Implement Organization endpoints [https://github.com/clerkinc/clerk-sdk-ruby/pull/20]
158
+
159
+ ## 2.5.0 - 2022-09-20
160
+
161
+ - feat: Add support for disabling the middleware on specific routes [https://github.com/clerkinc/clerk-sdk-ruby/pull/19]
162
+
163
+ ## 2.4.0 - 2022-09-05
164
+
165
+ - feat: Add support for the users.disable_mfa endpoint
166
+
167
+ ## 2.3.0 - 2022-08-30
168
+
169
+ - feat: Add support for the users.verify_password endpoint
170
+
171
+ ## 2.2.0 - 2022-08-26
172
+
173
+ - feat: Add support for the [users.create](https://clerk.com/docs/reference/backend-api/tag/Users#operation/CreateUser) endpoint
174
+
175
+ ## 2.1.2 - 2022-08-26
176
+
177
+ - fix: Gracefully handle invalid JSON in Authorization header [https://github.com/clerkinc/clerk-sdk-ruby/pull/16]
178
+
179
+ ## 2.1.1 - 2022-02-24
180
+
181
+ - fix: Make Authv2 middleware thread-safe
182
+
183
+ ## 2.0.0 - 2021-10-21
184
+
185
+ This release introduces the new networkless middleware which works with the new
186
+ authentication scheme, [Auth v2](https://clerk.com/docs/upgrade-guides/auth-v2).
187
+
188
+ It is backwards-incompatible with applications using Auth v1.
189
+
190
+ - [BREAKING]: In order to use this version, you must set the authVersion prop
191
+ accordingly in your frontend: `Clerk.load({authVersion: 2})`
192
+
193
+ For more information on Auth v2, please refer to
194
+ https://clerk.com/docs/upgrade-guides/auth-v2.
195
+
196
+ ## 1.0.3 - 2021-07-21
197
+
198
+ - fix: Proper endpoint for oauth_access_token method
199
+
200
+ ## 1.0.2 - 2021-06-03
201
+
202
+ - fix: Instantiation of `Clerk::SDK` without prior call to `Clerk.configure`
203
+
204
+ ## 1.0.1 - 2021-06-03
205
+
206
+ ### enhancements
207
+
208
+ - Middleware now uses a proxy object which lazy loads the Clerk session and user only when needed
209
+
210
+ ## 1.0.0 - 2021-05-27
211
+
212
+ - initial release
data/Gemfile ADDED
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in clerk.gemspec
6
+ gemspec
7
+
8
+ group :development do
9
+ gem "activesupport", "~> 8.0", require: false
10
+ gem "dotenv", "~> 3.1", require: false
11
+ gem "puma", "~> 6.4", ">= 6.4.3", require: false
12
+ gem "rack", "~> 3.1", ">= 3.1.14", require: false
13
+ gem "rbs", "~> 3.6"
14
+ gem "rake", "~> 13.0"
15
+ gem "rackup", "~> 2.2", require: false
16
+ gem "rb-fsevent", "~> 0.11", ">= 0.11.2", platform: [:ruby], require: false
17
+ gem "rerun", "~> 0.14", require: false
18
+ gem "sinatra", "~> 4.1", ">= 4.1.1", require: false
19
+ gem "standard", "~> 1.42"
20
+ gem "wdm", "~> 0.2", platform: [:mswin, :windows]
21
+ end
22
+
23
+ group :development, :test do
24
+ gem "rspec", "~> 3.0"
25
+ gem "rspec-rails", "~> 7.1"
26
+ gem "guard-rspec", "~> 4.7", require: false
27
+ gem "guard-rake", "~> 1.0", require: false
28
+ end
29
+
30
+ group :test do
31
+ gem "simplecov", require: false
32
+ gem "climate_control", require: false
33
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,300 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ clerk-sdk-ruby (4.2.2)
5
+ clerk-http-client (~> 2.0)
6
+ concurrent-ruby (~> 1.1)
7
+ faraday (>= 1.4.1, < 3.0)
8
+ jwt (~> 2.5)
9
+ ostruct (~> 0.6.1)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actionpack (8.0.1)
15
+ actionview (= 8.0.1)
16
+ activesupport (= 8.0.1)
17
+ nokogiri (>= 1.8.5)
18
+ rack (>= 2.2.4)
19
+ rack-session (>= 1.0.1)
20
+ rack-test (>= 0.6.3)
21
+ rails-dom-testing (~> 2.2)
22
+ rails-html-sanitizer (~> 1.6)
23
+ useragent (~> 0.16)
24
+ actionview (8.0.1)
25
+ activesupport (= 8.0.1)
26
+ builder (~> 3.1)
27
+ erubi (~> 1.11)
28
+ rails-dom-testing (~> 2.2)
29
+ rails-html-sanitizer (~> 1.6)
30
+ activesupport (8.0.1)
31
+ base64
32
+ benchmark (>= 0.3)
33
+ bigdecimal
34
+ concurrent-ruby (~> 1.0, >= 1.3.1)
35
+ connection_pool (>= 2.2.5)
36
+ drb
37
+ i18n (>= 1.6, < 2)
38
+ logger (>= 1.4.2)
39
+ minitest (>= 5.1)
40
+ securerandom (>= 0.3)
41
+ tzinfo (~> 2.0, >= 2.0.5)
42
+ uri (>= 0.13.1)
43
+ ast (2.4.2)
44
+ base64 (0.2.0)
45
+ benchmark (0.4.0)
46
+ bigdecimal (3.1.9)
47
+ builder (3.3.0)
48
+ byebug (11.1.3)
49
+ clerk-http-client (2.0.0)
50
+ faraday (>= 1.0.1, < 3.0)
51
+ faraday-multipart
52
+ marcel
53
+ climate_control (1.2.0)
54
+ coderay (1.1.3)
55
+ concurrent-ruby (1.3.4)
56
+ connection_pool (2.4.1)
57
+ crass (1.0.6)
58
+ date (3.4.1)
59
+ diff-lcs (1.5.1)
60
+ docile (1.4.1)
61
+ dotenv (3.1.7)
62
+ drb (2.2.1)
63
+ erubi (1.13.1)
64
+ faraday (2.12.2)
65
+ faraday-net_http (>= 2.0, < 3.5)
66
+ json
67
+ logger
68
+ faraday-multipart (1.1.0)
69
+ multipart-post (~> 2.0)
70
+ faraday-net_http (3.4.0)
71
+ net-http (>= 0.5.0)
72
+ ffi (1.17.1-arm64-darwin)
73
+ ffi (1.17.1-x86_64-linux-gnu)
74
+ formatador (1.1.0)
75
+ guard (2.19.1)
76
+ formatador (>= 0.2.4)
77
+ listen (>= 2.7, < 4.0)
78
+ logger (~> 1.6)
79
+ lumberjack (>= 1.0.12, < 2.0)
80
+ nenv (~> 0.1)
81
+ notiffany (~> 0.0)
82
+ ostruct (~> 0.6)
83
+ pry (>= 0.13.0)
84
+ shellany (~> 0.0)
85
+ thor (>= 0.18.1)
86
+ guard-compat (1.2.1)
87
+ guard-rake (1.0.0)
88
+ guard
89
+ rake
90
+ guard-rspec (4.7.3)
91
+ guard (~> 2.1)
92
+ guard-compat (~> 1.1)
93
+ rspec (>= 2.99.0, < 4.0)
94
+ i18n (1.14.6)
95
+ concurrent-ruby (~> 1.0)
96
+ io-console (0.8.0)
97
+ irb (1.14.3)
98
+ rdoc (>= 4.0.0)
99
+ reline (>= 0.4.2)
100
+ json (2.9.1)
101
+ jwt (2.10.1)
102
+ base64
103
+ language_server-protocol (3.17.0.3)
104
+ lint_roller (1.1.0)
105
+ listen (3.9.0)
106
+ rb-fsevent (~> 0.10, >= 0.10.3)
107
+ rb-inotify (~> 0.9, >= 0.9.10)
108
+ logger (1.6.4)
109
+ loofah (2.24.0)
110
+ crass (~> 1.0.2)
111
+ nokogiri (>= 1.12.0)
112
+ lumberjack (1.2.10)
113
+ marcel (1.0.4)
114
+ method_source (1.1.0)
115
+ minitest (5.25.4)
116
+ multipart-post (2.4.1)
117
+ mustermann (3.0.3)
118
+ ruby2_keywords (~> 0.0.1)
119
+ nenv (0.3.0)
120
+ net-http (0.6.0)
121
+ uri
122
+ nio4r (2.7.4)
123
+ nokogiri (1.18.1-arm64-darwin)
124
+ racc (~> 1.4)
125
+ nokogiri (1.18.1-x86_64-darwin)
126
+ racc (~> 1.4)
127
+ nokogiri (1.18.1-x86_64-linux-gnu)
128
+ racc (~> 1.4)
129
+ notiffany (0.1.3)
130
+ nenv (~> 0.1)
131
+ shellany (~> 0.0)
132
+ ostruct (0.6.1)
133
+ parallel (1.26.3)
134
+ parser (3.3.8.0)
135
+ ast (~> 2.4.1)
136
+ racc
137
+ prism (1.4.0)
138
+ pry (0.15.2)
139
+ coderay (~> 1.1)
140
+ method_source (~> 1.0)
141
+ psych (5.2.2)
142
+ date
143
+ stringio
144
+ puma (6.5.0)
145
+ nio4r (~> 2.0)
146
+ racc (1.8.1)
147
+ rack (3.1.15)
148
+ rack-protection (4.1.1)
149
+ base64 (>= 0.1.0)
150
+ logger (>= 1.6.0)
151
+ rack (>= 3.0.0, < 4)
152
+ rack-session (2.1.0)
153
+ base64 (>= 0.1.0)
154
+ rack (>= 3.0.0)
155
+ rack-test (2.2.0)
156
+ rack (>= 1.3)
157
+ rackup (2.2.1)
158
+ rack (>= 3)
159
+ rails-dom-testing (2.2.0)
160
+ activesupport (>= 5.0.0)
161
+ minitest
162
+ nokogiri (>= 1.6)
163
+ rails-html-sanitizer (1.6.2)
164
+ loofah (~> 2.21)
165
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
166
+ railties (8.0.1)
167
+ actionpack (= 8.0.1)
168
+ activesupport (= 8.0.1)
169
+ irb (~> 1.13)
170
+ rackup (>= 1.0.0)
171
+ rake (>= 12.2)
172
+ thor (~> 1.0, >= 1.2.2)
173
+ zeitwerk (~> 2.6)
174
+ rainbow (3.1.1)
175
+ rake (13.2.1)
176
+ rb-fsevent (0.11.2)
177
+ rb-inotify (0.11.1)
178
+ ffi (~> 1.0)
179
+ rbs (3.8.1)
180
+ logger
181
+ rdoc (6.10.0)
182
+ psych (>= 4.0.0)
183
+ regexp_parser (2.10.0)
184
+ reline (0.6.0)
185
+ io-console (~> 0.5)
186
+ rerun (0.14.0)
187
+ listen (~> 3.0)
188
+ rspec (3.13.0)
189
+ rspec-core (~> 3.13.0)
190
+ rspec-expectations (~> 3.13.0)
191
+ rspec-mocks (~> 3.13.0)
192
+ rspec-core (3.13.2)
193
+ rspec-support (~> 3.13.0)
194
+ rspec-expectations (3.13.3)
195
+ diff-lcs (>= 1.2.0, < 2.0)
196
+ rspec-support (~> 3.13.0)
197
+ rspec-mocks (3.13.2)
198
+ diff-lcs (>= 1.2.0, < 2.0)
199
+ rspec-support (~> 3.13.0)
200
+ rspec-rails (7.1.0)
201
+ actionpack (>= 7.0)
202
+ activesupport (>= 7.0)
203
+ railties (>= 7.0)
204
+ rspec-core (~> 3.13)
205
+ rspec-expectations (~> 3.13)
206
+ rspec-mocks (~> 3.13)
207
+ rspec-support (~> 3.13)
208
+ rspec-support (3.13.2)
209
+ rubocop (1.75.6)
210
+ json (~> 2.3)
211
+ language_server-protocol (~> 3.17.0.2)
212
+ lint_roller (~> 1.1.0)
213
+ parallel (~> 1.10)
214
+ parser (>= 3.3.0.2)
215
+ rainbow (>= 2.2.2, < 4.0)
216
+ regexp_parser (>= 2.9.3, < 3.0)
217
+ rubocop-ast (>= 1.44.0, < 2.0)
218
+ ruby-progressbar (~> 1.7)
219
+ unicode-display_width (>= 2.4.0, < 4.0)
220
+ rubocop-ast (1.44.1)
221
+ parser (>= 3.3.7.2)
222
+ prism (~> 1.4)
223
+ rubocop-performance (1.25.0)
224
+ lint_roller (~> 1.1)
225
+ rubocop (>= 1.75.0, < 2.0)
226
+ rubocop-ast (>= 1.38.0, < 2.0)
227
+ ruby-progressbar (1.13.0)
228
+ ruby2_keywords (0.0.5)
229
+ securerandom (0.4.1)
230
+ shellany (0.0.1)
231
+ simplecov (0.22.0)
232
+ docile (~> 1.1)
233
+ simplecov-html (~> 0.11)
234
+ simplecov_json_formatter (~> 0.1)
235
+ simplecov-html (0.13.1)
236
+ simplecov_json_formatter (0.1.4)
237
+ sinatra (4.1.1)
238
+ logger (>= 1.6.0)
239
+ mustermann (~> 3.0)
240
+ rack (>= 3.0.0, < 4)
241
+ rack-protection (= 4.1.1)
242
+ rack-session (>= 2.0.0, < 3)
243
+ tilt (~> 2.0)
244
+ standard (1.50.0)
245
+ language_server-protocol (~> 3.17.0.2)
246
+ lint_roller (~> 1.0)
247
+ rubocop (~> 1.75.5)
248
+ standard-custom (~> 1.0.0)
249
+ standard-performance (~> 1.8)
250
+ standard-custom (1.0.2)
251
+ lint_roller (~> 1.0)
252
+ rubocop (~> 1.50)
253
+ standard-performance (1.8.0)
254
+ lint_roller (~> 1.1)
255
+ rubocop-performance (~> 1.25.0)
256
+ stringio (3.1.2)
257
+ thor (1.3.2)
258
+ tilt (2.5.0)
259
+ timecop (0.9.10)
260
+ tzinfo (2.0.6)
261
+ concurrent-ruby (~> 1.0)
262
+ unicode-display_width (3.1.3)
263
+ unicode-emoji (~> 4.0, >= 4.0.4)
264
+ unicode-emoji (4.0.4)
265
+ uri (1.0.2)
266
+ useragent (0.16.11)
267
+ zeitwerk (2.7.1)
268
+
269
+ PLATFORMS
270
+ arm64-darwin-22
271
+ arm64-darwin-23
272
+ arm64-darwin-24
273
+ universal-darwin-21
274
+ x86_64-linux
275
+
276
+ DEPENDENCIES
277
+ activesupport (~> 8.0)
278
+ byebug (~> 11.1)
279
+ clerk-sdk-ruby!
280
+ climate_control
281
+ dotenv (~> 3.1)
282
+ guard-rake (~> 1.0)
283
+ guard-rspec (~> 4.7)
284
+ puma (~> 6.4, >= 6.4.3)
285
+ rack (~> 3.1, >= 3.1.14)
286
+ rackup (~> 2.2)
287
+ rake (~> 13.0)
288
+ rb-fsevent (~> 0.11, >= 0.11.2)
289
+ rbs (~> 3.6)
290
+ rerun (~> 0.14)
291
+ rspec (~> 3.0)
292
+ rspec-rails (~> 7.1)
293
+ simplecov
294
+ sinatra (~> 4.1, >= 4.1.1)
295
+ standard (~> 1.42)
296
+ timecop (~> 0.9.4)
297
+ wdm (~> 0.2)
298
+
299
+ BUNDLED WITH
300
+ 2.6.2
data/Guardfile ADDED
@@ -0,0 +1,14 @@
1
+ guard :rspec, cmd: "bundle exec rspec", group: :spec do
2
+ require "guard/rspec/dsl"
3
+ dsl = Guard::RSpec::Dsl.new(self)
4
+
5
+ # RSpec files
6
+ rspec = dsl.rspec
7
+ watch(rspec.spec_helper) { rspec.spec_dir }
8
+ watch(rspec.spec_support) { rspec.spec_dir }
9
+ watch(rspec.spec_files)
10
+
11
+ # Ruby files
12
+ ruby = dsl.ruby
13
+ dsl.watch_spec_files_for(ruby.lib_files)
14
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Clerk Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.