clerk-sdk-ruby 4.0.0.beta2 → 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 +25 -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 -179
- 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 -157
- 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 -19
- 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
@@ -1,38 +0,0 @@
|
|
1
|
-
module Clerk
|
2
|
-
module Resources
|
3
|
-
class PluralResource
|
4
|
-
def initialize(client, path_prefix)
|
5
|
-
@client = client
|
6
|
-
@path_prefix = path_prefix
|
7
|
-
end
|
8
|
-
|
9
|
-
def all(query_params = {})
|
10
|
-
@client.request(:get, collection_path, query: query_params)
|
11
|
-
end
|
12
|
-
|
13
|
-
def find(id)
|
14
|
-
@client.request(:get, resource_path(id))
|
15
|
-
end
|
16
|
-
|
17
|
-
def create(data = nil)
|
18
|
-
@client.request(:post, collection_path, body: data)
|
19
|
-
end
|
20
|
-
|
21
|
-
def update(id, changes = nil)
|
22
|
-
@client.request(:patch, resource_path(id), body: changes)
|
23
|
-
end
|
24
|
-
|
25
|
-
def delete(id)
|
26
|
-
@client.request(:delete, resource_path(id))
|
27
|
-
end
|
28
|
-
|
29
|
-
def collection_path
|
30
|
-
@path_prefix
|
31
|
-
end
|
32
|
-
|
33
|
-
def resource_path(id)
|
34
|
-
"#{@path_prefix}/#{id}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class Sessions
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
@resource = PluralResource.new(client, "sessions")
|
12
|
-
end
|
13
|
-
|
14
|
-
def revoke(id)
|
15
|
-
@client.request(:post, "#{@resource.resource_path(id)}/revoke")
|
16
|
-
end
|
17
|
-
|
18
|
-
def verify_token(id, token)
|
19
|
-
@client.request(:post, "#{@resource.resource_path(id)}/verify",
|
20
|
-
body: {token: token})
|
21
|
-
end
|
22
|
-
|
23
|
-
def_delegators :@resource, :all, :find
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Clerk
|
2
|
-
module Resources
|
3
|
-
class SingularResource
|
4
|
-
def initialize(client, resource_path)
|
5
|
-
@client = client
|
6
|
-
@resource_path = resource_path
|
7
|
-
end
|
8
|
-
|
9
|
-
def update(changes = {})
|
10
|
-
@client.request(:patch, @resource_path, body: changes)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class Users
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
@resource = PluralResource.new(client, "users")
|
12
|
-
end
|
13
|
-
|
14
|
-
def_delegators :@resource, :all, :find, :create, :update, :delete
|
15
|
-
|
16
|
-
def oauth_access_token(user_id, provider)
|
17
|
-
@client.request(:get, "#{@resource.resource_path(user_id)}/oauth_access_tokens/#{provider}")
|
18
|
-
end
|
19
|
-
|
20
|
-
def verify_password(user_id, password)
|
21
|
-
@client.request(:post, "#{@resource.resource_path(user_id)}/verify_password", body: { password: password })
|
22
|
-
end
|
23
|
-
|
24
|
-
def verify_totp(user_id, totp_or_backup_code)
|
25
|
-
@client.request(:post, "#{@resource.resource_path(user_id)}/verify_totp", body: { code: totp_or_backup_code })
|
26
|
-
end
|
27
|
-
|
28
|
-
def disable_mfa(user_id)
|
29
|
-
@client.request(:delete, "#{@resource.resource_path(user_id)}/mfa")
|
30
|
-
end
|
31
|
-
|
32
|
-
def organization_memberships(user_id, query_params = {})
|
33
|
-
@client.request(:get, "#{@resource.resource_path(user_id)}/organization_memberships", query: query_params)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/lib/clerk/resources.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require_relative "resources/allowlist_identifiers"
|
2
|
-
require_relative "resources/allowlist"
|
3
|
-
require_relative "resources/clients"
|
4
|
-
require_relative "resources/email_addresses"
|
5
|
-
require_relative "resources/emails"
|
6
|
-
require_relative "resources/organizations"
|
7
|
-
require_relative "resources/phone_numbers"
|
8
|
-
require_relative "resources/sessions"
|
9
|
-
require_relative "resources/users"
|
10
|
-
require_relative "resources/jwks"
|