veri 2.0.3 → 3.0.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 +49 -1
- data/README.md +174 -57
- data/{lib/veri/models → app/models/veri}/session.rb +53 -31
- data/lib/generators/veri/authentication_generator.rb +10 -2
- data/lib/generators/veri/templates/add_veri_authentication.rb.erb +8 -8
- data/lib/veri/controllers/concerns/authentication.rb +29 -26
- data/lib/veri/engine.rb +25 -0
- data/lib/veri/helpers/migration_helpers.rb +8 -9
- data/lib/veri/inputs/authenticatable.rb +3 -1
- data/lib/veri/inputs/base.rb +7 -4
- data/lib/veri/inputs/boolean.rb +11 -0
- data/lib/veri/inputs/duration.rb +1 -1
- data/lib/veri/inputs/hashing_algorithm.rb +1 -1
- data/lib/veri/inputs/model.rb +4 -6
- data/lib/veri/inputs/non_empty_string.rb +3 -1
- data/lib/veri/inputs/request.rb +11 -0
- data/lib/veri/inputs/tenant.rb +10 -13
- data/lib/veri/models/concerns/authenticatable.rb +42 -22
- data/lib/veri/models/tenant_declaration.rb +11 -0
- data/lib/veri/password/argon2.rb +0 -4
- data/lib/veri/password/bcrypt.rb +0 -4
- data/lib/veri/password/pbkdf2.rb +0 -4
- data/lib/veri/password/scrypt.rb +0 -4
- data/lib/veri/version.rb +1 -1
- data/lib/veri.rb +4 -2
- data/veri.gemspec +4 -5
- metadata +18 -16
- data/lib/veri/railtie.rb +0 -44
data/lib/veri/railtie.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require "rails/railtie"
|
|
2
|
-
|
|
3
|
-
module Veri
|
|
4
|
-
class Railtie < Rails::Railtie
|
|
5
|
-
def self.server_running?
|
|
6
|
-
!!defined?(Rails::Server)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def self.table_exists?
|
|
10
|
-
ActiveRecord::Base.connection.data_source_exists?("veri_sessions")
|
|
11
|
-
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
|
|
12
|
-
false
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
initializer "veri.to_prepare" do |app|
|
|
16
|
-
app.config.to_prepare do
|
|
17
|
-
if Veri::Railtie.server_running? && Veri::Railtie.table_exists?
|
|
18
|
-
Veri::Session.where.not(tenant_id: nil).distinct.pluck(:tenant_type).each do |tenant_class|
|
|
19
|
-
tenant_class.constantize
|
|
20
|
-
rescue NameError => e
|
|
21
|
-
raise Veri::Error, "Tenant not found: class `#{e.name}` may have been renamed or deleted"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
begin
|
|
26
|
-
user_model = Veri::Configuration.user_model
|
|
27
|
-
user_model.include Veri::Authenticatable unless user_model < Veri::Authenticatable
|
|
28
|
-
rescue Veri::ConfigurationError
|
|
29
|
-
raise if Veri::Railtie.server_running?
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Veri::Session.belongs_to :authenticatable, class_name: Veri::Configuration.user_model_name
|
|
33
|
-
Veri::Session.belongs_to :original_authenticatable, class_name: Veri::Configuration.user_model_name,
|
|
34
|
-
optional: true
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
initializer "veri.extend_migration_helpers" do
|
|
39
|
-
ActiveSupport.on_load :active_record do
|
|
40
|
-
ActiveRecord::Migration.include Veri::MigrationHelpers
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|