horse_power 0.8.2 → 0.8.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/lib/generators/horse_power/user/templates/tokenhash.rb +26 -7
- data/lib/horse_power/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e5b8359c276a69382c43a467a1ee120f97dc1f
|
4
|
+
data.tar.gz: e7047dbdde2d4bbacfe43acf58b5a9247c2bb5a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e6e5f6920474876c9af613824bba5d75f235655762de48c81672f6f585923dd9a5c337ff2add1c54440d3c890c3085175d52f0a1800940d83df3dd3ad01700
|
7
|
+
data.tar.gz: c3c4fd4d3318b4c3f7f395e58f36c4439b888795f2ead55b967487080fd0597a7630be9c877dd2517abf4720370a54b7f4149b04fa9427e3fed4a482a9eea3dd
|
@@ -27,14 +27,33 @@ but the db token was not yet expired.
|
|
27
27
|
instance_hash["current_token"] = nil
|
28
28
|
instance_hash["auth_token"] = token["auth_token"]
|
29
29
|
return instance_hash
|
30
|
-
rescue ::JWT::
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
rescue ::JWT::ExpiredSignature
|
31
|
+
return handle_expired(auth_token_obj)
|
32
|
+
rescue ::JWT::DecodeError
|
33
|
+
return handle_abnormal(params,request)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def self.handle_expired(auth_token_obj)
|
40
|
+
# Token expired, destroy arcadex token
|
41
|
+
jwt = ::JWT.decode(auth_token_obj,::Rails.application.secrets.secret_key_base,true,{verify_expiration: false})
|
42
|
+
token = jwt[0]
|
43
|
+
db_token = ::Arcadex::Find.find_token_by_auth_token(token["auth_token"])
|
44
|
+
if !db_token.nil?
|
45
|
+
db_token.destroy
|
46
|
+
end
|
47
|
+
return nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.handle_abnormal(params,request)
|
51
|
+
# Try Arcadex token
|
52
|
+
instance_hash = ::Arcadex::Authentication.get_instance(params,request,::Settings.token_header)
|
53
|
+
if !instance_hash.nil?
|
54
|
+
instance_hash["auth_token"] = nil
|
37
55
|
end
|
56
|
+
return instance_hash
|
38
57
|
end
|
39
58
|
|
40
59
|
end
|
data/lib/horse_power/version.rb
CHANGED