jwt_api 0.1.2 → 0.1.3

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: 57a697d2434cc762c196c4840cde5eccc7fbc19963b5a62308acb8bc00a6471e
4
- data.tar.gz: 5d9e68e19bfe23447772da6292f1974bec10ad30a85b65d382b0579b200bcc56
3
+ metadata.gz: 2236e6e97f3f4edb359ad86ba0ea5efe092b370756ff4534eec9ef75535b5209
4
+ data.tar.gz: 4b311aadb65a2816b3b5947916df457e092dd947677bbaa8683240c864e6dd66
5
5
  SHA512:
6
- metadata.gz: e67834856aef77aced8c7ec5dc1063208207d707fab012be523d9f0a91b9bd629fec86c8dfcab94b754ca584b4393ec21ee2f5fb8c4b41248b1acb151d2a6292
7
- data.tar.gz: 61118e1d8ef1f8434e1deffa692c8b996ce7f0e2618ff09862b3157a96d398fb1dd6c3d989f9b28cda1221846ffe71beb0e312cde4cc4b7f1e7d79686d8ca8f4
6
+ metadata.gz: 505253a7de5e59e0e9c5372c269e24e2f528081d1efcd72b423a8499e2f91ed404c81549921a25f710e52fac1d86f9be1d9b3891332661636d8d42cd726f78be
7
+ data.tar.gz: a8a9ea38d901d381be290d68de1320e736c4ea5b0a7d8f7a2ed8da2f363cd63370a62717c16583247fc440202eaed7a7ff00d982c50ff77c22c72a95d03e0a89
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JwtApi
2
2
 
3
- Generate user, session, and password api routes with JWT authentication.
3
+ Scaffold a JSON Web Token API.
4
4
 
5
5
  ## Installation
6
6
 
@@ -78,5 +78,5 @@ The gem is available as open source under the terms of the [MIT License](https:/
78
78
 
79
79
  ## Code of Conduct
80
80
 
81
- Everyone interacting in the JwtApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jwt_api/blob/main/CODE_OF_CONDUCT.md).
81
+ Everyone interacting in the JwtApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/leopolicastro/jwt_api/blob/main/CODE_OF_CONDUCT.md).
82
82
 
data/jwt_api-0.1.2.gem ADDED
Binary file
@@ -8,7 +8,7 @@ class Api::BaseController < ApplicationController
8
8
  protected
9
9
 
10
10
  def authenticate_request!
11
- user_id_in_token?
11
+ http_token && auth_token && jti_matches?
12
12
  rescue JWT::VerificationError, JWT::DecodeError
13
13
  render json: { errors: ['Unauthorized'] }, status: :unauthorized
14
14
  end
@@ -21,8 +21,7 @@ class Api::BaseController < ApplicationController
21
21
 
22
22
  def auth_token
23
23
  @auth_token ||= jwt.decode(http_token)[0].to_h.symbolize_keys!
24
- return nil if token_expired?
25
- return @auth_token if @auth_token.present? && @auth_token[:user_id].present? && jti_matches?
24
+ return @auth_token if @auth_token.present? && @auth_token[:user_id].present? && !token_expired?
26
25
  end
27
26
 
28
27
  def token_expired?
@@ -34,10 +33,6 @@ class Api::BaseController < ApplicationController
34
33
  @current_user&.jti == @auth_token[:jti]
35
34
  end
36
35
 
37
- def user_id_in_token?
38
- http_token && auth_token
39
- end
40
-
41
36
  def user_reset_token_in_params?
42
37
  params[:reset_password_token]
43
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JwtApi
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Policastro
@@ -48,8 +48,7 @@ files:
48
48
  - Rakefile
49
49
  - bin/console
50
50
  - bin/setup
51
- - jwt_api-0.1.0.gem
52
- - jwt_api-0.1.1.gem
51
+ - jwt_api-0.1.2.gem
53
52
  - jwt_api.gemspec
54
53
  - lib/generators/jwt_api/setup_generator.rb
55
54
  - lib/generators/jwt_api/templates/api/base_controller.rb
data/jwt_api-0.1.0.gem DELETED
Binary file
data/jwt_api-0.1.1.gem DELETED
Binary file