securial 0.7.0 → 0.8.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -5
  3. data/app/controllers/concerns/securial/identity.rb +17 -16
  4. data/app/controllers/securial/accounts_controller.rb +2 -2
  5. data/app/controllers/securial/passwords_controller.rb +2 -2
  6. data/app/controllers/securial/role_assignments_controller.rb +5 -7
  7. data/app/controllers/securial/roles_controller.rb +1 -0
  8. data/app/controllers/securial/sessions_controller.rb +6 -8
  9. data/app/controllers/securial/users_controller.rb +8 -7
  10. data/app/mailers/securial/securial_mailer.rb +17 -6
  11. data/app/models/concerns/securial/password_resettable.rb +1 -1
  12. data/app/models/securial/application_record.rb +1 -1
  13. data/app/models/securial/session.rb +16 -5
  14. data/app/models/securial/user.rb +1 -3
  15. data/app/views/securial/securial_mailer/forgot_password.html.erb +20 -0
  16. data/app/views/securial/securial_mailer/forgot_password.text.erb +14 -0
  17. data/app/views/securial/securial_mailer/sign_in.html.erb +31 -0
  18. data/app/views/securial/securial_mailer/sign_in.text.erb +17 -0
  19. data/app/views/securial/securial_mailer/update_account.html.erb +15 -0
  20. data/app/views/securial/securial_mailer/update_account.text.erb +11 -0
  21. data/app/views/securial/securial_mailer/welcome.html.erb +11 -0
  22. data/app/views/securial/securial_mailer/welcome.text.erb +8 -0
  23. data/app/views/securial/users/_securial_user.json.jbuilder +9 -3
  24. data/config/routes.rb +5 -1
  25. data/db/migrate/{20250515104930_create_securial_roles.rb → 20250603130214_create_securial_roles.rb} +0 -2
  26. data/db/migrate/{20250517155521_create_securial_users.rb → 20250604110520_create_securial_users.rb} +8 -3
  27. data/db/migrate/{20250519075407_create_securial_sessions.rb → 20250604184841_create_securial_sessions.rb} +4 -0
  28. data/lib/generators/securial/install/templates/securial_initializer.erb +1 -1
  29. data/lib/generators/securial/scaffold/templates/controller.erb +1 -0
  30. data/lib/generators/securial/scaffold/templates/routes.erb +1 -1
  31. data/lib/securial/auth/auth_encoder.rb +8 -6
  32. data/lib/securial/auth/session_creator.rb +6 -3
  33. data/lib/securial/auth/token_generator.rb +26 -0
  34. data/lib/securial/auth.rb +7 -5
  35. data/lib/securial/config/configuration.rb +31 -13
  36. data/lib/securial/config/validation/logger_validation.rb +29 -0
  37. data/lib/securial/config/validation/mailer_validation.rb +24 -0
  38. data/lib/securial/config/validation/password_validation.rb +91 -0
  39. data/lib/securial/config/validation/response_validation.rb +37 -0
  40. data/lib/securial/config/validation/roles_validation.rb +32 -0
  41. data/lib/securial/config/validation/security_validation.rb +56 -0
  42. data/lib/securial/config/validation/session_validation.rb +87 -0
  43. data/lib/securial/config/validation.rb +16 -239
  44. data/lib/securial/config.rb +20 -4
  45. data/lib/securial/engine.rb +5 -79
  46. data/lib/securial/engine_initializers.rb +33 -0
  47. data/lib/securial/error/auth.rb +21 -0
  48. data/lib/securial/error/base_securial_error.rb +16 -0
  49. data/lib/securial/error/config.rb +37 -0
  50. data/lib/securial/error.rb +9 -0
  51. data/lib/securial/helpers/roles_helper.rb +17 -0
  52. data/lib/securial/helpers.rb +1 -0
  53. data/lib/securial/logger/broadcaster.rb +36 -24
  54. data/lib/securial/logger/builder.rb +29 -44
  55. data/lib/securial/logger/formatter.rb +35 -0
  56. data/lib/securial/logger.rb +10 -3
  57. data/lib/securial/middleware/request_tag_logger.rb +39 -0
  58. data/lib/securial/middleware.rb +13 -0
  59. data/lib/securial/version.rb +1 -1
  60. data/lib/securial.rb +2 -26
  61. metadata +39 -149
  62. data/app/views/securial/securial_mailer/reset_password.html.erb +0 -5
  63. data/app/views/securial/securial_mailer/reset_password.text.erb +0 -4
  64. data/lib/securial/auth/errors.rb +0 -15
  65. data/lib/securial/config/errors.rb +0 -20
  66. data/lib/securial/inspectors/route_inspector.rb +0 -52
  67. data/lib/securial/inspectors.rb +0 -8
  68. data/lib/securial/key_transformer.rb +0 -32
  69. data/lib/securial/logger/colors.rb +0 -14
  70. data/lib/securial/middlewares/request_logger_tag.rb +0 -19
  71. data/lib/securial/middlewares/transform_request_keys.rb +0 -33
  72. data/lib/securial/middlewares/transform_response_keys.rb +0 -52
  73. data/lib/securial/middlewares.rb +0 -10
  74. data/lib/securial/security/request_rate_limiter.rb +0 -68
  75. data/lib/securial/security.rb +0 -8
  76. data/lib/securial/version_checker.rb +0 -31
  77. /data/db/migrate/{20250518122749_create_securial_role_assignments.rb → 20250604123805_create_securial_role_assignments.rb} +0 -0
@@ -1,60 +1,45 @@
1
1
  require "logger"
2
2
  require "active_support/logger"
3
3
  require "active_support/tagged_logging"
4
- require_relative "colors"
5
- require_relative "broadcaster"
4
+
5
+ require "securial/logger/broadcaster"
6
+ require "securial/logger/formatter"
6
7
 
7
8
  module Securial
8
9
  module Logger
9
- def self.build # rubocop:disable Metrics/MethodLength
10
- loggers = []
11
- colorize_stdout = false
10
+ class Builder
11
+ def self.build
12
+ loggers = []
13
+ progname = "Securial"
12
14
 
13
- unless Securial.configuration.log_to_file == false
14
- file_logger = ::Logger.new(Rails.root.join("log", "securial.log"))
15
- file_logger.level = resolve_level(Securial.configuration.log_file_level)
16
- file_logger.formatter = ::Logger::Formatter.new
17
- loggers << file_logger
18
- end
15
+ file_logger_enabled = Securial.configuration.log_to_file
16
+ file_logger_level = Securial.configuration.log_file_level
17
+ stdout_logger_enabled = Securial.configuration.log_to_stdout
18
+ stdout_logger_level = Securial.configuration.log_stdout_level
19
19
 
20
- unless Securial.configuration.log_to_stdout == false
21
- stdout_logger = ::Logger.new(STDOUT)
22
- stdout_logger.level = resolve_level(Securial.configuration.log_stdout_level)
23
- stdout_logger.formatter = proc do |severity, timestamp, progname, msg|
24
- color = COLORS[severity] || CLEAR
25
- padded = severity.ljust(SEVERITY_WIDTH)
26
- formatted = "#{timestamp.strftime("%Y-%m-%d %H:%M:%S")} #{padded} -- : #{msg}\n"
27
- "#{color}#{formatted}#{CLEAR}"
28
- end
29
- colorize_stdout = true
30
- loggers << stdout_logger
31
- end
20
+ create_file_logger(progname, file_logger_level, loggers) if file_logger_enabled
21
+ create_stdout_logger(progname, stdout_logger_level, loggers) if stdout_logger_enabled
32
22
 
33
- if loggers.empty?
34
- null_logger = ::Logger.new(IO::NULL)
35
- return ActiveSupport::TaggedLogging.new(null_logger)
23
+ Broadcaster.new(loggers)
36
24
  end
37
25
 
38
- broadcaster = Broadcaster.new(*loggers)
39
- tagged_logger = ActiveSupport::TaggedLogging.new(broadcaster)
40
-
41
- if colorize_stdout && !Rails.env.test?
42
- tagged_logger.formatter = proc do |severity, timestamp, progname, msg|
43
- color = COLORS[severity] || CLEAR
44
- padded = severity.ljust(SEVERITY_WIDTH)
45
- formatted = "#{timestamp.strftime("%Y-%m-%d %H:%M:%S")} #{padded} -- : #{msg}\n"
46
- "#{color}#{formatted}#{CLEAR}"
47
- end
26
+ def self.create_file_logger(progname, level, loggers)
27
+ file_logger = ::Logger.new(Rails.root.join("log", "securial-#{Rails.env}.log"))
28
+ file_logger.level = level
29
+ file_logger.progname = progname
30
+ file_logger.formatter = Formatter::PlainFormatter.new
31
+ tagged_file_logger = ActiveSupport::TaggedLogging.new(file_logger)
32
+ loggers << tagged_file_logger
48
33
  end
49
34
 
50
- tagged_logger
51
- end
52
-
53
- def self.resolve_level(level)
54
- return ::Logger::INFO if level.nil?
55
- ::Logger.const_get(level.to_s.upcase)
56
- rescue NameError
57
- ::Logger::INFO
35
+ def self.create_stdout_logger(progname, level, loggers)
36
+ stdout_logger = ::Logger.new($stdout)
37
+ stdout_logger.level = level
38
+ stdout_logger.progname = progname
39
+ stdout_logger.formatter = Formatter::ColorfulFormatter.new
40
+ tagged_stdout_logger = ActiveSupport::TaggedLogging.new(stdout_logger)
41
+ loggers << tagged_stdout_logger
42
+ end
58
43
  end
59
44
  end
60
45
  end
@@ -0,0 +1,35 @@
1
+ module Securial
2
+ module Logger
3
+ module Formatter
4
+ COLORS = {
5
+ "DEBUG" => "\e[36m", # cyan
6
+ "INFO" => "\e[32m", # green
7
+ "WARN" => "\e[33m", # yellow
8
+ "ERROR" => "\e[31m", # red
9
+ "FATAL" => "\e[35m", # magenta
10
+ "UNKNOWN" => "\e[37m", # white
11
+ }.freeze
12
+ CLEAR = "\e[0m"
13
+ SEVERITY_WIDTH = 5
14
+
15
+ class ColorfulFormatter
16
+ def call(severity, timestamp, progname, msg)
17
+ color = COLORS[severity] || CLEAR
18
+ padded_severity = severity.ljust(SEVERITY_WIDTH)
19
+ formatted = "[#{progname}][#{timestamp.strftime("%Y-%m-%d %H:%M:%S")}] #{padded_severity} -- #{msg}\n"
20
+
21
+ "#{color}#{formatted}#{CLEAR}"
22
+ end
23
+ end
24
+
25
+ class PlainFormatter
26
+ def call(severity, timestamp, progname, msg)
27
+ padded_severity = severity.ljust(SEVERITY_WIDTH)
28
+ formatted = "[#{timestamp.strftime("%Y-%m-%d %H:%M:%S")}] #{padded_severity} -- #{msg}\n"
29
+
30
+ formatted
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,8 +1,15 @@
1
1
  require_relative "logger/builder"
2
2
 
3
3
  module Securial
4
- module Logger
5
- # This module serves as a namespace for logging functionality.
6
- # It requires the Logger::Builder to provide logger building capabilities.
4
+ class << self
5
+ attr_accessor :logger
6
+
7
+ def logger
8
+ @logger ||= Logger::Builder.build
9
+ end
10
+
11
+ def logger=(logger)
12
+ @logger = logger
13
+ end
7
14
  end
8
15
  end
@@ -0,0 +1,39 @@
1
+ module Securial
2
+ module Middleware
3
+ class RequestTagLogger
4
+ def initialize(app, logger = Securial.logger)
5
+ @app = app
6
+ @logger = logger
7
+ end
8
+
9
+ def call(env)
10
+ request_id = request_id_from_env(env)
11
+ ip_address = ip_from_env(env)
12
+ user_agent = user_agent_from_env(env)
13
+
14
+ tags = []
15
+ tags << request_id if request_id
16
+ tags << "IP:#{ip_address}" if ip_address
17
+ tags << "UA:#{user_agent}" if user_agent
18
+
19
+ @logger.tagged(*tags) do
20
+ @app.call(env)
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def request_id_from_env(env)
27
+ env["action_dispatch.request_id"] || env["HTTP_X_REQUEST_ID"]
28
+ end
29
+
30
+ def ip_from_env(env)
31
+ env["action_dispatch.remote_ip"]&.to_s || env["REMOTE_ADDR"]
32
+ end
33
+
34
+ def user_agent_from_env(env)
35
+ env["HTTP_USER_AGENT"]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ require "securial/middleware/request_tag_logger"
2
+
3
+ module Securial
4
+ module Middleware
5
+ # This module serves as a namespace for all middleware components in the Securial gem.
6
+ # It currently includes the RequestTagLogger middleware, which tags logs with request IDs.
7
+ #
8
+ # Additional middleware can be added here as the gem evolves.
9
+ #
10
+ # Example usage:
11
+ # use Securial::Middleware::RequestTagLogger
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Securial
2
- VERSION = "0.7.0".freeze
2
+ VERSION = "0.8.0".freeze
3
3
  end
data/lib/securial.rb CHANGED
@@ -1,35 +1,11 @@
1
1
  require "securial/version"
2
2
  require "securial/engine"
3
- require "securial/logger"
4
3
 
5
4
  require "jbuilder"
6
5
 
7
6
  module Securial
8
7
  class << self
9
- attr_accessor :configuration
10
- attr_accessor :logger
11
-
12
- def configuration
13
- @configuration ||= Securial::Config::Configuration.new
14
- end
15
-
16
- def configuration=(config)
17
- @configuration = config
18
- Securial::Config::Validation.validate_all!(configuration)
19
- end
20
-
21
- def configure
22
- yield(configuration)
23
- end
24
-
25
- def logger
26
- @logger ||= Securial::Logger.build
27
- end
28
-
29
- # Returns the pluralized form of the admin role.
30
- # This behavior is intentional and aligns with the project's routing conventions.
31
- def admin_namespace
32
- configuration.admin_role.to_s.pluralize.downcase
33
- end
8
+ delegate :protected_namespace, to: Securial::Helpers::RolesHelper
9
+ delegate :titleized_admin_role, to: Securial::Helpers::RolesHelper
34
10
  end
35
11
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: securial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aly Badawy
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-01 00:00:00.000000000 Z
10
+ date: 2025-06-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -65,132 +65,6 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '2.10'
68
- - !ruby/object:Gem::Dependency
69
- name: ostruct
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '0.6'
75
- type: :runtime
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '0.6'
82
- - !ruby/object:Gem::Dependency
83
- name: rack-attack
84
- requirement: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '6.7'
89
- type: :runtime
90
- prerelease: false
91
- version_requirements: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '6.7'
96
- - !ruby/object:Gem::Dependency
97
- name: faker
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '3.5'
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '3.5'
110
- - !ruby/object:Gem::Dependency
111
- name: capybara
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '3.40'
117
- type: :development
118
- prerelease: false
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '3.40'
124
- - !ruby/object:Gem::Dependency
125
- name: database_cleaner
126
- requirement: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '2.1'
131
- type: :development
132
- prerelease: false
133
- version_requirements: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '2.1'
138
- - !ruby/object:Gem::Dependency
139
- name: factory_bot_rails
140
- requirement: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '6.4'
145
- type: :development
146
- prerelease: false
147
- version_requirements: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '6.4'
152
- - !ruby/object:Gem::Dependency
153
- name: generator_spec
154
- requirement: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '0.10'
159
- type: :development
160
- prerelease: false
161
- version_requirements: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.10'
166
- - !ruby/object:Gem::Dependency
167
- name: rspec-rails
168
- requirement: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '7.1'
173
- type: :development
174
- prerelease: false
175
- version_requirements: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '7.1'
180
- - !ruby/object:Gem::Dependency
181
- name: shoulda-matchers
182
- requirement: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '6.5'
187
- type: :development
188
- prerelease: false
189
- version_requirements: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '6.5'
194
68
  description: Securial is a mountable Rails engine that provides robust, extensible
195
69
  authentication and access control for Rails applications. It supports JWT, API tokens,
196
70
  session-based auth, and is designed for easy integration with modern web and mobile
@@ -231,8 +105,14 @@ files:
231
105
  - app/views/securial/roles/_securial_role.json.jbuilder
232
106
  - app/views/securial/roles/index.json.jbuilder
233
107
  - app/views/securial/roles/show.json.jbuilder
234
- - app/views/securial/securial_mailer/reset_password.html.erb
235
- - app/views/securial/securial_mailer/reset_password.text.erb
108
+ - app/views/securial/securial_mailer/forgot_password.html.erb
109
+ - app/views/securial/securial_mailer/forgot_password.text.erb
110
+ - app/views/securial/securial_mailer/sign_in.html.erb
111
+ - app/views/securial/securial_mailer/sign_in.text.erb
112
+ - app/views/securial/securial_mailer/update_account.html.erb
113
+ - app/views/securial/securial_mailer/update_account.text.erb
114
+ - app/views/securial/securial_mailer/welcome.html.erb
115
+ - app/views/securial/securial_mailer/welcome.text.erb
236
116
  - app/views/securial/sessions/_session.json.jbuilder
237
117
  - app/views/securial/sessions/index.json.jbuilder
238
118
  - app/views/securial/sessions/show.json.jbuilder
@@ -243,10 +123,10 @@ files:
243
123
  - app/views/securial/users/show.json.jbuilder
244
124
  - bin/securial
245
125
  - config/routes.rb
246
- - db/migrate/20250515104930_create_securial_roles.rb
247
- - db/migrate/20250517155521_create_securial_users.rb
248
- - db/migrate/20250518122749_create_securial_role_assignments.rb
249
- - db/migrate/20250519075407_create_securial_sessions.rb
126
+ - db/migrate/20250603130214_create_securial_roles.rb
127
+ - db/migrate/20250604110520_create_securial_users.rb
128
+ - db/migrate/20250604123805_create_securial_role_assignments.rb
129
+ - db/migrate/20250604184841_create_securial_sessions.rb
250
130
  - lib/generators/factory_bot/model/model_generator.rb
251
131
  - lib/generators/factory_bot/templates/factory.erb
252
132
  - lib/generators/securial/install/install_generator.rb
@@ -264,13 +144,24 @@ files:
264
144
  - lib/securial.rb
265
145
  - lib/securial/auth.rb
266
146
  - lib/securial/auth/auth_encoder.rb
267
- - lib/securial/auth/errors.rb
268
147
  - lib/securial/auth/session_creator.rb
148
+ - lib/securial/auth/token_generator.rb
269
149
  - lib/securial/config.rb
270
150
  - lib/securial/config/configuration.rb
271
- - lib/securial/config/errors.rb
272
151
  - lib/securial/config/validation.rb
152
+ - lib/securial/config/validation/logger_validation.rb
153
+ - lib/securial/config/validation/mailer_validation.rb
154
+ - lib/securial/config/validation/password_validation.rb
155
+ - lib/securial/config/validation/response_validation.rb
156
+ - lib/securial/config/validation/roles_validation.rb
157
+ - lib/securial/config/validation/security_validation.rb
158
+ - lib/securial/config/validation/session_validation.rb
273
159
  - lib/securial/engine.rb
160
+ - lib/securial/engine_initializers.rb
161
+ - lib/securial/error.rb
162
+ - lib/securial/error/auth.rb
163
+ - lib/securial/error/base_securial_error.rb
164
+ - lib/securial/error/config.rb
274
165
  - lib/securial/factories/securial/role_assignments.rb
275
166
  - lib/securial/factories/securial/roles.rb
276
167
  - lib/securial/factories/securial/sessions.rb
@@ -278,31 +169,30 @@ files:
278
169
  - lib/securial/helpers.rb
279
170
  - lib/securial/helpers/normalizing_helper.rb
280
171
  - lib/securial/helpers/regex_helper.rb
281
- - lib/securial/inspectors.rb
282
- - lib/securial/inspectors/route_inspector.rb
283
- - lib/securial/key_transformer.rb
172
+ - lib/securial/helpers/roles_helper.rb
284
173
  - lib/securial/logger.rb
285
174
  - lib/securial/logger/broadcaster.rb
286
175
  - lib/securial/logger/builder.rb
287
- - lib/securial/logger/colors.rb
288
- - lib/securial/middlewares.rb
289
- - lib/securial/middlewares/request_logger_tag.rb
290
- - lib/securial/middlewares/transform_request_keys.rb
291
- - lib/securial/middlewares/transform_response_keys.rb
292
- - lib/securial/security.rb
293
- - lib/securial/security/request_rate_limiter.rb
176
+ - lib/securial/logger/formatter.rb
177
+ - lib/securial/middleware.rb
178
+ - lib/securial/middleware/request_tag_logger.rb
294
179
  - lib/securial/version.rb
295
- - lib/securial/version_checker.rb
296
180
  - lib/tasks/securial_tasks.rake
297
181
  homepage: https://github.com/AlyBadawy/Securial/wiki
298
182
  licenses:
299
183
  - MIT
300
184
  metadata:
301
- release_date: '2025-06-01'
185
+ release_date: '2025-06-06'
302
186
  allowed_push_host: https://rubygems.org
303
187
  homepage_uri: https://github.com/AlyBadawy/Securial/wiki
304
188
  source_code_uri: https://github.com/AlyBadawy/Securial
305
189
  changelog_uri: https://github.com/AlyBadawy/Securial/blob/main/CHANGELOG.md
190
+ post_install_message: "\n ---\n [SECURIAL] Thank you for installing Securial!\n\n
191
+ \ Securial is a mountable Rails engine that provides robust,\n extensible authentication
192
+ and access control for Rails applications.\n Please review the [changelog]
193
+ and [WIKI] for more info on the latest\n changes and how to use this gem/engine:\n
194
+ \ [changelog]: https://github.com/AlyBadawy/Securial/blob/main/CHANGELOG.md\n
195
+ \ [WIKI]: https://github.com/AlyBadawy/Securial/wiki\n ---\n "
306
196
  rdoc_options: []
307
197
  require_paths:
308
198
  - lib
@@ -310,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
310
200
  requirements:
311
201
  - - ">="
312
202
  - !ruby/object:Gem::Version
313
- version: 3.4.1
203
+ version: 3.4.0
314
204
  required_rubygems_version: !ruby/object:Gem::Requirement
315
205
  requirements:
316
206
  - - ">="
@@ -1,5 +0,0 @@
1
- <p>
2
- You can reset your password within the next <%= Securial.configuration.reset_password_token_expires_in.inspect %>.
3
- </p>
4
-
5
- <p>Your password reset token is: <%= @user.reset_password_token %></p>
@@ -1,4 +0,0 @@
1
- You can reset your password within the next <%= Securial.configuration.reset_password_token_expires_in.inspect %>.
2
-
3
-
4
- Your password reset token is: <%= @user.reset_password_token %>
@@ -1,15 +0,0 @@
1
- module Securial
2
- module Auth
3
- module Errors
4
- class BaseAuthError < StandardError
5
- def backtrace; []; end
6
- end
7
-
8
- class AuthEncodeError < BaseAuthError; end
9
- class AuthDecodeError < BaseAuthError; end
10
-
11
- class AuthRevokedError < BaseAuthError; end
12
- class AuthExpiredError < BaseAuthError; end
13
- end
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- module Securial
2
- module Config
3
- module Errors
4
- class BaseConfigError < StandardError
5
- def backtrace; []; end
6
- end
7
-
8
- class ConfigAdminRoleError < BaseConfigError; end
9
-
10
- class ConfigSessionExpirationDurationError < BaseConfigError; end
11
- class ConfigSessionAlgorithmError < BaseConfigError; end
12
- class ConfigSessionSecretError < BaseConfigError; end
13
-
14
- class ConfigMailerSenderError < BaseConfigError; end
15
- class ConfigPasswordError < BaseConfigError; end
16
- class ConfigResponseError < BaseConfigError; end
17
- class ConfigSecurityError < BaseConfigError; end
18
- end
19
- end
20
- end
@@ -1,52 +0,0 @@
1
- module Securial
2
- module Inspectors
3
- module RouteInspector
4
- def self.print_routes(controller: nil)
5
- filtered = Securial::Engine.routes.routes.select do |r|
6
- ctrl = r.defaults[:controller]
7
- controller.nil? || ctrl == "securial/#{controller}"
8
- end
9
-
10
- print_headers(filtered, controller)
11
- print_details(filtered, controller)
12
- true
13
- end
14
-
15
- class << self
16
- private
17
-
18
- # rubocop:disable Rails/Output
19
- def print_headers(filtered, controller)
20
- Securial.logger.debug "Securial engine routes:"
21
- Securial.logger.debug "Total routes: #{filtered.size}"
22
- Securial.logger.debug "Filtered by controller: #{controller}" if controller
23
- Securial.logger.debug "Filtered routes: #{filtered.size}" if controller
24
- Securial.logger.debug "-" * 120
25
- Securial.logger.debug "#{'Verb'.ljust(8)} #{'Path'.ljust(45)} #{'Controller#Action'.ljust(40)} Name"
26
- Securial.logger.debug "-" * 120
27
- end
28
-
29
- def print_details(filtered, controller) # rubocop:disable Rails/Output
30
- if filtered.empty?
31
- if controller
32
- Securial.logger.debug "No routes found for controller: #{controller}"
33
- else
34
- Securial.logger.debug "No routes found for Securial engine"
35
- end
36
- Securial.logger.debug "-" * 120
37
- return
38
- end
39
-
40
- Securial.logger.debug filtered.map { |r|
41
- name = r.name || ""
42
- verb = r.verb.to_s.ljust(8)
43
- path = r.path.spec.to_s.sub(/\(\.:format\)/, "").ljust(45)
44
- ctrl_action = "#{r.defaults[:controller]}##{r.defaults[:action]}"
45
- "#{verb} #{path} #{ctrl_action.ljust(40)} #{name}"
46
- }.join("\n")
47
- end
48
- # rubocop:enable Rails/Output
49
- end
50
- end
51
- end
52
- end
@@ -1,8 +0,0 @@
1
- require "securial/inspectors/route_inspector"
2
-
3
- module Securial
4
- module Inspectors
5
- # This module serves as a namespace for inspectors.
6
- # It requires the RouteInspector to provide route inspection capabilities.
7
- end
8
- end
@@ -1,32 +0,0 @@
1
- # lib/securial/key_transformer.rb
2
- module Securial
3
- module KeyTransformer
4
- def self.camelize(str, format)
5
- return str unless str.is_a?(String)
6
-
7
- case format
8
- when :lowerCamelCase
9
- str.camelize(:lower)
10
- when :UpperCamelCase
11
- str.camelize
12
- else
13
- str
14
- end
15
- end
16
-
17
- def self.underscore(str)
18
- str.to_s.underscore
19
- end
20
-
21
- def self.deep_transform_keys(obj, &block)
22
- case obj
23
- when Hash
24
- obj.transform_keys(&block).transform_values { |v| deep_transform_keys(v, &block) }
25
- when Array
26
- obj.map { |e| deep_transform_keys(e, &block) }
27
- else
28
- obj
29
- end
30
- end
31
- end
32
- end
@@ -1,14 +0,0 @@
1
- module Securial
2
- module Logger
3
- COLORS = {
4
- "DEBUG" => "\e[36m", # cyan
5
- "INFO" => "\e[32m", # green
6
- "WARN" => "\e[33m", # yellow
7
- "ERROR" => "\e[31m", # red
8
- "FATAL" => "\e[35m", # magenta
9
- "UNKNOWN" => "\e[37m", # white
10
- }.freeze
11
- CLEAR = "\e[0m"
12
- SEVERITY_WIDTH = 5
13
- end
14
- end