authentication-zero 0.0.16 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17eaa95bd573232e512f8294bc79a5921d38cc85e7601efcea5cdb4227bb93ed
|
4
|
+
data.tar.gz: bef3e4a664a160fa730acd33be0228182ba893c312fd62f331d9459a8d13fe48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d7dae9a8c8f8375ac33f52cb6a0f63d1fb60c5ea7d131d18a41a5dde31690554418994fcec85f958af43c57175643dab340db561835565bea6bbcdd4bf13254
|
7
|
+
data.tar.gz: 30d9f0e001f5430f5d6c87452ea395eeb1943479c3ce4b516f7b0e576ad784708a5b73fc9ef3e6069db241f9f5987a4661ec73ff3823ecec596f8100e70d168f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -17,15 +17,15 @@ The purpose of authentication zero is to generate a pre-built authentication sys
|
|
17
17
|
|
18
18
|
## Security and best practices
|
19
19
|
|
20
|
-
- [Current attributes](https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html): Abstract super class that provides a thread-isolated attributes singleton, which resets automatically before and after each request.
|
21
20
|
- [has_secure_password](https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-i-has_secure_password): Adds methods to set and authenticate against a BCrypt password.
|
22
21
|
- [has_secure_token](https://api.rubyonrails.org/classes/ActiveRecord/SecureToken/ClassMethods.html#method-i-has_secure_token): Adds methods to generate unique tokens.
|
23
22
|
- [signed_id](https://api.rubyonrails.org/classes/ActiveRecord/SignedId.html): Returns a signed id that is tamper proof, so it's safe to send in an email or otherwise share with the outside world.
|
24
|
-
- [
|
25
|
-
- [
|
26
|
-
- [
|
27
|
-
- [Callbacks](https://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html): We use callbacks to send emails
|
23
|
+
- [signed cookies](https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html): Returns a jar that'll automatically generate a signed representation of cookie value and verify it when reading from the cookie again.
|
24
|
+
- [httponly cookies](https://api.rubyonrails.org/classes/ActionDispatch/Cookies.html): A cookie with the httponly attribute is inaccessible to the JavaScript, this precaution helps mitigate cross-site scripting (XSS) attacks.
|
25
|
+
- [Current attributes](https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html): Abstract super class that provides a thread-isolated attributes singleton, which resets automatically before and after each request.
|
26
|
+
- [Callbacks](https://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html): We use callbacks to send emails after changing an email or password.
|
28
27
|
- [Action mailer](https://api.rubyonrails.org/classes/ActionMailer/Base.html): Action Mailer allows you to send email from your application using a mailer model and views.
|
28
|
+
- [Log filtering](https://guides.rubyonrails.org/action_controller_overview.html#log-filtering): Parameters 'token' and 'password' are marked [FILTERED] in the log.
|
29
29
|
|
30
30
|
## Installation
|
31
31
|
|
@@ -60,7 +60,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
60
60
|
private
|
61
61
|
def authenticate
|
62
62
|
if #{singular_table_name} = authenticate_with_http_token { |t, _| #{class_name}.find_signed_session_token(t) }
|
63
|
-
Current
|
63
|
+
Current.#{singular_table_name} = #{singular_table_name}
|
64
64
|
else
|
65
65
|
request_http_token_authentication
|
66
66
|
end
|
@@ -74,7 +74,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
74
74
|
private
|
75
75
|
def authenticate
|
76
76
|
if #{singular_table_name} = #{class_name}.find_by_session_token(cookies.signed[:session_token])
|
77
|
-
Current
|
77
|
+
Current.#{singular_table_name} = #{singular_table_name}
|
78
78
|
else
|
79
79
|
redirect_to sign_in_path, alert: "You need to sign in or sign up before continuing"
|
80
80
|
end
|
@@ -21,7 +21,7 @@ class <%= class_name %> < ApplicationRecord
|
|
21
21
|
PasswordMailer.with(<%= singular_table_name %>: self).changed.deliver_later
|
22
22
|
end
|
23
23
|
end
|
24
|
-
<% if options.api?
|
24
|
+
<% if options.api? %>
|
25
25
|
def signed_session_token
|
26
26
|
self.class.signed_id_verifier.generate(session_token)
|
27
27
|
end
|