authentication-zero 2.8.1 → 2.8.2
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/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/authentication_generator.rb +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea407810dad8ddf7ac7366ebf6fe46c7d3558b2376fc33981ecb5ee32d968f0
|
4
|
+
data.tar.gz: 9be562630186a350cb34df5d395692b99219f5627568a19715d3c826b706cffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e08a25cda16b7e975057159b8cafac1a9e20a94730c5a28a10f9b5d26a66d448895e2b726141a1f6091042e2ffc31c730bcae0ca9d7609b0b5cde5b3bb5ae7d
|
7
|
+
data.tar.gz: 4c00dd86cea638d791c1306114405cac87c7703aa615e730be5fb6719293b0c76fd83ec905cc7043af0e282605240ccab85225167db7e2aa6cba6a2d576ff570
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@ The purpose of authentication zero is to generate a pre-built authentication sys
|
|
11
11
|
- Checks if a password has been found in any data breach (--pwned)
|
12
12
|
- Authentication by cookie
|
13
13
|
- Authentication by token (--api)
|
14
|
-
- Social Login with OmniAuth (--
|
14
|
+
- Social Login with OmniAuth (--omniauthable)
|
15
15
|
- Ask password before sensitive data changes, aka: sudo
|
16
16
|
- Reset the user password and send reset instructions
|
17
17
|
- Reset the user password only from verified emails
|
@@ -3,11 +3,11 @@ require "rails/generators/active_record"
|
|
3
3
|
class AuthenticationGenerator < Rails::Generators::NamedBase
|
4
4
|
include ActiveRecord::Generators::Migration
|
5
5
|
|
6
|
-
class_option :api,
|
7
|
-
class_option :pwned,
|
8
|
-
class_option :lockable,
|
9
|
-
class_option :ratelimit,
|
10
|
-
class_option :
|
6
|
+
class_option :api, type: :boolean, desc: "Generates API authentication"
|
7
|
+
class_option :pwned, type: :boolean, desc: "Add pwned password validation"
|
8
|
+
class_option :lockable, type: :boolean, desc: "Add password reset locking"
|
9
|
+
class_option :ratelimit, type: :boolean, desc: "Add request rate limiting"
|
10
|
+
class_option :omniauthable, type: :boolean, desc: "Add social login support"
|
11
11
|
|
12
12
|
source_root File.expand_path("templates", __dir__)
|
13
13
|
|
@@ -24,7 +24,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
24
24
|
gem "rack-ratelimit", group: :production, comment: "Use Rack::Ratelimit to rate limit requests [https://github.com/jeremy/rack-ratelimit]"
|
25
25
|
end
|
26
26
|
|
27
|
-
if
|
27
|
+
if omniauthable?
|
28
28
|
gem "omniauth", comment: "Use OmniAuth to support multi-provider authentication [https://github.com/omniauth/omniauth]"
|
29
29
|
gem "omniauth-rails_csrf_protection", comment: "Provides a mitigation against CVE-2015-9284 [https://github.com/cookpad/omniauth-rails_csrf_protection]"
|
30
30
|
end
|
@@ -32,7 +32,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
32
32
|
|
33
33
|
def create_configuration_files
|
34
34
|
copy_file "config/redis/shared.yml", "config/redis/shared.yml" if options.lockable?
|
35
|
-
copy_file "config/initializers/omniauth.rb", "config/initializers/omniauth.rb" if
|
35
|
+
copy_file "config/initializers/omniauth.rb", "config/initializers/omniauth.rb" if omniauthable?
|
36
36
|
end
|
37
37
|
|
38
38
|
def add_environment_configurations
|
@@ -47,7 +47,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
47
47
|
def create_migrations
|
48
48
|
migration_template "migrations/create_table_migration.rb", "#{db_migrate_path}/create_#{table_name}.rb"
|
49
49
|
migration_template "migrations/create_sessions_migration.rb", "#{db_migrate_path}/create_sessions.rb"
|
50
|
-
migration_template "migrations/add_omniauth_migration.rb", "#{db_migrate_path}/add_omniauth_to_#{table_name}.rb" if
|
50
|
+
migration_template "migrations/add_omniauth_migration.rb", "#{db_migrate_path}/add_omniauth_to_#{table_name}.rb" if omniauthable?
|
51
51
|
end
|
52
52
|
|
53
53
|
def create_models
|
@@ -106,7 +106,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
106
106
|
|
107
107
|
def create_controllers
|
108
108
|
directory "controllers/#{format_folder}", "app/controllers"
|
109
|
-
template "controllers/omniauth_controller.rb", "app/controllers/sessions/omniauth_controller.rb" if
|
109
|
+
template "controllers/omniauth_controller.rb", "app/controllers/sessions/omniauth_controller.rb" if omniauthable?
|
110
110
|
end
|
111
111
|
|
112
112
|
def create_views
|
@@ -123,7 +123,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def add_routes
|
126
|
-
if
|
126
|
+
if omniauthable?
|
127
127
|
route "post '/auth/:provider/callback', to: 'sessions/omniauth#create'"
|
128
128
|
route "get '/auth/:provider/callback', to: 'sessions/omniauth#create'"
|
129
129
|
route "get '/auth/failure', to: 'sessions/omniauth#failure'"
|
@@ -151,7 +151,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
151
151
|
options.api? ? "api" : "html"
|
152
152
|
end
|
153
153
|
|
154
|
-
def
|
155
|
-
options.
|
154
|
+
def omniauthable?
|
155
|
+
options.omniauthable? && !options.api?
|
156
156
|
end
|
157
157
|
end
|