jwt 2.1.0 → 2.5.0
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 +5 -5
- data/.codeclimate.yml +6 -18
- data/.github/workflows/coverage.yml +27 -0
- data/.github/workflows/test.yml +67 -0
- data/.gitignore +3 -1
- data/.reek.yml +21 -39
- data/.rspec +1 -0
- data/.rubocop.yml +21 -52
- data/{.ebert.yml → .sourcelevel.yml} +3 -4
- data/AUTHORS +119 -0
- data/Appraisals +13 -0
- data/CHANGELOG.md +329 -19
- data/CODE_OF_CONDUCT.md +84 -0
- data/CONTRIBUTING.md +99 -0
- data/Gemfile +4 -0
- data/README.md +261 -100
- data/Rakefile +6 -1
- data/lib/jwt/algos/ecdsa.rb +37 -8
- data/lib/jwt/algos/eddsa.rb +16 -4
- data/lib/jwt/algos/hmac.rb +3 -0
- data/lib/jwt/algos/none.rb +17 -0
- data/lib/jwt/algos/ps.rb +43 -0
- data/lib/jwt/algos/rsa.rb +4 -1
- data/lib/jwt/algos/unsupported.rb +7 -4
- data/lib/jwt/algos.rb +44 -0
- data/lib/jwt/base64.rb +19 -0
- data/lib/jwt/claims_validator.rb +37 -0
- data/lib/jwt/configuration/container.rb +21 -0
- data/lib/jwt/configuration/decode_configuration.rb +46 -0
- data/lib/jwt/configuration/jwk_configuration.rb +27 -0
- data/lib/jwt/configuration.rb +15 -0
- data/lib/jwt/decode.rb +120 -24
- data/lib/jwt/encode.rb +43 -25
- data/lib/jwt/error.rb +6 -0
- data/lib/jwt/json.rb +18 -0
- data/lib/jwt/jwk/ec.rb +199 -0
- data/lib/jwt/jwk/hmac.rb +67 -0
- data/lib/jwt/jwk/key_base.rb +35 -0
- data/lib/jwt/jwk/key_finder.rb +62 -0
- data/lib/jwt/jwk/kid_as_key_digest.rb +15 -0
- data/lib/jwt/jwk/rsa.rb +138 -0
- data/lib/jwt/jwk/thumbprint.rb +26 -0
- data/lib/jwt/jwk.rb +52 -0
- data/lib/jwt/security_utils.rb +8 -0
- data/lib/jwt/signature.rb +7 -22
- data/lib/jwt/verify.rb +19 -8
- data/lib/jwt/version.rb +6 -2
- data/lib/jwt/x5c_key_finder.rb +55 -0
- data/lib/jwt.rb +12 -44
- data/ruby-jwt.gemspec +13 -9
- metadata +44 -97
- data/.travis.yml +0 -14
- data/Manifest +0 -8
- data/lib/jwt/default_options.rb +0 -15
- data/spec/fixtures/certs/ec256-private.pem +0 -8
- data/spec/fixtures/certs/ec256-public.pem +0 -4
- data/spec/fixtures/certs/ec256-wrong-private.pem +0 -8
- data/spec/fixtures/certs/ec256-wrong-public.pem +0 -4
- data/spec/fixtures/certs/ec384-private.pem +0 -9
- data/spec/fixtures/certs/ec384-public.pem +0 -5
- data/spec/fixtures/certs/ec384-wrong-private.pem +0 -9
- data/spec/fixtures/certs/ec384-wrong-public.pem +0 -5
- data/spec/fixtures/certs/ec512-private.pem +0 -10
- data/spec/fixtures/certs/ec512-public.pem +0 -6
- data/spec/fixtures/certs/ec512-wrong-private.pem +0 -10
- data/spec/fixtures/certs/ec512-wrong-public.pem +0 -6
- data/spec/fixtures/certs/rsa-1024-private.pem +0 -15
- data/spec/fixtures/certs/rsa-1024-public.pem +0 -6
- data/spec/fixtures/certs/rsa-2048-private.pem +0 -27
- data/spec/fixtures/certs/rsa-2048-public.pem +0 -9
- data/spec/fixtures/certs/rsa-2048-wrong-private.pem +0 -27
- data/spec/fixtures/certs/rsa-2048-wrong-public.pem +0 -9
- data/spec/fixtures/certs/rsa-4096-private.pem +0 -51
- data/spec/fixtures/certs/rsa-4096-public.pem +0 -14
- data/spec/integration/readme_examples_spec.rb +0 -202
- data/spec/jwt/verify_spec.rb +0 -232
- data/spec/jwt_spec.rb +0 -315
- data/spec/spec_helper.rb +0 -28
data/lib/jwt/jwk.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'jwk/key_finder'
|
4
|
+
|
5
|
+
module JWT
|
6
|
+
module JWK
|
7
|
+
class << self
|
8
|
+
def import(jwk_data)
|
9
|
+
jwk_kty = jwk_data[:kty] || jwk_data['kty']
|
10
|
+
raise JWT::JWKError, 'Key type (kty) not provided' unless jwk_kty
|
11
|
+
|
12
|
+
mappings.fetch(jwk_kty.to_s) do |kty|
|
13
|
+
raise JWT::JWKError, "Key type #{kty} not supported"
|
14
|
+
end.import(jwk_data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_from(keypair, kid = nil)
|
18
|
+
mappings.fetch(keypair.class) do |klass|
|
19
|
+
raise JWT::JWKError, "Cannot create JWK from a #{klass.name}"
|
20
|
+
end.new(keypair, kid)
|
21
|
+
end
|
22
|
+
|
23
|
+
def classes
|
24
|
+
@mappings = nil # reset the cached mappings
|
25
|
+
@classes ||= []
|
26
|
+
end
|
27
|
+
|
28
|
+
alias new create_from
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def mappings
|
33
|
+
@mappings ||= generate_mappings
|
34
|
+
end
|
35
|
+
|
36
|
+
def generate_mappings
|
37
|
+
classes.each_with_object({}) do |klass, hash|
|
38
|
+
next unless klass.const_defined?('KTYS')
|
39
|
+
|
40
|
+
Array(klass::KTYS).each do |kty|
|
41
|
+
hash[kty] = klass
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
require_relative 'jwk/key_base'
|
50
|
+
require_relative 'jwk/ec'
|
51
|
+
require_relative 'jwk/rsa'
|
52
|
+
require_relative 'jwk/hmac'
|
data/lib/jwt/security_utils.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module JWT
|
2
4
|
# Collection of security methods
|
3
5
|
#
|
@@ -20,6 +22,12 @@ module JWT
|
|
20
22
|
public_key.verify(OpenSSL::Digest.new(algorithm.sub('RS', 'sha')), signature, signing_input)
|
21
23
|
end
|
22
24
|
|
25
|
+
def verify_ps(algorithm, public_key, signing_input, signature)
|
26
|
+
formatted_algorithm = algorithm.sub('PS', 'sha')
|
27
|
+
|
28
|
+
public_key.verify_pss(formatted_algorithm, signature, signing_input, salt_length: :auto, mgf1_hash: formatted_algorithm)
|
29
|
+
end
|
30
|
+
|
23
31
|
def asn1_to_raw(signature, public_key)
|
24
32
|
byte_size = (public_key.group.degree + 7) / 8
|
25
33
|
OpenSSL::ASN1.decode(signature).value.map { |value| value.value.to_s(2).rjust(byte_size, "\x00") }.join
|
data/lib/jwt/signature.rb
CHANGED
@@ -2,11 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'jwt/security_utils'
|
4
4
|
require 'openssl'
|
5
|
-
require 'jwt/algos
|
6
|
-
require 'jwt/algos/eddsa'
|
7
|
-
require 'jwt/algos/ecdsa'
|
8
|
-
require 'jwt/algos/rsa'
|
9
|
-
require 'jwt/algos/unsupported'
|
5
|
+
require 'jwt/algos'
|
10
6
|
begin
|
11
7
|
require 'rbnacl'
|
12
8
|
rescue LoadError
|
@@ -17,30 +13,19 @@ end
|
|
17
13
|
module JWT
|
18
14
|
# Signature logic for JWT
|
19
15
|
module Signature
|
20
|
-
|
21
|
-
|
22
|
-
Algos::Hmac,
|
23
|
-
Algos::Ecdsa,
|
24
|
-
Algos::Rsa,
|
25
|
-
Algos::Eddsa,
|
26
|
-
Algos::Unsupported
|
27
|
-
].freeze
|
16
|
+
module_function
|
17
|
+
|
28
18
|
ToSign = Struct.new(:algorithm, :msg, :key)
|
29
19
|
ToVerify = Struct.new(:algorithm, :public_key, :signing_input, :signature)
|
30
20
|
|
31
21
|
def sign(algorithm, msg, key)
|
32
|
-
algo =
|
33
|
-
|
34
|
-
end
|
35
|
-
algo.sign ToSign.new(algorithm, msg, key)
|
22
|
+
algo, code = Algos.find(algorithm)
|
23
|
+
algo.sign ToSign.new(code, msg, key)
|
36
24
|
end
|
37
25
|
|
38
26
|
def verify(algorithm, key, signing_input, signature)
|
39
|
-
algo =
|
40
|
-
|
41
|
-
end
|
42
|
-
verified = algo.verify(ToVerify.new(algorithm, key, signing_input, signature))
|
43
|
-
raise(JWT::VerificationError, 'Signature verification raised') unless verified
|
27
|
+
algo, code = Algos.find(algorithm)
|
28
|
+
algo.verify(ToVerify.new(code, key, signing_input, signature))
|
44
29
|
rescue OpenSSL::PKey::PKeyError
|
45
30
|
raise JWT::VerificationError, 'Signature verification raised'
|
46
31
|
ensure
|
data/lib/jwt/verify.rb
CHANGED
@@ -10,7 +10,7 @@ module JWT
|
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
class << self
|
13
|
-
%w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub].each do |method_name|
|
13
|
+
%w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub verify_required_claims].each do |method_name|
|
14
14
|
define_method method_name do |payload, options|
|
15
15
|
new(payload, options).send(method_name)
|
16
16
|
end
|
@@ -19,6 +19,7 @@ module JWT
|
|
19
19
|
def verify_claims(payload, options)
|
20
20
|
options.each do |key, val|
|
21
21
|
next unless key.to_s =~ /verify/
|
22
|
+
|
22
23
|
Verify.send(key, payload, options) if val
|
23
24
|
end
|
24
25
|
end
|
@@ -45,7 +46,7 @@ module JWT
|
|
45
46
|
return unless @payload.include?('iat')
|
46
47
|
|
47
48
|
iat = @payload['iat']
|
48
|
-
raise(JWT::InvalidIatError, 'Invalid iat') if !iat.is_a?(Numeric) || iat.to_f >
|
49
|
+
raise(JWT::InvalidIatError, 'Invalid iat') if !iat.is_a?(Numeric) || iat.to_f > Time.now.to_f
|
49
50
|
end
|
50
51
|
|
51
52
|
def verify_iss
|
@@ -53,9 +54,14 @@ module JWT
|
|
53
54
|
|
54
55
|
iss = @payload['iss']
|
55
56
|
|
56
|
-
|
57
|
+
options_iss = Array(options_iss).map { |item| item.is_a?(Symbol) ? item.to_s : item }
|
57
58
|
|
58
|
-
|
59
|
+
case iss
|
60
|
+
when *options_iss
|
61
|
+
nil
|
62
|
+
else
|
63
|
+
raise(JWT::InvalidIssuerError, "Invalid issuer. Expected #{options_iss}, received #{iss || '<none>'}")
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
67
|
def verify_jti
|
@@ -77,10 +83,19 @@ module JWT
|
|
77
83
|
|
78
84
|
def verify_sub
|
79
85
|
return unless (options_sub = @options[:sub])
|
86
|
+
|
80
87
|
sub = @payload['sub']
|
81
88
|
raise(JWT::InvalidSubError, "Invalid subject. Expected #{options_sub}, received #{sub || '<none>'}") unless sub.to_s == options_sub.to_s
|
82
89
|
end
|
83
90
|
|
91
|
+
def verify_required_claims
|
92
|
+
return unless (options_required_claims = @options[:required_claims])
|
93
|
+
|
94
|
+
options_required_claims.each do |required_claim|
|
95
|
+
raise(JWT::MissingRequiredClaim, "Missing required claim #{required_claim}") unless @payload.include?(required_claim)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
84
99
|
private
|
85
100
|
|
86
101
|
def global_leeway
|
@@ -91,10 +106,6 @@ module JWT
|
|
91
106
|
@options[:exp_leeway] || global_leeway
|
92
107
|
end
|
93
108
|
|
94
|
-
def iat_leeway
|
95
|
-
@options[:iat_leeway] || global_leeway
|
96
|
-
end
|
97
|
-
|
98
109
|
def nbf_leeway
|
99
110
|
@options[:nbf_leeway] || global_leeway
|
100
111
|
end
|
data/lib/jwt/version.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
# Moments version builder module
|
@@ -12,7 +11,7 @@ module JWT
|
|
12
11
|
# major version
|
13
12
|
MAJOR = 2
|
14
13
|
# minor version
|
15
|
-
MINOR =
|
14
|
+
MINOR = 5
|
16
15
|
# tiny version
|
17
16
|
TINY = 0
|
18
17
|
# alpha, beta, etc. tag
|
@@ -21,4 +20,9 @@ module JWT
|
|
21
20
|
# Build version string
|
22
21
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
23
22
|
end
|
23
|
+
|
24
|
+
def self.openssl_3?
|
25
|
+
return false if OpenSSL::OPENSSL_VERSION.include?('LibreSSL')
|
26
|
+
return true if OpenSSL::OPENSSL_VERSION_NUMBER >= 3 * 0x10000000
|
27
|
+
end
|
24
28
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
require 'jwt/error'
|
5
|
+
|
6
|
+
module JWT
|
7
|
+
# If the x5c header certificate chain can be validated by trusted root
|
8
|
+
# certificates, and none of the certificates are revoked, returns the public
|
9
|
+
# key from the first certificate.
|
10
|
+
# See https://tools.ietf.org/html/rfc7515#section-4.1.6
|
11
|
+
class X5cKeyFinder
|
12
|
+
def initialize(root_certificates, crls = nil)
|
13
|
+
raise(ArgumentError, 'Root certificates must be specified') unless root_certificates
|
14
|
+
|
15
|
+
@store = build_store(root_certificates, crls)
|
16
|
+
end
|
17
|
+
|
18
|
+
def from(x5c_header_or_certificates)
|
19
|
+
signing_certificate, *certificate_chain = parse_certificates(x5c_header_or_certificates)
|
20
|
+
store_context = OpenSSL::X509::StoreContext.new(@store, signing_certificate, certificate_chain)
|
21
|
+
|
22
|
+
if store_context.verify
|
23
|
+
signing_certificate.public_key
|
24
|
+
else
|
25
|
+
error = "Certificate verification failed: #{store_context.error_string}."
|
26
|
+
if (current_cert = store_context.current_cert)
|
27
|
+
error = "#{error} Certificate subject: #{current_cert.subject}."
|
28
|
+
end
|
29
|
+
|
30
|
+
raise(JWT::VerificationError, error)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def build_store(root_certificates, crls)
|
37
|
+
store = OpenSSL::X509::Store.new
|
38
|
+
store.purpose = OpenSSL::X509::PURPOSE_ANY
|
39
|
+
store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK | OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
|
40
|
+
root_certificates.each { |certificate| store.add_cert(certificate) }
|
41
|
+
crls&.each { |crl| store.add_crl(crl) }
|
42
|
+
store
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_certificates(x5c_header_or_certificates)
|
46
|
+
if x5c_header_or_certificates.all? { |obj| obj.is_a?(OpenSSL::X509::Certificate) }
|
47
|
+
x5c_header_or_certificates
|
48
|
+
else
|
49
|
+
x5c_header_or_certificates.map do |encoded|
|
50
|
+
OpenSSL::X509::Certificate.new(::JWT::Base64.url_decode(encoded))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/jwt.rb
CHANGED
@@ -1,63 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'jwt/version'
|
4
|
+
require 'jwt/base64'
|
5
|
+
require 'jwt/json'
|
4
6
|
require 'jwt/decode'
|
5
|
-
require 'jwt/
|
7
|
+
require 'jwt/configuration'
|
6
8
|
require 'jwt/encode'
|
7
9
|
require 'jwt/error'
|
8
|
-
require 'jwt/
|
9
|
-
require 'jwt/verify'
|
10
|
+
require 'jwt/jwk'
|
10
11
|
|
11
12
|
# JSON Web Token implementation
|
12
13
|
#
|
13
14
|
# Should be up to date with the latest spec:
|
14
15
|
# https://tools.ietf.org/html/rfc7519
|
15
16
|
module JWT
|
16
|
-
|
17
|
+
extend ::JWT::Configuration
|
17
18
|
|
18
19
|
module_function
|
19
20
|
|
20
21
|
def encode(payload, key, algorithm = 'HS256', header_fields = {})
|
21
|
-
|
22
|
-
|
22
|
+
Encode.new(payload: payload,
|
23
|
+
key: key,
|
24
|
+
algorithm: algorithm,
|
25
|
+
headers: header_fields).segments
|
23
26
|
end
|
24
27
|
|
25
|
-
def decode(jwt, key = nil, verify = true,
|
26
|
-
|
27
|
-
|
28
|
-
merged_options = DEFAULT_OPTIONS.merge(custom_options)
|
29
|
-
|
30
|
-
decoder = Decode.new jwt, verify
|
31
|
-
header, payload, signature, signing_input = decoder.decode_segments
|
32
|
-
decode_verify_signature(key, header, payload, signature, signing_input, merged_options, &keyfinder) if verify
|
33
|
-
|
34
|
-
Verify.verify_claims(payload, merged_options) if verify
|
35
|
-
|
36
|
-
raise(JWT::DecodeError, 'Not enough or too many segments') unless header && payload
|
37
|
-
|
38
|
-
[payload, header]
|
39
|
-
end
|
40
|
-
|
41
|
-
def decode_verify_signature(key, header, payload, signature, signing_input, options, &keyfinder)
|
42
|
-
algo, key = signature_algorithm_and_key(header, payload, key, &keyfinder)
|
43
|
-
|
44
|
-
raise(JWT::IncorrectAlgorithm, 'An algorithm must be specified') if allowed_algorithms(options).empty?
|
45
|
-
raise(JWT::IncorrectAlgorithm, 'Expected a different algorithm') unless allowed_algorithms(options).include?(algo)
|
46
|
-
|
47
|
-
Signature.verify(algo, key, signing_input, signature)
|
48
|
-
end
|
49
|
-
|
50
|
-
def signature_algorithm_and_key(header, payload, key, &keyfinder)
|
51
|
-
key = (keyfinder.arity == 2 ? yield(header, payload) : yield(header)) if keyfinder
|
52
|
-
raise JWT::DecodeError, 'No verification key available' unless key
|
53
|
-
[header['alg'], key]
|
54
|
-
end
|
55
|
-
|
56
|
-
def allowed_algorithms(options)
|
57
|
-
if options.key?(:algorithm)
|
58
|
-
[options[:algorithm]]
|
59
|
-
else
|
60
|
-
options[:algorithms] || []
|
61
|
-
end
|
28
|
+
def decode(jwt, key = nil, verify = true, options = {}, &keyfinder) # rubocop:disable Style/OptionalBooleanParameter
|
29
|
+
Decode.new(jwt, key, verify, configuration.decode.to_h.merge(options), &keyfinder).decode_segments
|
62
30
|
end
|
63
31
|
end
|
data/ruby-jwt.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'jwt/version'
|
4
6
|
|
@@ -11,21 +13,23 @@ Gem::Specification.new do |spec|
|
|
11
13
|
spec.email = 'timrudat@gmail.com'
|
12
14
|
spec.summary = 'JSON Web Token implementation in Ruby'
|
13
15
|
spec.description = 'A pure ruby implementation of the RFC 7519 OAuth JSON Web Token (JWT) standard.'
|
14
|
-
spec.homepage = '
|
16
|
+
spec.homepage = 'https://github.com/jwt/ruby-jwt'
|
15
17
|
spec.license = 'MIT'
|
16
|
-
spec.required_ruby_version = '>= 2.
|
18
|
+
spec.required_ruby_version = '>= 2.5'
|
19
|
+
spec.metadata = {
|
20
|
+
'bug_tracker_uri' => 'https://github.com/jwt/ruby-jwt/issues',
|
21
|
+
'changelog_uri' => "https://github.com/jwt/ruby-jwt/blob/v#{JWT.gem_version}/CHANGELOG.md"
|
22
|
+
}
|
17
23
|
|
18
|
-
spec.files = `git ls-files -z`.split("\x0")
|
19
|
-
spec.executables =
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|gemfiles|coverage|bin)/}) }
|
25
|
+
spec.executables = []
|
20
26
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
27
|
spec.require_paths = %w[lib]
|
22
28
|
|
29
|
+
spec.add_development_dependency 'appraisal'
|
23
30
|
spec.add_development_dependency 'bundler'
|
24
31
|
spec.add_development_dependency 'rake'
|
32
|
+
spec.add_development_dependency 'reek'
|
25
33
|
spec.add_development_dependency 'rspec'
|
26
34
|
spec.add_development_dependency 'simplecov'
|
27
|
-
spec.add_development_dependency 'simplecov-json'
|
28
|
-
spec.add_development_dependency 'codeclimate-test-reporter'
|
29
|
-
spec.add_development_dependency 'codacy-coverage'
|
30
|
-
spec.add_development_dependency 'rbnacl'
|
31
35
|
end
|
metadata
CHANGED
@@ -1,45 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Rudat
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
14
|
+
name: appraisal
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - ">="
|
@@ -53,7 +25,7 @@ dependencies:
|
|
53
25
|
- !ruby/object:Gem::Version
|
54
26
|
version: '0'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
28
|
+
name: bundler
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - ">="
|
@@ -67,7 +39,7 @@ dependencies:
|
|
67
39
|
- !ruby/object:Gem::Version
|
68
40
|
version: '0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
42
|
+
name: rake
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
72
44
|
requirements:
|
73
45
|
- - ">="
|
@@ -81,7 +53,7 @@ dependencies:
|
|
81
53
|
- !ruby/object:Gem::Version
|
82
54
|
version: '0'
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
56
|
+
name: reek
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
59
|
- - ">="
|
@@ -95,7 +67,7 @@ dependencies:
|
|
95
67
|
- !ruby/object:Gem::Version
|
96
68
|
version: '0'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
70
|
+
name: rspec
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
73
|
- - ">="
|
@@ -109,7 +81,7 @@ dependencies:
|
|
109
81
|
- !ruby/object:Gem::Version
|
110
82
|
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
84
|
+
name: simplecov
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
87
|
- - ">="
|
@@ -130,62 +102,62 @@ extensions: []
|
|
130
102
|
extra_rdoc_files: []
|
131
103
|
files:
|
132
104
|
- ".codeclimate.yml"
|
133
|
-
- ".
|
105
|
+
- ".github/workflows/coverage.yml"
|
106
|
+
- ".github/workflows/test.yml"
|
134
107
|
- ".gitignore"
|
135
108
|
- ".reek.yml"
|
136
109
|
- ".rspec"
|
137
110
|
- ".rubocop.yml"
|
138
|
-
- ".
|
111
|
+
- ".sourcelevel.yml"
|
112
|
+
- AUTHORS
|
113
|
+
- Appraisals
|
139
114
|
- CHANGELOG.md
|
115
|
+
- CODE_OF_CONDUCT.md
|
116
|
+
- CONTRIBUTING.md
|
140
117
|
- Gemfile
|
141
118
|
- LICENSE
|
142
|
-
- Manifest
|
143
119
|
- README.md
|
144
120
|
- Rakefile
|
145
121
|
- lib/jwt.rb
|
122
|
+
- lib/jwt/algos.rb
|
146
123
|
- lib/jwt/algos/ecdsa.rb
|
147
124
|
- lib/jwt/algos/eddsa.rb
|
148
125
|
- lib/jwt/algos/hmac.rb
|
126
|
+
- lib/jwt/algos/none.rb
|
127
|
+
- lib/jwt/algos/ps.rb
|
149
128
|
- lib/jwt/algos/rsa.rb
|
150
129
|
- lib/jwt/algos/unsupported.rb
|
130
|
+
- lib/jwt/base64.rb
|
131
|
+
- lib/jwt/claims_validator.rb
|
132
|
+
- lib/jwt/configuration.rb
|
133
|
+
- lib/jwt/configuration/container.rb
|
134
|
+
- lib/jwt/configuration/decode_configuration.rb
|
135
|
+
- lib/jwt/configuration/jwk_configuration.rb
|
151
136
|
- lib/jwt/decode.rb
|
152
|
-
- lib/jwt/default_options.rb
|
153
137
|
- lib/jwt/encode.rb
|
154
138
|
- lib/jwt/error.rb
|
139
|
+
- lib/jwt/json.rb
|
140
|
+
- lib/jwt/jwk.rb
|
141
|
+
- lib/jwt/jwk/ec.rb
|
142
|
+
- lib/jwt/jwk/hmac.rb
|
143
|
+
- lib/jwt/jwk/key_base.rb
|
144
|
+
- lib/jwt/jwk/key_finder.rb
|
145
|
+
- lib/jwt/jwk/kid_as_key_digest.rb
|
146
|
+
- lib/jwt/jwk/rsa.rb
|
147
|
+
- lib/jwt/jwk/thumbprint.rb
|
155
148
|
- lib/jwt/security_utils.rb
|
156
149
|
- lib/jwt/signature.rb
|
157
150
|
- lib/jwt/verify.rb
|
158
151
|
- lib/jwt/version.rb
|
152
|
+
- lib/jwt/x5c_key_finder.rb
|
159
153
|
- ruby-jwt.gemspec
|
160
|
-
|
161
|
-
- spec/fixtures/certs/ec256-public.pem
|
162
|
-
- spec/fixtures/certs/ec256-wrong-private.pem
|
163
|
-
- spec/fixtures/certs/ec256-wrong-public.pem
|
164
|
-
- spec/fixtures/certs/ec384-private.pem
|
165
|
-
- spec/fixtures/certs/ec384-public.pem
|
166
|
-
- spec/fixtures/certs/ec384-wrong-private.pem
|
167
|
-
- spec/fixtures/certs/ec384-wrong-public.pem
|
168
|
-
- spec/fixtures/certs/ec512-private.pem
|
169
|
-
- spec/fixtures/certs/ec512-public.pem
|
170
|
-
- spec/fixtures/certs/ec512-wrong-private.pem
|
171
|
-
- spec/fixtures/certs/ec512-wrong-public.pem
|
172
|
-
- spec/fixtures/certs/rsa-1024-private.pem
|
173
|
-
- spec/fixtures/certs/rsa-1024-public.pem
|
174
|
-
- spec/fixtures/certs/rsa-2048-private.pem
|
175
|
-
- spec/fixtures/certs/rsa-2048-public.pem
|
176
|
-
- spec/fixtures/certs/rsa-2048-wrong-private.pem
|
177
|
-
- spec/fixtures/certs/rsa-2048-wrong-public.pem
|
178
|
-
- spec/fixtures/certs/rsa-4096-private.pem
|
179
|
-
- spec/fixtures/certs/rsa-4096-public.pem
|
180
|
-
- spec/integration/readme_examples_spec.rb
|
181
|
-
- spec/jwt/verify_spec.rb
|
182
|
-
- spec/jwt_spec.rb
|
183
|
-
- spec/spec_helper.rb
|
184
|
-
homepage: http://github.com/jwt/ruby-jwt
|
154
|
+
homepage: https://github.com/jwt/ruby-jwt
|
185
155
|
licenses:
|
186
156
|
- MIT
|
187
|
-
metadata:
|
188
|
-
|
157
|
+
metadata:
|
158
|
+
bug_tracker_uri: https://github.com/jwt/ruby-jwt/issues
|
159
|
+
changelog_uri: https://github.com/jwt/ruby-jwt/blob/v2.5.0/CHANGELOG.md
|
160
|
+
post_install_message:
|
189
161
|
rdoc_options: []
|
190
162
|
require_paths:
|
191
163
|
- lib
|
@@ -193,40 +165,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
165
|
requirements:
|
194
166
|
- - ">="
|
195
167
|
- !ruby/object:Gem::Version
|
196
|
-
version: '2.
|
168
|
+
version: '2.5'
|
197
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
170
|
requirements:
|
199
171
|
- - ">="
|
200
172
|
- !ruby/object:Gem::Version
|
201
173
|
version: '0'
|
202
174
|
requirements: []
|
203
|
-
|
204
|
-
|
205
|
-
signing_key:
|
175
|
+
rubygems_version: 3.3.21
|
176
|
+
signing_key:
|
206
177
|
specification_version: 4
|
207
178
|
summary: JSON Web Token implementation in Ruby
|
208
|
-
test_files:
|
209
|
-
- spec/fixtures/certs/ec256-private.pem
|
210
|
-
- spec/fixtures/certs/ec256-public.pem
|
211
|
-
- spec/fixtures/certs/ec256-wrong-private.pem
|
212
|
-
- spec/fixtures/certs/ec256-wrong-public.pem
|
213
|
-
- spec/fixtures/certs/ec384-private.pem
|
214
|
-
- spec/fixtures/certs/ec384-public.pem
|
215
|
-
- spec/fixtures/certs/ec384-wrong-private.pem
|
216
|
-
- spec/fixtures/certs/ec384-wrong-public.pem
|
217
|
-
- spec/fixtures/certs/ec512-private.pem
|
218
|
-
- spec/fixtures/certs/ec512-public.pem
|
219
|
-
- spec/fixtures/certs/ec512-wrong-private.pem
|
220
|
-
- spec/fixtures/certs/ec512-wrong-public.pem
|
221
|
-
- spec/fixtures/certs/rsa-1024-private.pem
|
222
|
-
- spec/fixtures/certs/rsa-1024-public.pem
|
223
|
-
- spec/fixtures/certs/rsa-2048-private.pem
|
224
|
-
- spec/fixtures/certs/rsa-2048-public.pem
|
225
|
-
- spec/fixtures/certs/rsa-2048-wrong-private.pem
|
226
|
-
- spec/fixtures/certs/rsa-2048-wrong-public.pem
|
227
|
-
- spec/fixtures/certs/rsa-4096-private.pem
|
228
|
-
- spec/fixtures/certs/rsa-4096-public.pem
|
229
|
-
- spec/integration/readme_examples_spec.rb
|
230
|
-
- spec/jwt/verify_spec.rb
|
231
|
-
- spec/jwt_spec.rb
|
232
|
-
- spec/spec_helper.rb
|
179
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
sudo: required
|
2
|
-
cache: bundler
|
3
|
-
dist: trusty
|
4
|
-
language: ruby
|
5
|
-
rvm:
|
6
|
-
- 2.2.0
|
7
|
-
- 2.3.0
|
8
|
-
- 2.4.0
|
9
|
-
script: "bundle exec rspec && bundle exec codeclimate-test-reporter"
|
10
|
-
before_install:
|
11
|
-
- sudo add-apt-repository ppa:chris-lea/libsodium -y
|
12
|
-
- sudo apt-get update -q
|
13
|
-
- sudo apt-get install libsodium-dev -y
|
14
|
-
- gem install bundler
|
data/Manifest
DELETED
data/lib/jwt/default_options.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module JWT
|
2
|
-
module DefaultOptions
|
3
|
-
DEFAULT_OPTIONS = {
|
4
|
-
verify_expiration: true,
|
5
|
-
verify_not_before: true,
|
6
|
-
verify_iss: false,
|
7
|
-
verify_iat: false,
|
8
|
-
verify_jti: false,
|
9
|
-
verify_aud: false,
|
10
|
-
verify_sub: false,
|
11
|
-
leeway: 0,
|
12
|
-
algorithms: ['HS256']
|
13
|
-
}.freeze
|
14
|
-
end
|
15
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
-----BEGIN EC PARAMETERS-----
|
2
|
-
BggqhkjOPQMBBw==
|
3
|
-
-----END EC PARAMETERS-----
|
4
|
-
-----BEGIN EC PRIVATE KEY-----
|
5
|
-
MHcCAQEEIJmVse5uPfj6B4TcXrUAvf9/8pJh+KrKKYLNcmOnp/vPoAoGCCqGSM49
|
6
|
-
AwEHoUQDQgAEAr+WbDE5VtIDGhtYMxvEc6cMsDBc/DX1wuhIMu8dQzOLSt0tpqK9
|
7
|
-
MVfXbVfrKdayVFgoWzs8MilcYq0QIhKx/w==
|
8
|
-
-----END EC PRIVATE KEY-----
|