authentication-zero 0.0.18 → 0.0.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f48325c2122dac114a46a7949ba07ab7693872f198076dc7bcfae87b31441c1
4
- data.tar.gz: 4117615d796766e17a773707f2dba9616eaf1ca7a59c007c831431d9b09e18eb
3
+ metadata.gz: f745db607e21f39bb22fec9452b30147cebbf4a41d49150450c14035b00b1d0e
4
+ data.tar.gz: f412264a06233f8571dad3640bf9b2ee853e289ad168ad5e12f5fa8d3a6bfb04
5
5
  SHA512:
6
- metadata.gz: a6c76a600c3a82bb51bdb638bc1d114aef80ed13b2a252af3fac6bd4e1cd05992004a9bb6ec33457cb56e0fa93a3f48209acfb5d9c41c1ca7f9542104166e01b
7
- data.tar.gz: 277192f60768925670f1580c13a0f593e27f92656987171818e09edff379b7571b88abcf0460ae9961477557bfe186e7b1a4e05e46c1ff24f760e2d0ff959301
6
+ metadata.gz: d28443fe294ac245251268f5130dc7c4776a793fcff46e89e37fbb34c419455735be7d63ac7a3fa4fbaaac976806e37f8770be6c32a44663cdee4374b2b2ffb3
7
+ data.tar.gz: 902d2c094e0d7fb1cd5c10a8b81d733fda6cb9580baf2312591cce588fe82b9b4302f80a41c6e75bd8dae037411028968cc82ff2159fb4155891f7ebd66587c1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (0.0.18)
4
+ authentication-zero (0.0.22)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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.
22
+ - [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.
23
+ - [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.
23
24
  - [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
- - [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.
25
- - [Http only 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.
26
- - [Log filtering](https://guides.rubyonrails.org/action_controller_overview.html#log-filtering): Parameters 'token' and 'password' are marked [FILTERED] in the log.
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.
27
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
 
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.22"
3
3
  end
@@ -59,10 +59,8 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
59
59
 
60
60
  private
61
61
  def authenticate
62
- if #{singular_table_name} = authenticate_with_http_token { |t, _| #{class_name}.find_signed_session_token(t) }
63
- Current.#{singular_table_name} = #{singular_table_name}
64
- else
65
- request_http_token_authentication
62
+ authenticate_or_request_with_http_token do |token, _options|
63
+ Current.#{singular_table_name} = #{class_name}.find_signed_session_token(token)
66
64
  end
67
65
  end
68
66
  CODE
@@ -21,7 +21,8 @@ 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
+
25
+ <% if options.api? -%>
25
26
  def signed_session_token
26
27
  self.class.signed_id_verifier.generate(session_token)
27
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-18 00:00:00.000000000 Z
11
+ date: 2022-02-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: