veri 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4434399cb0f0e3081ff2ccb8e72df12623e74f6f2cd43f318d50ae483845be6
4
- data.tar.gz: 194dec0866793d8f2bc906d2830f8c9a4fb37e7d8a5c7f5c58bec7d0631abc51
3
+ metadata.gz: 17672738e498e3328b8b4cf724e3b30e4ee3fb2f7c1d768344cd0c9d29ced1df
4
+ data.tar.gz: bb8031eb131fce46b349e6881d8b20a18d43c19bf4aba7b41ae1bc6474e5c3cd
5
5
  SHA512:
6
- metadata.gz: 2e5dbe8a582d077ef157f8c16d3ec5c21ac24b501e323ed4bf11f577fe436900dffdc1a40814011c78f969962c97ca0b931cd5684253578ecb4804b994016dca
7
- data.tar.gz: ba78fb8d71fd4dffdb527add9759f56d84ca9772535897d356f4a4a9f1302f149d3533355e8a86a518b09f179c638313dcdf2b9932c82fd7e8a427457a1b3111
6
+ metadata.gz: a6000202fed29f8e3e303d831727c7199cc073dcec3c592e412b3234b3a55c06b5761f4781f7325d7113a44af2c2f4786fff526b7d9bbd30eaebf599e62987e0
7
+ data.tar.gz: eaa49fd164b25daefeb97c505d73b11fb148f433f940594a6e6a349eae8a341f3ad8a716eccd5e47204968685602c895185ee255144cf39680eab610d66e83c1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.0.1
2
+
3
+ ### Bugs
4
+
5
+ - Fixed tenant validation blocking Rails console and database commands when orphaned tenant classes exist
6
+
1
7
  ## v1.0.0
2
8
 
3
9
  ### Breaking
data/README.md CHANGED
@@ -1,19 +1,21 @@
1
- # Veri: Minimal Authentication Framework for Rails
1
+ # Veri: Minimal Authentication for Rails
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/veri.svg)](http://badge.fury.io/rb/veri)
4
+ [![Downloads](https://img.shields.io/gem/dt/veri.svg)](https://rubygems.org/gems/veri)
4
5
  [![Github Actions badge](https://github.com/enjaku4/veri/actions/workflows/ci.yml/badge.svg)](https://github.com/enjaku4/veri/actions/workflows/ci.yml)
6
+ [![License](https://img.shields.io/github/license/enjaku4/veri.svg)](LICENSE)
5
7
 
6
- Veri is a cookie-based authentication library for Ruby on Rails that provides essential authentication building blocks without imposing business logic. Unlike full-featured solutions, Veri gives you complete control over your authentication flow while handling the complex underlying mechanics of secure password storage and session management.
8
+ Veri is a cookie-based authentication library for Ruby on Rails. Unlike other solutions, Veri doesn't impose business logic or generate controllers, views, and mailers for you. Instead, it provides essential authentication building blocks giving you complete control over your authentication flow while handling the complex underlying mechanics of secure password storage and session management.
7
9
 
8
10
  **Key Features:**
9
11
 
10
12
  - Cookie-based authentication with database-stored sessions
11
13
  - Multiple password hashing algorithms (argon2, bcrypt, pbkdf2, scrypt)
14
+ - Multi-tenancy support
12
15
  - Granular session management and control
13
- - Return path handling
14
16
  - User impersonation feature
15
17
  - Account lockout functionality
16
- - Multi-tenancy support
18
+ - Return path handling
17
19
 
18
20
  ## Table of Contents
19
21
 
@@ -65,7 +67,7 @@ rails db:migrate
65
67
 
66
68
  ## Configuration
67
69
 
68
- If customization is required, configure Veri in an initializer:
70
+ Configure Veri in an initializer if customization is needed:
69
71
 
70
72
  ```rb
71
73
  # These are the default values; you can change them as needed
@@ -174,7 +176,7 @@ current_session
174
176
 
175
177
  ### User Impersonation (Shapeshifting)
176
178
 
177
- Veri provides user impersonation functionality that allows, for example, administrators to temporarily assume another user's identity:
179
+ Veri provides user impersonation functionality that allows administrators to temporarily assume another user's identity:
178
180
 
179
181
  ```rb
180
182
  module Admin
@@ -219,7 +221,7 @@ shapeshifter?
219
221
 
220
222
  ### When unauthenticated
221
223
 
222
- Override this private method to customize authentication behavior:
224
+ Override this private method to customize unauthenticated user behavior:
223
225
 
224
226
  ```rb
225
227
  class ApplicationController < ActionController::Base
@@ -231,10 +233,8 @@ class ApplicationController < ActionController::Base
231
233
 
232
234
  private
233
235
 
234
- # Customize unauthenticated user handling
235
236
  def when_unauthenticated
236
- # By default redirects back with a fallback to the root path if the request format is HTML,
237
- # otherwise responds with 401 Unauthorized
237
+ # By default, redirects back (HTML) or returns 401 (other formats)
238
238
  redirect_to login_path
239
239
  end
240
240
  end
@@ -313,7 +313,7 @@ user.sessions.prune
313
313
 
314
314
  ## Account Lockout
315
315
 
316
- Veri provides account lockout functionality to temporarily disable user accounts (for example, after too many failed login attempts or for security reasons).
316
+ Veri provides account lockout functionality to temporarily disable user accounts.
317
317
 
318
318
  ```rb
319
319
  # Lock a user account
@@ -332,11 +332,11 @@ User.locked
332
332
  User.unlocked
333
333
  ```
334
334
 
335
- When an account is locked, the user cannot log in. If the user is already logged in, their sessions will be terminated, and they will be treated as an unauthenticated user.
335
+ When an account is locked, the user cannot log in. If they're already logged in, their sessions are terminated and they're treated as unauthenticated.
336
336
 
337
337
  ## Multi-Tenancy
338
338
 
339
- Veri supports multi-tenancy, allowing you to isolate authentication sessions between different tenants (e.g., organizations, clients, or subdomains).
339
+ Veri supports multi-tenancy, allowing you to isolate authentication sessions between different tenants like organizations, clients, or subdomains.
340
340
 
341
341
  ### Setting Up Multi-Tenancy
342
342
 
@@ -400,7 +400,7 @@ Access authentication state in your views:
400
400
 
401
401
  ## Testing
402
402
 
403
- Veri doesn't provide test helpers, but you can easily create your own:
403
+ Veri doesn't include test helpers, but you can easily create your own:
404
404
 
405
405
  ### Request Specs (Recommended)
406
406
 
data/lib/veri/railtie.rb CHANGED
@@ -2,6 +2,10 @@ require "rails/railtie"
2
2
 
3
3
  module Veri
4
4
  class Railtie < Rails::Railtie
5
+ def self.server_running?
6
+ !!defined?(Rails::Server)
7
+ end
8
+
5
9
  def self.table_exists?
6
10
  ActiveRecord::Base.connection.data_source_exists?("veri_sessions")
7
11
  rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
@@ -10,7 +14,7 @@ module Veri
10
14
 
11
15
  initializer "veri.to_prepare" do |app|
12
16
  app.config.to_prepare do
13
- if Veri::Railtie.table_exists?
17
+ if Veri::Railtie.server_running? && Veri::Railtie.table_exists?
14
18
  Veri::Session.where.not(tenant_id: nil).distinct.pluck(:tenant_type).each do |tenant_class|
15
19
  tenant_class.constantize
16
20
  rescue NameError => e
data/lib/veri/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Veri
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.0.1".freeze
3
3
  end
data/veri.gemspec CHANGED
@@ -4,12 +4,16 @@ Gem::Specification.new do |spec|
4
4
  spec.name = "veri"
5
5
  spec.version = Veri::VERSION
6
6
  spec.authors = ["enjaku4"]
7
+ spec.email = ["enjaku4@icloud.com"]
7
8
  spec.homepage = "https://github.com/enjaku4/veri"
8
9
  spec.metadata["homepage_uri"] = spec.homepage
9
10
  spec.metadata["source_code_uri"] = spec.homepage
10
11
  spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
12
+ spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
13
+ spec.metadata["documentation_uri"] = "#{spec.homepage}/blob/main/README.md"
11
14
  spec.metadata["rubygems_mfa_required"] = "true"
12
15
  spec.summary = "Minimal cookie-based authentication library for Ruby on Rails"
16
+ spec.description = "Veri provides cookie-based authentication for Ruby on Rails applications with secure password storage, granular session management, multi-tenancy support, and user impersonation feature, without imposing business logic"
13
17
  spec.license = "MIT"
14
18
  spec.required_ruby_version = ">= 3.2", "< 3.5"
15
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - enjaku4
@@ -113,6 +113,11 @@ dependencies:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '2.0'
116
+ description: Veri provides cookie-based authentication for Ruby on Rails applications
117
+ with secure password storage, granular session management, multi-tenancy support,
118
+ and user impersonation feature, without imposing business logic
119
+ email:
120
+ - enjaku4@icloud.com
116
121
  executables: []
117
122
  extensions: []
118
123
  extra_rdoc_files: []
@@ -149,6 +154,8 @@ metadata:
149
154
  homepage_uri: https://github.com/enjaku4/veri
150
155
  source_code_uri: https://github.com/enjaku4/veri
151
156
  changelog_uri: https://github.com/enjaku4/veri/blob/main/CHANGELOG.md
157
+ bug_tracker_uri: https://github.com/enjaku4/veri/issues
158
+ documentation_uri: https://github.com/enjaku4/veri/blob/main/README.md
152
159
  rubygems_mfa_required: 'true'
153
160
  rdoc_options: []
154
161
  require_paths:
@@ -167,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
174
  - !ruby/object:Gem::Version
168
175
  version: '0'
169
176
  requirements: []
170
- rubygems_version: 3.7.1
177
+ rubygems_version: 3.7.2
171
178
  specification_version: 4
172
179
  summary: Minimal cookie-based authentication library for Ruby on Rails
173
180
  test_files: []