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 +4 -4
- data/README.md +2 -2
- data/jwt_api-0.1.2.gem +0 -0
- data/lib/generators/jwt_api/templates/api/base_controller.rb +2 -7
- data/lib/jwt_api/version.rb +1 -1
- metadata +2 -3
- data/jwt_api-0.1.0.gem +0 -0
- data/jwt_api-0.1.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2236e6e97f3f4edb359ad86ba0ea5efe092b370756ff4534eec9ef75535b5209
|
4
|
+
data.tar.gz: 4b311aadb65a2816b3b5947916df457e092dd947677bbaa8683240c864e6dd66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 505253a7de5e59e0e9c5372c269e24e2f528081d1efcd72b423a8499e2f91ed404c81549921a25f710e52fac1d86f9be1d9b3891332661636d8d42cd726f78be
|
7
|
+
data.tar.gz: a8a9ea38d901d381be290d68de1320e736c4ea5b0a7d8f7a2ed8da2f363cd63370a62717c16583247fc440202eaed7a7ff00d982c50ff77c22c72a95d03e0a89
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# JwtApi
|
2
2
|
|
3
|
-
|
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/
|
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
|
-
|
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
|
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
|
data/lib/jwt_api/version.rb
CHANGED
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.
|
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.
|
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
|