tinytokenauth-rails 0.1.10 → 0.1.11

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: ae295a501e67fee2e98e508ea9636b94f3017475742de2b6b2461fdbbe17f389
4
- data.tar.gz: d19ddced80b62167e43c170eb4fc26120696ea96988f5837fed750f0efa6e10c
3
+ metadata.gz: f6baf29c41c8a1e86f24609a31cf2331a1cbed8a9206c9f65acf3bf39e140d19
4
+ data.tar.gz: 8f886cd34190b7177e8264b87f99bb08c208e689d61489abae911e004cbee358
5
5
  SHA512:
6
- metadata.gz: b75608e2ecc22a9989498ce11d2203188cc9d24a220ead721326c18899036d0cb240dd5a08efdcff3bf40fa5b27a1b5822fd257272e39559f6f1dcce29db910b
7
- data.tar.gz: 19348987f715a8a75580d010368183a0e675ea5bec6567ecf616b876810bbc837f4741d1fd185d2684bb23f00bf275a289c2539c33dc6b15c15cf14d8acfc6d4
6
+ metadata.gz: b6878943a558518f36e2939ec891e03019d3b7646ca360729ac9a324c4b58e1aff1408f26a2cc425272bbf10327c0bc9f2e2e7bb2b1f28400ab56c4557754ff2
7
+ data.tar.gz: 254048055fb0c78ec3dc5343dfe3297cf9df3c87df2a6c62a8dea8af23b8c6277c2dcf3e100ee8867516b1ebb65cf37016654e9eb0f2b2b0dca381310d2c7cda
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tinytokenauth-rails (0.1.9)
4
+ tinytokenauth-rails (0.1.11)
5
5
  jwt (~> 2.7)
6
6
  rails (>= 6.0)
7
7
 
@@ -0,0 +1,7 @@
1
+ module Tinytokenauth
2
+ module CurrentUserHelper
3
+ def foo(options = {}, &block)
4
+ # render SimpleCalendar::Calendar.new(self, options), &block
5
+ end
6
+ end
7
+ end
@@ -20,8 +20,7 @@ module Tinytokenauth
20
20
 
21
21
  begin
22
22
  @decoded = JsonWebToken.decode(Tinytokenauth.configuration.token_secret, token)
23
- # @current_user = Tinytokenauth.configuration.user_class.send 'find', @decoded[:user_id]
24
- @current_user = User.find @decoded[:user_id]
23
+ @current_user = Tinytokenauth.configuration.user_class.constantize.send 'find', @decoded[:user_id]
25
24
  rescue ActiveRecord::RecordNotFound => e
26
25
  render json: { errors: e.message }, status: :unauthorized
27
26
  rescue JWT::DecodeError => e
@@ -33,7 +32,7 @@ module Tinytokenauth
33
32
  token = cookies[Tinytokenauth.configuration.cookie_name]
34
33
  begin
35
34
  @decoded = JsonWebToken.decode(Tinytokenauth.configuration.token_secret, token)
36
- @current_user = User.find @decoded[:user_id]
35
+ @current_user = Tinytokenauth.configuration.user_class.constantize.send 'find', @decoded[:user_id]
37
36
  @exp = @decoded[:exp]
38
37
  if Tinytokenauth.configuration.token_auto_renew_hours &&
39
38
  @exp < Tinytokenauth.configuration.token_auto_renew_hours.hours.from_now.to_i
@@ -4,7 +4,7 @@ module Tinytokenauth
4
4
  attr_accessor :user_class, :token_validity_hours, :token_auto_renew_hours, :token_secret, :cookie_name
5
5
 
6
6
  def initialize
7
- # @user_class = User
7
+ @user_class = 'User'
8
8
  @token_validity_hours = 24
9
9
  @token_auto_renew_hours = 4
10
10
  @token_secret = Rails.application.credentials.secret_key_base
@@ -1,9 +1,9 @@
1
1
  module Tinytokenauth
2
2
  class Railtie < ::Rails::Railtie
3
- # initializer "tinytokenauth-rails.view_helpers" do
4
- # ActiveSupport.on_load(:action_view) do
5
- # include ViewHelpers
6
- # end
7
- # end
3
+ initializer "tinytokenauth-rails.view_helpers" do
4
+ ActiveSupport.on_load(:action_view) do
5
+ include ViewHelpers
6
+ end
7
+ end
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tinytokenauth
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinytokenauth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kim Laplume
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-29 00:00:00.000000000 Z
11
+ date: 2023-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -53,6 +53,7 @@ files:
53
53
  - LICENSE.txt
54
54
  - README.md
55
55
  - Rakefile
56
+ - app/helpers/tinytokenauth-rails/current_user_helper.rb
56
57
  - lib/tinytokenauth.rb
57
58
  - lib/tinytokenauth/authorizable.rb
58
59
  - lib/tinytokenauth/configuration.rb