model_driven_api 3.4.3 → 3.4.4
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/app/commands/authorize_api_request.rb +4 -4
- data/lib/model_driven_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed7db62f6e456f3535221fe7fd09da02dfde4a4ac2c3951a15b229e249ca1706
|
4
|
+
data.tar.gz: fa80dce7d6e7fbca51b884ba7e368117c54308255572861fa4d14e75861360a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52d75ac780843f651052880108a662081c92ab55ded13cf8d69f241b979b6ce69b05552aca222ec63c01e9b0426ee7f81902196e13746d8cae89ad3a0280f0ff
|
7
|
+
data.tar.gz: 4854bef7827dbfdaa17ca41d255bcd2b297c42acafb45cca0ef21d399f24d6b704e69b62b1745284bfbb9f4ecd966036a906e339033cb07aefe1ca7766e8974b
|
@@ -15,18 +15,18 @@ class AuthorizeApiRequest
|
|
15
15
|
|
16
16
|
def api_user
|
17
17
|
Rails.logger.debug "AuthorizeApiRequest: api_user -> #{decoded_auth_token}"
|
18
|
-
@api_user ||= User.find(decoded_auth_token[:user_id])
|
19
|
-
|
18
|
+
@api_user ||= (decoded_auth_token.blank? ? User.find(decoded_auth_token[:user_id]) : nil)
|
19
|
+
unless @api_user.blank
|
20
20
|
return @api_user
|
21
21
|
else
|
22
|
-
errors.add(:token, "Invalid token")
|
22
|
+
errors.add(:token, "Invalid or Expired token")
|
23
23
|
return nil
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def decoded_auth_token
|
28
28
|
Rails.logger.debug "AuthorizeApiRequest: decoded_auth_token -> http_auth_header -> #{http_auth_header}"
|
29
|
-
@decoded_auth_token ||= JsonWebToken.decode(http_auth_header)
|
29
|
+
@decoded_auth_token ||= (JsonWebToken.decode(http_auth_header) rescue nil)
|
30
30
|
@decoded_auth_token
|
31
31
|
end
|
32
32
|
|