lib/json/jwt.rb in json-jwt-0.4.0 vs lib/json/jwt.rb in json-jwt-0.4.1
- old
+ new
@@ -12,12 +12,12 @@
class VerificationFailed < Exception; end
class UnexpectedAlgorithm < VerificationFailed; end
def initialize(claims)
@header = {
- typ: :JWT,
- alg: :none
+ :typ => :JWT,
+ :alg => :none
}
[:exp, :nbf, :iat].each do |key|
claims[key] = claims[key].to_i if claims[key]
end
replace claims
@@ -53,10 +53,10 @@
when 2 # JWT / JWS
header, claims, signature = jwt_string.split('.', 3).collect do |segment|
UrlSafeBase64.decode64 segment.to_s
end
header, claims = [header, claims].collect do |json|
- JSON.parse json, symbolize_names: true, symbolize_keys: true
+ JSON.parse json, :symbolize_names => true, :symbolize_keys => true
end
signature_base_string = jwt_string.split('.')[0, 2].join('.')
jwt = new claims
jwt.header = header
jwt.signature = signature