jwtear 1.0.7 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jwtear/version.rb +1 -1
- data/plugins/parse.rb +21 -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: ec80cbd22ceeba8225079c072f491c14489d9621921257c57ff7663ee4626ae8
|
4
|
+
data.tar.gz: aca681e7e119897223b99ac347c6eeadf8c90525d16a80b46e76d871f4ce9d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59045d652e34c71a8cd451f723bf11e86faf506644c394d3012898a1836dbee7ee51896719499aa3e4191aca34e6d1383e3fb518a5758521527adb41d7a8312d
|
7
|
+
data.tar.gz: d1b6f5ca3bee6d04ad0e3623c88e54444f17357aececc0b2a5bb6ef3ee9bf8026df5288dbdeaea885afaad5bda186ebb7a9b7fb4cff2123cc776c4a13dff4447
|
data/lib/jwtear/version.rb
CHANGED
data/plugins/parse.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
1
3
|
module JWTear
|
2
4
|
module CLI
|
3
5
|
extend GLI::App
|
@@ -83,10 +85,28 @@ module JWTear
|
|
83
85
|
def print_jws_payload(payload)
|
84
86
|
print_h2 "Payload"
|
85
87
|
payload.each do |k, v|
|
86
|
-
|
88
|
+
if k == "iat" || k == "nbf"
|
89
|
+
print_h3 "#{k}" , "#{v}", "\tTIMESTAMP = #{Time.at(v)}".green
|
90
|
+
elsif k == "exp"
|
91
|
+
compare_time_with_now(k,v)
|
92
|
+
else
|
93
|
+
print_h3 "#{k}" , "#{v}"
|
94
|
+
end
|
87
95
|
end
|
88
96
|
end
|
89
97
|
|
98
|
+
def compare_time_with_now(k, timestamp)
|
99
|
+
if timestamp.nil?
|
100
|
+
return
|
101
|
+
end
|
102
|
+
readable_time = Time.at(timestamp)
|
103
|
+
if readable_time < Time.now
|
104
|
+
print_h3 "#{k}", "#{timestamp}", "\tTIMESTAMP = #{readable_time}\t(EXPIRED)".red
|
105
|
+
else
|
106
|
+
print_h3 "#{k}", "#{timestamp}", "\tTIMESTAMP = #{readable_time}".green
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
90
110
|
def print_jws_sig(signature)
|
91
111
|
print_h2 "Signature - B64 encoded"
|
92
112
|
puts Base64.urlsafe_encode64(@token.signature, padding: false)
|