api_guard 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api_guard/jwt_auth/authentication.rb +4 -11
- data/lib/api_guard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6163657dcf0320abbfc8e4bde50f0e991ec68a6f
|
4
|
+
data.tar.gz: 33fc35d38fd11c550108008c9878bf5461b2e089
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8cc3aa3863bd6f2e7ff3e54004c4af9ab7c053d21554af98f4f38d75494833b541472b8ed3327540f608b5efc70cbd4bfa84e641a90e7a58ab80a001e73f9cc
|
7
|
+
data.tar.gz: 7cc0936550701a8fcfccf9953d6cb30d4d03269d7478a3f62ea4bb6774696ac97acdad59cfc02a740a37fad7a58c4f8687586ce00e185b4d6f65257d54e7f775
|
@@ -18,11 +18,10 @@ module ApiGuard
|
|
18
18
|
def authenticate_and_set_resource(resource_name)
|
19
19
|
@resource_name = resource_name
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
@token = request.headers['Authorization']&.split('Bearer ')&.last
|
22
|
+
return render_error(401, message: 'Access token is missing in the request') unless @token
|
23
|
+
|
24
|
+
authenticate_token
|
26
25
|
|
27
26
|
# Render error response only if no resource found and no previous render happened
|
28
27
|
render_error(401, message: 'Invalid access token') if !current_resource && !performed?
|
@@ -34,12 +33,6 @@ module ApiGuard
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
|
-
# Override to send JSON response instead of plain HTML
|
38
|
-
# if 'Authorization' header is empty or value of the header is invalid
|
39
|
-
def request_http_token_authentication(realm = 'Application', _message = nil)
|
40
|
-
render_error(401, message: 'Access token is missing in the request')
|
41
|
-
end
|
42
|
-
|
43
36
|
# Decode the JWT token
|
44
37
|
# and don't verify token expiry for refresh token API request
|
45
38
|
def decode_token
|
data/lib/api_guard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_guard
|
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
|
- Gokul Murali
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|