jwt 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -5
- data/CONTRIBUTING.md +7 -7
- data/README.md +106 -41
- data/lib/jwt/algos/algo_wrapper.rb +30 -0
- data/lib/jwt/algos/ecdsa.rb +2 -4
- data/lib/jwt/algos/eddsa.rb +2 -4
- data/lib/jwt/algos/hmac.rb +54 -17
- data/lib/jwt/algos/hmac_rbnacl.rb +53 -0
- data/lib/jwt/algos/hmac_rbnacl_fixed.rb +52 -0
- data/lib/jwt/algos/none.rb +3 -1
- data/lib/jwt/algos/ps.rb +3 -5
- data/lib/jwt/algos/rsa.rb +3 -4
- data/lib/jwt/algos.rb +38 -15
- data/lib/jwt/decode.rb +45 -22
- data/lib/jwt/encode.rb +29 -19
- data/lib/jwt/jwk/ec.rb +136 -112
- data/lib/jwt/jwk/hmac.rb +53 -27
- data/lib/jwt/jwk/key_base.rb +31 -11
- data/lib/jwt/jwk/key_finder.rb +14 -34
- data/lib/jwt/jwk/rsa.rb +129 -76
- data/lib/jwt/jwk/set.rb +80 -0
- data/lib/jwt/jwk.rb +13 -11
- data/lib/jwt/security_utils.rb +0 -27
- data/lib/jwt/version.rb +17 -1
- data/ruby-jwt.gemspec +8 -4
- metadata +9 -30
- data/.codeclimate.yml +0 -8
- data/.github/workflows/coverage.yml +0 -27
- data/.github/workflows/test.yml +0 -67
- data/.gitignore +0 -13
- data/.reek.yml +0 -22
- data/.rspec +0 -2
- data/.rubocop.yml +0 -67
- data/.sourcelevel.yml +0 -17
- data/Appraisals +0 -13
- data/Gemfile +0 -7
- data/Rakefile +0 -16
- data/lib/jwt/signature.rb +0 -35
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Rudat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: reek
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,28 +87,20 @@ executables: []
|
|
101
87
|
extensions: []
|
102
88
|
extra_rdoc_files: []
|
103
89
|
files:
|
104
|
-
- ".codeclimate.yml"
|
105
|
-
- ".github/workflows/coverage.yml"
|
106
|
-
- ".github/workflows/test.yml"
|
107
|
-
- ".gitignore"
|
108
|
-
- ".reek.yml"
|
109
|
-
- ".rspec"
|
110
|
-
- ".rubocop.yml"
|
111
|
-
- ".sourcelevel.yml"
|
112
90
|
- AUTHORS
|
113
|
-
- Appraisals
|
114
91
|
- CHANGELOG.md
|
115
92
|
- CODE_OF_CONDUCT.md
|
116
93
|
- CONTRIBUTING.md
|
117
|
-
- Gemfile
|
118
94
|
- LICENSE
|
119
95
|
- README.md
|
120
|
-
- Rakefile
|
121
96
|
- lib/jwt.rb
|
122
97
|
- lib/jwt/algos.rb
|
98
|
+
- lib/jwt/algos/algo_wrapper.rb
|
123
99
|
- lib/jwt/algos/ecdsa.rb
|
124
100
|
- lib/jwt/algos/eddsa.rb
|
125
101
|
- lib/jwt/algos/hmac.rb
|
102
|
+
- lib/jwt/algos/hmac_rbnacl.rb
|
103
|
+
- lib/jwt/algos/hmac_rbnacl_fixed.rb
|
126
104
|
- lib/jwt/algos/none.rb
|
127
105
|
- lib/jwt/algos/ps.rb
|
128
106
|
- lib/jwt/algos/rsa.rb
|
@@ -144,9 +122,9 @@ files:
|
|
144
122
|
- lib/jwt/jwk/key_finder.rb
|
145
123
|
- lib/jwt/jwk/kid_as_key_digest.rb
|
146
124
|
- lib/jwt/jwk/rsa.rb
|
125
|
+
- lib/jwt/jwk/set.rb
|
147
126
|
- lib/jwt/jwk/thumbprint.rb
|
148
127
|
- lib/jwt/security_utils.rb
|
149
|
-
- lib/jwt/signature.rb
|
150
128
|
- lib/jwt/verify.rb
|
151
129
|
- lib/jwt/version.rb
|
152
130
|
- lib/jwt/x5c_key_finder.rb
|
@@ -156,7 +134,8 @@ licenses:
|
|
156
134
|
- MIT
|
157
135
|
metadata:
|
158
136
|
bug_tracker_uri: https://github.com/jwt/ruby-jwt/issues
|
159
|
-
changelog_uri: https://github.com/jwt/ruby-jwt/blob/v2.
|
137
|
+
changelog_uri: https://github.com/jwt/ruby-jwt/blob/v2.6.0/CHANGELOG.md
|
138
|
+
rubygems_mfa_required: 'true'
|
160
139
|
post_install_message:
|
161
140
|
rdoc_options: []
|
162
141
|
require_paths:
|
@@ -172,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: '0'
|
174
153
|
requirements: []
|
175
|
-
rubygems_version: 3.3.
|
154
|
+
rubygems_version: 3.3.7
|
176
155
|
signing_key:
|
177
156
|
specification_version: 4
|
178
157
|
summary: JSON Web Token implementation in Ruby
|
data/.codeclimate.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: coverage
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- "master"
|
7
|
-
jobs:
|
8
|
-
coverage:
|
9
|
-
name: coverage
|
10
|
-
runs-on: ubuntu-20.04
|
11
|
-
env:
|
12
|
-
BUNDLE_GEMFILE: 'gemfiles/rbnacl.gemfile'
|
13
|
-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
14
|
-
steps:
|
15
|
-
- uses: actions/checkout@v2
|
16
|
-
- name: Install libsodium
|
17
|
-
run: |
|
18
|
-
sudo apt-get update -q
|
19
|
-
sudo apt-get install libsodium-dev -y
|
20
|
-
- name: Set up Ruby
|
21
|
-
uses: ruby/setup-ruby@v1
|
22
|
-
with:
|
23
|
-
ruby-version: "2.7"
|
24
|
-
bundler-cache: true
|
25
|
-
- uses: paambaati/codeclimate-action@v3.0.0
|
26
|
-
with:
|
27
|
-
coverageCommand: bundle exec rspec
|
data/.github/workflows/test.yml
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: test
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- "*"
|
7
|
-
pull_request:
|
8
|
-
branches:
|
9
|
-
- "*"
|
10
|
-
jobs:
|
11
|
-
lint:
|
12
|
-
name: RuboCop
|
13
|
-
timeout-minutes: 30
|
14
|
-
runs-on: ubuntu-latest
|
15
|
-
steps:
|
16
|
-
- uses: actions/checkout@v3
|
17
|
-
- name: Set up Ruby
|
18
|
-
uses: ruby/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
ruby-version: "3.0"
|
21
|
-
bundler-cache: true
|
22
|
-
- name: Run RuboCop
|
23
|
-
run: bundle exec rubocop
|
24
|
-
test:
|
25
|
-
name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
|
26
|
-
runs-on: ${{ matrix.os }}
|
27
|
-
strategy:
|
28
|
-
fail-fast: false
|
29
|
-
matrix:
|
30
|
-
os:
|
31
|
-
- ubuntu-20.04
|
32
|
-
ruby:
|
33
|
-
- "2.5"
|
34
|
-
- "2.6"
|
35
|
-
- "2.7"
|
36
|
-
- "3.0"
|
37
|
-
- "3.1"
|
38
|
-
gemfile:
|
39
|
-
- gemfiles/standalone.gemfile
|
40
|
-
- gemfiles/openssl.gemfile
|
41
|
-
- gemfiles/rbnacl.gemfile
|
42
|
-
experimental: [false]
|
43
|
-
include:
|
44
|
-
- { os: ubuntu-20.04, ruby: "2.7", gemfile: 'gemfiles/rbnacl.gemfile', experimental: false }
|
45
|
-
- { os: ubuntu-22.04, ruby: "3.1", experimental: false }
|
46
|
-
- { os: ubuntu-20.04, ruby: "truffleruby-head", experimental: true }
|
47
|
-
- { os: ubuntu-22.04, ruby: "head", experimental: true }
|
48
|
-
continue-on-error: ${{ matrix.experimental }}
|
49
|
-
env:
|
50
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
51
|
-
|
52
|
-
steps:
|
53
|
-
- uses: actions/checkout@v3
|
54
|
-
|
55
|
-
- name: Install libsodium
|
56
|
-
run: |
|
57
|
-
sudo apt-get update -q
|
58
|
-
sudo apt-get install libsodium-dev -y
|
59
|
-
|
60
|
-
- name: Set up Ruby
|
61
|
-
uses: ruby/setup-ruby@v1
|
62
|
-
with:
|
63
|
-
ruby-version: ${{ matrix.ruby }}
|
64
|
-
bundler-cache: true
|
65
|
-
|
66
|
-
- name: Run tests
|
67
|
-
run: bundle exec rspec
|
data/.gitignore
DELETED
data/.reek.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
---
|
2
|
-
detectors:
|
3
|
-
TooManyStatements:
|
4
|
-
max_statements: 10
|
5
|
-
UtilityFunction:
|
6
|
-
enabled: false
|
7
|
-
LongParameterList:
|
8
|
-
enabled: false
|
9
|
-
DuplicateMethodCall:
|
10
|
-
max_calls: 2
|
11
|
-
IrresponsibleModule:
|
12
|
-
enabled: false
|
13
|
-
NestedIterators:
|
14
|
-
max_allowed_nesting: 2
|
15
|
-
UnusedParameters:
|
16
|
-
enabled: false
|
17
|
-
FeatureEnvy:
|
18
|
-
enabled: false
|
19
|
-
ControlParameter:
|
20
|
-
enabled: false
|
21
|
-
UnusedPrivateMethod:
|
22
|
-
enabled: false
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.5
|
3
|
-
NewCops: enable
|
4
|
-
SuggestExtensions: false
|
5
|
-
Exclude:
|
6
|
-
- 'gemfiles/*.gemfile'
|
7
|
-
- 'vendor/**/*'
|
8
|
-
|
9
|
-
Style/Documentation:
|
10
|
-
Enabled: false
|
11
|
-
|
12
|
-
Style/BlockDelimiters:
|
13
|
-
Exclude:
|
14
|
-
- spec/**/*_spec.rb
|
15
|
-
|
16
|
-
Style/GuardClause:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/IfUnlessModifier:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Style/Lambda:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Style/RaiseArgs:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Metrics/AbcSize:
|
29
|
-
Max: 25
|
30
|
-
|
31
|
-
Metrics/ClassLength:
|
32
|
-
Max: 112
|
33
|
-
|
34
|
-
Metrics/ModuleLength:
|
35
|
-
Max: 100
|
36
|
-
|
37
|
-
Metrics/MethodLength:
|
38
|
-
Max: 20
|
39
|
-
|
40
|
-
Metrics/BlockLength:
|
41
|
-
Exclude:
|
42
|
-
- spec/**/*_spec.rb
|
43
|
-
|
44
|
-
Layout/LineLength:
|
45
|
-
Enabled: false
|
46
|
-
|
47
|
-
Layout/EndAlignment:
|
48
|
-
EnforcedStyleAlignWith: variable
|
49
|
-
|
50
|
-
Layout/EmptyLineBetweenDefs:
|
51
|
-
Enabled: true
|
52
|
-
AllowAdjacentOneLineDefs: true
|
53
|
-
|
54
|
-
Style/FormatString:
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
Layout/MultilineMethodCallIndentation:
|
58
|
-
EnforcedStyle: indented
|
59
|
-
|
60
|
-
Layout/MultilineOperationIndentation:
|
61
|
-
EnforcedStyle: indented
|
62
|
-
|
63
|
-
Style/WordArray:
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
Gemspec/RequireMFA:
|
67
|
-
Enabled: false
|
data/.sourcelevel.yml
DELETED
data/Appraisals
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'bundler/gem_tasks'
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'rspec/core/rake_task'
|
8
|
-
require 'rubocop/rake_task'
|
9
|
-
|
10
|
-
RSpec::Core::RakeTask.new(:test)
|
11
|
-
RuboCop::RakeTask.new(:rubocop)
|
12
|
-
|
13
|
-
task default: %i[rubocop test]
|
14
|
-
rescue LoadError
|
15
|
-
puts 'RSpec rake tasks not available. Please run "bundle install" to install missing dependencies.'
|
16
|
-
end
|
data/lib/jwt/signature.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'jwt/security_utils'
|
4
|
-
require 'openssl'
|
5
|
-
require 'jwt/algos'
|
6
|
-
begin
|
7
|
-
require 'rbnacl'
|
8
|
-
rescue LoadError
|
9
|
-
raise if defined?(RbNaCl)
|
10
|
-
end
|
11
|
-
|
12
|
-
# JWT::Signature module
|
13
|
-
module JWT
|
14
|
-
# Signature logic for JWT
|
15
|
-
module Signature
|
16
|
-
module_function
|
17
|
-
|
18
|
-
ToSign = Struct.new(:algorithm, :msg, :key)
|
19
|
-
ToVerify = Struct.new(:algorithm, :public_key, :signing_input, :signature)
|
20
|
-
|
21
|
-
def sign(algorithm, msg, key)
|
22
|
-
algo, code = Algos.find(algorithm)
|
23
|
-
algo.sign ToSign.new(code, msg, key)
|
24
|
-
end
|
25
|
-
|
26
|
-
def verify(algorithm, key, signing_input, signature)
|
27
|
-
algo, code = Algos.find(algorithm)
|
28
|
-
algo.verify(ToVerify.new(code, key, signing_input, signature))
|
29
|
-
rescue OpenSSL::PKey::PKeyError
|
30
|
-
raise JWT::VerificationError, 'Signature verification raised'
|
31
|
-
ensure
|
32
|
-
OpenSSL.errors.clear
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|