x1-sat-support 0.0.4 → 0.0.5
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/x1-sat-support.rb +2 -2
- data/lib/x1_sat_support/client.rb +3 -3
- data/lib/x1_sat_support/railtie.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: 6d1eb97672e07ca9c1979f70869a3993565fc9b2
|
4
|
+
data.tar.gz: c7062ca6ef03e9e1a53757c4775c6a334ef43c15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d028feb36b808aa84cd5df2ee2dfa3b887dd7ebdfebb7f6390fe36d96c45471f475ce6485aabefd54052669a55f944f4309559139bf76a1d7a6db7a72af046a
|
7
|
+
data.tar.gz: 39eb5000a3ff43939093b64766f495c56ec3f8507292f11330da311cf0bae6f8b22968c654f551071fede7bf14fa5145abb55ea0c39a2804f859050957ee1bbc
|
data/lib/x1-sat-support.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.expand_path File.join(File.dirname(__FILE__), 'x1_sat_support
|
1
|
+
require File.expand_path File.join(File.dirname(__FILE__), 'x1_sat_support', 'client.rb')
|
2
2
|
|
3
3
|
module X1SatSupport
|
4
|
-
require 'x1_sat_support
|
4
|
+
require File.join('x1_sat_support', 'railtie') if defined?(Rails)
|
5
5
|
end
|
@@ -35,7 +35,7 @@ module X1SatSupport
|
|
35
35
|
key_name = kid + '.pub'
|
36
36
|
key = get_current_key
|
37
37
|
Dir.mkdir(@path_to_store_keys) unless File.exists?(@path_to_store_keys)
|
38
|
-
File.open(
|
38
|
+
File.open(File.join(@path_to_store_keys,key_name), 'w') {|f| f.write(key)}
|
39
39
|
check_keys
|
40
40
|
end
|
41
41
|
|
@@ -59,7 +59,7 @@ module X1SatSupport
|
|
59
59
|
#
|
60
60
|
def get_kid
|
61
61
|
encoded_token = JSON.parse(RestClient.get(@sat_token_url, @headers).body)["serviceAccessToken"]
|
62
|
-
token = JWT.decode
|
62
|
+
token = JWT.decode(encoded_token, nil, false, { verify_not_before: false })
|
63
63
|
token.last["kid"]
|
64
64
|
end
|
65
65
|
#
|
@@ -80,7 +80,7 @@ module X1SatSupport
|
|
80
80
|
# This method returns public key
|
81
81
|
#
|
82
82
|
def check_keys
|
83
|
-
files = Dir[@path_to_store_keys
|
83
|
+
files = Dir[File.join(@path_to_store_keys, "/*.pub")].sort_by {|file| File.ctime(file)}
|
84
84
|
files.each do |file|
|
85
85
|
File.delete(files.delete(file)) if (Time.now - File.ctime(file)) > @keys_expiration_time
|
86
86
|
end
|