propel_authentication 0.1.3 → 0.2.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 +128 -0
- data/README.md +254 -116
- data/lib/generators/{propel_auth → propel_authentication}/install_generator.rb +152 -170
- data/lib/generators/propel_authentication/templates/application_mailer.rb +6 -0
- data/lib/generators/propel_authentication/templates/auth/passwords_controller.rb.tt +132 -0
- data/lib/generators/propel_authentication/templates/auth/signup_controller.rb.tt +242 -0
- data/lib/generators/{propel_auth/templates → propel_authentication/templates/auth}/tokens_controller.rb.tt +39 -22
- data/lib/generators/{propel_auth → propel_authentication}/templates/auth_mailer.rb +3 -1
- data/lib/generators/{propel_auth → propel_authentication}/templates/authenticatable.rb +10 -4
- data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/confirmable.rb +3 -3
- data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/lockable.rb +10 -8
- data/lib/generators/{propel_auth/templates/concerns/propel_authentication.rb → propel_authentication/templates/concerns/propel_authentication_concern.rb} +33 -3
- data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/recoverable.rb +21 -11
- data/lib/generators/propel_authentication/templates/core/configuration_methods.rb +191 -0
- data/lib/generators/propel_authentication/templates/db/seeds.rb +75 -0
- data/lib/generators/propel_authentication/templates/doc/signup_flow.md +315 -0
- data/lib/generators/propel_authentication/templates/models/agency.rb.tt +13 -0
- data/lib/generators/propel_authentication/templates/models/agent.rb.tt +13 -0
- data/lib/generators/{propel_auth/templates/invitation.rb → propel_authentication/templates/models/invitation.rb.tt} +8 -2
- data/lib/generators/propel_authentication/templates/models/organization.rb.tt +12 -0
- data/lib/generators/{propel_auth/templates/user.rb → propel_authentication/templates/models/user.rb.tt} +5 -0
- data/lib/generators/propel_authentication/templates/propel_authentication.rb.tt +218 -0
- data/lib/generators/propel_authentication/templates/routes/auth_routes.rb.tt +55 -0
- data/lib/generators/{propel_auth → propel_authentication}/templates/services/auth_notification_service.rb +3 -3
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/confirmable_test.rb.tt +34 -10
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/lockable_test.rb.tt +12 -12
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/propel_authentication_test.rb.tt +2 -2
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/concerns/recoverable_test.rb.tt +11 -11
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/controllers/auth/lockable_integration_test.rb.tt +18 -15
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/controllers/auth/password_reset_integration_test.rb.tt +38 -40
- data/lib/generators/propel_authentication/templates/test/controllers/auth/signup_controller_test.rb.tt +201 -0
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/controllers/auth/tokens_controller_test.rb.tt +33 -25
- data/lib/generators/{propel_auth → propel_authentication}/templates/test/mailers/auth_mailer_test.rb.tt +51 -36
- data/lib/generators/{propel_auth → propel_authentication}/templates/user_test.rb.tt +1 -1
- data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/email_confirmation.html.erb +2 -2
- data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/email_confirmation.text.erb +1 -1
- data/lib/generators/{propel_auth → propel_authentication}/test/generators/authentication/install_generator_test.rb +4 -4
- data/lib/generators/{propel_auth → propel_authentication}/test/generators/authentication/uninstall_generator_test.rb +1 -1
- data/lib/generators/{propel_auth → propel_authentication}/test/integration/generator_integration_test.rb +1 -1
- data/lib/generators/{propel_auth → propel_authentication}/test/integration/multi_version_generator_test.rb +13 -12
- data/lib/generators/{propel_auth → propel_authentication}/unpack_generator.rb +55 -38
- data/lib/propel_authentication.rb +3 -0
- metadata +101 -98
- data/lib/generators/propel_auth/core/configuration_methods.rb +0 -134
- data/lib/generators/propel_auth/pack_generator.rb +0 -277
- data/lib/generators/propel_auth/templates/agency.rb +0 -7
- data/lib/generators/propel_auth/templates/agent.rb +0 -7
- data/lib/generators/propel_auth/templates/auth/base_passwords_controller.rb.tt +0 -99
- data/lib/generators/propel_auth/templates/auth/base_tokens_controller.rb.tt +0 -90
- data/lib/generators/propel_auth/templates/auth/passwords_controller.rb.tt +0 -126
- data/lib/generators/propel_auth/templates/db/seeds.rb +0 -29
- data/lib/generators/propel_auth/templates/organization.rb +0 -7
- data/lib/generators/propel_auth/templates/propel_auth.rb.tt +0 -141
- data/lib/propel_auth.rb +0 -3
- /data/lib/generators/{propel_auth → propel_authentication}/templates/concerns/rack_session_disable.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/config/environments/development_email.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_agencies.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_agents.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_invitations.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_organizations.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_users.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/test/mailers/previews/auth_mailer_preview.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/account_unlock.html.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/account_unlock.text.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/password_reset.html.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/password_reset.text.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/user_invitation.html.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/templates/views/auth_mailer/user_invitation.text.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/Dockerfile +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/Gemfile +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/README.md +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/Rakefile +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/assets/stylesheets/application.css +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/controllers/application_controller.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/helpers/application_helper.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/jobs/application_job.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/mailers/application_mailer.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/models/application_record.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/layouts/application.html.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/layouts/mailer.html.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/layouts/mailer.text.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/pwa/manifest.json.erb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/views/pwa/service-worker.js +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/brakeman +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/dev +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/docker-entrypoint +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/rails +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/rake +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/rubocop +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/setup +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/bin/thrust +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/application.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/boot.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/cable.yml +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/credentials.yml.enc +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/database.yml +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environment.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/development.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/production.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/test.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/assets.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/content_security_policy.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/inflections.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/locales/en.yml +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/master.key +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/puma.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/routes.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/storage.yml +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config.ru +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/dummy/db/schema.rb +0 -0
- /data/lib/generators/{propel_auth → propel_authentication}/test/generators/authentication/controllers/tokens_controller_test.rb +0 -0
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# PropelAuth Runtime and Configuration
|
|
4
|
-
# This file was generated by: rails generate propel_auth:install
|
|
5
|
-
#
|
|
6
|
-
# This contains ALL PropelAuth runtime functionality - no gem dependency required!
|
|
7
|
-
# This module provides JWT-based authentication for Rails applications
|
|
8
|
-
# with features like account lockout, password reset, and email confirmation.
|
|
9
|
-
|
|
10
|
-
require "rails"
|
|
11
|
-
|
|
12
|
-
module PropelAuth
|
|
13
|
-
class Error < StandardError; end
|
|
14
|
-
|
|
15
|
-
class << self
|
|
16
|
-
def configuration
|
|
17
|
-
@configuration ||= Configuration.new
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def configure
|
|
21
|
-
yield(configuration)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def reset_configuration!
|
|
25
|
-
@configuration = Configuration.new
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
class Configuration
|
|
30
|
-
attr_accessor :jwt_secret,
|
|
31
|
-
:jwt_expiration,
|
|
32
|
-
:jwt_algorithm,
|
|
33
|
-
:password_length,
|
|
34
|
-
:allow_registration,
|
|
35
|
-
:require_email_confirmation,
|
|
36
|
-
:confirmation_period,
|
|
37
|
-
:confirmation_resend_interval,
|
|
38
|
-
:max_failed_attempts,
|
|
39
|
-
:lockout_duration,
|
|
40
|
-
:password_reset_expiration,
|
|
41
|
-
:password_reset_rate_limit,
|
|
42
|
-
:frontend_url,
|
|
43
|
-
:email_from_address,
|
|
44
|
-
:support_email,
|
|
45
|
-
:enable_email_notifications,
|
|
46
|
-
:enable_sms_notifications,
|
|
47
|
-
:namespace,
|
|
48
|
-
:version
|
|
49
|
-
|
|
50
|
-
def initialize
|
|
51
|
-
# JWT Configuration defaults
|
|
52
|
-
@jwt_secret = nil # Will be set in configuration block
|
|
53
|
-
@jwt_expiration = 24.hours
|
|
54
|
-
@jwt_algorithm = 'HS256'
|
|
55
|
-
|
|
56
|
-
# Password requirements
|
|
57
|
-
@password_length = 8..128
|
|
58
|
-
|
|
59
|
-
# User registration settings
|
|
60
|
-
@allow_registration = true
|
|
61
|
-
|
|
62
|
-
# Email confirmation settings
|
|
63
|
-
@require_email_confirmation = false
|
|
64
|
-
@confirmation_period = 24.hours # How long confirmation tokens are valid
|
|
65
|
-
@confirmation_resend_interval = 1.minute # Minimum time between resend attempts
|
|
66
|
-
|
|
67
|
-
# Account lockout settings
|
|
68
|
-
@max_failed_attempts = 10
|
|
69
|
-
@lockout_duration = 30.minutes
|
|
70
|
-
|
|
71
|
-
# Password reset settings
|
|
72
|
-
@password_reset_expiration = 15.minutes
|
|
73
|
-
@password_reset_rate_limit = 1.minute
|
|
74
|
-
|
|
75
|
-
# Frontend URL for email links (configure for your frontend application)
|
|
76
|
-
@frontend_url = Rails.env.development? ? 'http://localhost:3000' : nil
|
|
77
|
-
|
|
78
|
-
# Email configuration
|
|
79
|
-
@email_from_address = "noreply@#{Rails.application.class.module_parent.name.downcase}.com"
|
|
80
|
-
@support_email = "support@#{Rails.application.class.module_parent.name.downcase}.com"
|
|
81
|
-
|
|
82
|
-
# Notification preferences
|
|
83
|
-
@enable_email_notifications = true
|
|
84
|
-
@enable_sms_notifications = false # Requires SMS provider configuration
|
|
85
|
-
|
|
86
|
-
# API namespace and versioning configuration
|
|
87
|
-
@namespace = nil # Default to no namespace for clean URLs like /login
|
|
88
|
-
@version = nil # Default to no version for clean URLs like /login
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
class Engine < Rails::Engine
|
|
93
|
-
initializer 'propel_auth.load_generators' do |app|
|
|
94
|
-
config.generators do |g|
|
|
95
|
-
g.test_framework :minitest, fixture: true
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# Configure PropelAuth with secure defaults
|
|
102
|
-
PropelAuth.configure do |config|
|
|
103
|
-
# JWT Configuration for API authentication
|
|
104
|
-
config.jwt_secret = Rails.application.credentials.secret_key_base || ENV['SECRET_KEY_BASE'] || 'your-secret-key'
|
|
105
|
-
config.jwt_expiration = 24.hours
|
|
106
|
-
|
|
107
|
-
# Password requirements
|
|
108
|
-
config.password_length = 8..128
|
|
109
|
-
|
|
110
|
-
# User registration settings
|
|
111
|
-
config.allow_registration = true
|
|
112
|
-
|
|
113
|
-
# Email confirmation (for future use)
|
|
114
|
-
config.require_email_confirmation = false
|
|
115
|
-
|
|
116
|
-
# Account lockout settings
|
|
117
|
-
config.max_failed_attempts = 10
|
|
118
|
-
config.lockout_duration = 30.minutes
|
|
119
|
-
|
|
120
|
-
# Password reset settings
|
|
121
|
-
config.password_reset_expiration = 15.minutes
|
|
122
|
-
config.password_reset_rate_limit = 1.minute
|
|
123
|
-
|
|
124
|
-
# Environment-specific settings
|
|
125
|
-
if Rails.env.development?
|
|
126
|
-
# Development-specific settings
|
|
127
|
-
config.jwt_expiration = 24.hours
|
|
128
|
-
elsif Rails.env.production?
|
|
129
|
-
# Production-specific settings - shorter token expiration for security
|
|
130
|
-
config.jwt_expiration = 2.hours
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
# URL structure configuration (set by generator)
|
|
134
|
-
config.namespace = <%= @auth_namespace ? "'#{@auth_namespace}'" : 'nil' %>
|
|
135
|
-
config.version = <%= @auth_version ? "'#{@auth_version}'" : 'nil' %>
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# PropelAuth is now fully extracted to your application!
|
|
139
|
-
# - All runtime code is in this file
|
|
140
|
-
# - Generator logic can be extracted with: rails generate propel_auth:unpack
|
|
141
|
-
# - You can remove 'propel_auth' from your Gemfile after installation
|
data/lib/propel_auth.rb
DELETED
|
File without changes
|
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_agencies.rb
RENAMED
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_agents.rb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/templates/db/migrate/create_users.rb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/test/dummy/app/jobs/application_job.rb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/credentials.yml.enc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/environments/test.rb
RENAMED
|
File without changes
|
/data/lib/generators/{propel_auth → propel_authentication}/test/dummy/config/initializers/assets.rb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|