Skip to content

Commit 9621d8c

Browse files
committed
Remove deprecated methods
1 parent beafbba commit 9621d8c

File tree

10 files changed

+0
-552
lines changed

10 files changed

+0
-552
lines changed

lib/jwt.rb

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
require 'jwt/encoded_token'
1414
require 'jwt/token'
1515

16-
require 'jwt/claims_validator'
17-
require 'jwt/verify'
18-
1916
# JSON Web Token implementation
2017
#
2118
# Should be up to date with the latest spec:

lib/jwt/claims.rb

-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ module Claims
3232
Error = Struct.new(:message, keyword_init: true)
3333

3434
class << self
35-
# @deprecated Use {verify_payload!} instead. Will be removed in the next major version of ruby-jwt.
36-
def verify!(payload, options)
37-
Deprecations.warning('The ::JWT::Claims.verify! method is deprecated will be removed in the next major version of ruby-jwt')
38-
DecodeVerifier.verify!(payload, options)
39-
end
40-
4135
# Checks if the claims in the JWT payload are valid.
4236
# @example
4337
#

lib/jwt/claims/numeric.rb

-32
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@ module Claims
55
# The Numeric class is responsible for validating numeric claims in a JWT token.
66
# The numeric claims are: exp, iat and nbf
77
class Numeric
8-
# The Compat class provides backward compatibility for numeric claim validation.
9-
# @api private
10-
class Compat
11-
def initialize(payload)
12-
@payload = payload
13-
end
14-
15-
def verify!
16-
JWT::Claims.verify_payload!(@payload, :numeric)
17-
end
18-
end
19-
208
# List of numeric claims that can be validated.
219
NUMERIC_CLAIMS = %i[
2210
exp
@@ -26,14 +14,6 @@ def verify!
2614

2715
private_constant(:NUMERIC_CLAIMS)
2816

29-
# @api private
30-
def self.new(*args)
31-
return super if args.empty?
32-
33-
Deprecations.warning('Calling ::JWT::Claims::Numeric.new with the payload will be removed in the next major version of ruby-jwt')
34-
Compat.new(*args)
35-
end
36-
3717
# Verifies the numeric claims in the JWT context.
3818
#
3919
# @param context [Object] the context containing the JWT payload.
@@ -43,18 +23,6 @@ def verify!(context:)
4323
validate_numeric_claims(context.payload)
4424
end
4525

46-
# Verifies the numeric claims in the JWT payload.
47-
#
48-
# @param payload [Hash] the JWT payload containing the claims.
49-
# @param _args [Hash] additional arguments (not used).
50-
# @raise [JWT::InvalidClaimError] if any numeric claim is invalid.
51-
# @return [nil]
52-
# @deprecated The ::JWT::Claims::Numeric.verify! method will be removed in the next major version of ruby-jwt
53-
def self.verify!(payload:, **_args)
54-
Deprecations.warning('The ::JWT::Claims::Numeric.verify! method will be removed in the next major version of ruby-jwt.')
55-
JWT::Claims.verify_payload!(payload, :numeric)
56-
end
57-
5826
private
5927

6028
def validate_numeric_claims(payload)

lib/jwt/claims_validator.rb

-18
This file was deleted.

lib/jwt/jwa.rb

-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ def resolve_and_sort(algorithms:, preferred_algorithm:)
4141
algs = Array(algorithms).map { |alg| JWA.resolve(alg) }
4242
algs.partition { |alg| alg.valid_alg?(preferred_algorithm) }.flatten
4343
end
44-
45-
# @deprecated The `::JWT::JWA.create` method is deprecated and will be removed in the next major version of ruby-jwt.
46-
def create(algorithm)
47-
Deprecations.warning('The ::JWT::JWA.create method is deprecated and will be removed in the next major version of ruby-jwt.')
48-
resolve(algorithm)
49-
end
5044
end
5145
end
5246
end

lib/jwt/verify.rb

-40
This file was deleted.

spec/jwt/claims/numeric_spec.rb

-19
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,4 @@
9191
it_should_behave_like 'a NumericDate claim', :nbf
9292
end
9393
end
94-
95-
context 'Legacy use' do
96-
let(:validator) { described_class.new(claims) }
97-
describe '#verify!' do
98-
subject { validator.verify! }
99-
100-
context 'exp claim' do
101-
it_should_behave_like 'a NumericDate claim', :exp
102-
end
103-
104-
context 'iat claim' do
105-
it_should_behave_like 'a NumericDate claim', :iat
106-
end
107-
108-
context 'nbf claim' do
109-
it_should_behave_like 'a NumericDate claim', :nbf
110-
end
111-
end
112-
end
11394
end

spec/jwt/claims_validator_spec.rb

-80
This file was deleted.

spec/jwt/jwa_spec.rb

-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
# frozen_string_literal: true
22

33
RSpec.describe JWT::JWA do
4-
describe '.create' do
5-
describe 'Backwards compatibility' do
6-
describe 'create, sign and verify' do
7-
it 'finds an algorithm with old api' do
8-
alg = described_class.create('HS256')
9-
signature = alg.sign(data: 'data', signing_key: 'key')
10-
expect(signature).to be_a(String)
11-
expect(alg.verify(data: 'data', signature: signature, verification_key: 'key')).to be(true)
12-
end
13-
end
14-
end
15-
end
164
describe '.resolve_and_sort' do
175
let(:subject) { described_class.resolve_and_sort(algorithms: algorithms, preferred_algorithm: preferred_algorithm).map(&:alg) }
186

0 commit comments

Comments
 (0)