rails_authentication 0.3.0 → 0.5.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +83 -14
  3. data/lib/generators/authentication/authentication_generator.rb +31 -0
  4. data/lib/generators/authentication/features/confirmable.rb +13 -12
  5. data/lib/generators/authentication/features/invitable.rb +14 -13
  6. data/lib/generators/authentication/features/lockable.rb +13 -12
  7. data/lib/generators/authentication/features/magic_link.rb +13 -12
  8. data/lib/generators/authentication/features/ott.rb +31 -0
  9. data/lib/generators/authentication/features/passkey.rb +36 -0
  10. data/lib/generators/authentication/features/recoverable.rb +13 -12
  11. data/lib/generators/authentication/features/registerable.rb +7 -6
  12. data/lib/generators/authentication/features/rememberable.rb +6 -5
  13. data/lib/generators/authentication/features/timeoutable.rb +7 -6
  14. data/lib/generators/authentication/features/trackable.rb +7 -6
  15. data/lib/generators/authentication/features/validatable.rb +5 -4
  16. data/lib/generators/authentication/templates/app/controllers/otts_controller.rb.tt +95 -0
  17. data/lib/generators/authentication/templates/app/controllers/passkey_sessions_controller.rb.tt +68 -0
  18. data/lib/generators/authentication/templates/app/controllers/sessions_controller.rb.tt +4 -0
  19. data/lib/generators/authentication/templates/app/controllers/webauthn_credentials_controller.rb.tt +43 -0
  20. data/lib/generators/authentication/templates/app/mailers/otts_mailer.rb.tt +6 -0
  21. data/lib/generators/authentication/templates/app/models/concerns/confirmable_concern.rb.tt +18 -17
  22. data/lib/generators/authentication/templates/app/models/concerns/ott_concern.rb.tt +50 -0
  23. data/lib/generators/authentication/templates/app/models/concerns/passkey_concern.rb.tt +19 -0
  24. data/lib/generators/authentication/templates/app/models/webauthn_credential.rb.tt +6 -0
  25. data/lib/generators/authentication/templates/app/views/otts/edit.html.erb.tt +79 -0
  26. data/lib/generators/authentication/templates/app/views/otts_mailer/ott.html.erb.tt +8 -0
  27. data/lib/generators/authentication/templates/app/views/otts_mailer/ott.text.erb.tt +6 -0
  28. data/lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt +4 -0
  29. data/lib/generators/authentication/templates/app/views/sessions/new.html.erb.tt +81 -0
  30. data/lib/generators/authentication/templates/app/views/webauthn_credentials/index.html.erb.tt +19 -0
  31. data/lib/generators/authentication/templates/app/views/webauthn_credentials/new.html.erb.tt +71 -0
  32. data/lib/generators/authentication/templates/config/initializers/webauthn.rb.tt +11 -0
  33. data/lib/generators/authentication/templates/db/migrate/add_ott_to_users.rb.tt +7 -0
  34. data/lib/generators/authentication/templates/db/migrate/add_webauthn_id_to_users.rb.tt +7 -0
  35. data/lib/generators/authentication/templates/db/migrate/create_webauthn_credentials.rb.tt +15 -0
  36. data/lib/rails_authentication/version.rb +1 -1
  37. metadata +19 -1
@@ -0,0 +1,7 @@
1
+ class AddWebauthnIdToUsers < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ add_column :users, :webauthn_id, :string
4
+
5
+ add_index :users, :webauthn_id, unique: true
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ class CreateWebauthnCredentials < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ create_table :webauthn_credentials do |t|
4
+ t.references :user, null: false, foreign_key: true
5
+ t.string :external_id, null: false
6
+ t.string :public_key, null: false
7
+ t.string :nickname
8
+ t.bigint :sign_count, null: false, default: 0
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :webauthn_credentials, :external_id, unique: true
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAuthentication
4
- VERSION = "0.3.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Freerksen
@@ -38,6 +38,8 @@ files:
38
38
  - lib/generators/authentication/features/invitable.rb
39
39
  - lib/generators/authentication/features/lockable.rb
40
40
  - lib/generators/authentication/features/magic_link.rb
41
+ - lib/generators/authentication/features/ott.rb
42
+ - lib/generators/authentication/features/passkey.rb
41
43
  - lib/generators/authentication/features/recoverable.rb
42
44
  - lib/generators/authentication/features/registerable.rb
43
45
  - lib/generators/authentication/features/rememberable.rb
@@ -48,25 +50,32 @@ files:
48
50
  - lib/generators/authentication/templates/app/controllers/confirmations_controller.rb.tt
49
51
  - lib/generators/authentication/templates/app/controllers/invitations_controller.rb.tt
50
52
  - lib/generators/authentication/templates/app/controllers/magic_links_controller.rb.tt
53
+ - lib/generators/authentication/templates/app/controllers/otts_controller.rb.tt
54
+ - lib/generators/authentication/templates/app/controllers/passkey_sessions_controller.rb.tt
51
55
  - lib/generators/authentication/templates/app/controllers/passwords_controller.rb.tt
52
56
  - lib/generators/authentication/templates/app/controllers/registrations_controller.rb.tt
53
57
  - lib/generators/authentication/templates/app/controllers/sessions_controller.rb.tt
54
58
  - lib/generators/authentication/templates/app/controllers/unlocks_controller.rb.tt
59
+ - lib/generators/authentication/templates/app/controllers/webauthn_credentials_controller.rb.tt
55
60
  - lib/generators/authentication/templates/app/mailers/confirmations_mailer.rb.tt
56
61
  - lib/generators/authentication/templates/app/mailers/invitations_mailer.rb.tt
57
62
  - lib/generators/authentication/templates/app/mailers/magic_links_mailer.rb.tt
63
+ - lib/generators/authentication/templates/app/mailers/otts_mailer.rb.tt
58
64
  - lib/generators/authentication/templates/app/mailers/passwords_mailer.rb.tt
59
65
  - lib/generators/authentication/templates/app/mailers/unlocks_mailer.rb.tt
60
66
  - lib/generators/authentication/templates/app/models/concerns/confirmable_concern.rb.tt
61
67
  - lib/generators/authentication/templates/app/models/concerns/invitable_concern.rb.tt
62
68
  - lib/generators/authentication/templates/app/models/concerns/lockable_concern.rb.tt
63
69
  - lib/generators/authentication/templates/app/models/concerns/magic_link_concern.rb.tt
70
+ - lib/generators/authentication/templates/app/models/concerns/ott_concern.rb.tt
71
+ - lib/generators/authentication/templates/app/models/concerns/passkey_concern.rb.tt
64
72
  - lib/generators/authentication/templates/app/models/concerns/recoverable_concern.rb.tt
65
73
  - lib/generators/authentication/templates/app/models/concerns/rememberable_concern.rb.tt
66
74
  - lib/generators/authentication/templates/app/models/concerns/timeoutable_concern.rb.tt
67
75
  - lib/generators/authentication/templates/app/models/concerns/trackable_concern.rb.tt
68
76
  - lib/generators/authentication/templates/app/models/concerns/validatable_concern.rb.tt
69
77
  - lib/generators/authentication/templates/app/models/user_auth.rb.tt
78
+ - lib/generators/authentication/templates/app/models/webauthn_credential.rb.tt
70
79
  - lib/generators/authentication/templates/app/views/confirmations/new.html.erb.tt
71
80
  - lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.html.erb.tt
72
81
  - lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.text.erb.tt
@@ -77,6 +86,9 @@ files:
77
86
  - lib/generators/authentication/templates/app/views/magic_links/new.html.erb.tt
78
87
  - lib/generators/authentication/templates/app/views/magic_links_mailer/magic_link.html.erb.tt
79
88
  - lib/generators/authentication/templates/app/views/magic_links_mailer/magic_link.text.erb.tt
89
+ - lib/generators/authentication/templates/app/views/otts/edit.html.erb.tt
90
+ - lib/generators/authentication/templates/app/views/otts_mailer/ott.html.erb.tt
91
+ - lib/generators/authentication/templates/app/views/otts_mailer/ott.text.erb.tt
80
92
  - lib/generators/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt
81
93
  - lib/generators/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt
82
94
  - lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt
@@ -85,13 +97,19 @@ files:
85
97
  - lib/generators/authentication/templates/app/views/unlocks/new.html.erb.tt
86
98
  - lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.html.erb.tt
87
99
  - lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.text.erb.tt
100
+ - lib/generators/authentication/templates/app/views/webauthn_credentials/index.html.erb.tt
101
+ - lib/generators/authentication/templates/app/views/webauthn_credentials/new.html.erb.tt
102
+ - lib/generators/authentication/templates/config/initializers/webauthn.rb.tt
88
103
  - lib/generators/authentication/templates/db/migrate/add_confirmable_to_users.rb.tt
89
104
  - lib/generators/authentication/templates/db/migrate/add_invitable_to_users.rb.tt
90
105
  - lib/generators/authentication/templates/db/migrate/add_lockable_to_users.rb.tt
91
106
  - lib/generators/authentication/templates/db/migrate/add_magic_link_to_users.rb.tt
107
+ - lib/generators/authentication/templates/db/migrate/add_ott_to_users.rb.tt
92
108
  - lib/generators/authentication/templates/db/migrate/add_recoverable_to_users.rb.tt
93
109
  - lib/generators/authentication/templates/db/migrate/add_rememberable_to_users.rb.tt
110
+ - lib/generators/authentication/templates/db/migrate/add_webauthn_id_to_users.rb.tt
94
111
  - lib/generators/authentication/templates/db/migrate/create_user_auths.rb.tt
112
+ - lib/generators/authentication/templates/db/migrate/create_webauthn_credentials.rb.tt
95
113
  - lib/rails_authentication.rb
96
114
  - lib/rails_authentication/version.rb
97
115
  homepage: https://github.com/dfreerksen/rails_authentication