jwt 2.1.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +6 -18
  3. data/.github/workflows/coverage.yml +27 -0
  4. data/.github/workflows/test.yml +67 -0
  5. data/.gitignore +3 -1
  6. data/.reek.yml +21 -39
  7. data/.rspec +1 -0
  8. data/.rubocop.yml +21 -52
  9. data/{.ebert.yml → .sourcelevel.yml} +3 -4
  10. data/AUTHORS +119 -0
  11. data/Appraisals +13 -0
  12. data/CHANGELOG.md +329 -19
  13. data/CODE_OF_CONDUCT.md +84 -0
  14. data/CONTRIBUTING.md +99 -0
  15. data/Gemfile +4 -0
  16. data/README.md +261 -100
  17. data/Rakefile +6 -1
  18. data/lib/jwt/algos/ecdsa.rb +37 -8
  19. data/lib/jwt/algos/eddsa.rb +16 -4
  20. data/lib/jwt/algos/hmac.rb +3 -0
  21. data/lib/jwt/algos/none.rb +17 -0
  22. data/lib/jwt/algos/ps.rb +43 -0
  23. data/lib/jwt/algos/rsa.rb +4 -1
  24. data/lib/jwt/algos/unsupported.rb +7 -4
  25. data/lib/jwt/algos.rb +44 -0
  26. data/lib/jwt/base64.rb +19 -0
  27. data/lib/jwt/claims_validator.rb +37 -0
  28. data/lib/jwt/configuration/container.rb +21 -0
  29. data/lib/jwt/configuration/decode_configuration.rb +46 -0
  30. data/lib/jwt/configuration/jwk_configuration.rb +27 -0
  31. data/lib/jwt/configuration.rb +15 -0
  32. data/lib/jwt/decode.rb +120 -24
  33. data/lib/jwt/encode.rb +43 -25
  34. data/lib/jwt/error.rb +6 -0
  35. data/lib/jwt/json.rb +18 -0
  36. data/lib/jwt/jwk/ec.rb +199 -0
  37. data/lib/jwt/jwk/hmac.rb +67 -0
  38. data/lib/jwt/jwk/key_base.rb +35 -0
  39. data/lib/jwt/jwk/key_finder.rb +62 -0
  40. data/lib/jwt/jwk/kid_as_key_digest.rb +15 -0
  41. data/lib/jwt/jwk/rsa.rb +138 -0
  42. data/lib/jwt/jwk/thumbprint.rb +26 -0
  43. data/lib/jwt/jwk.rb +52 -0
  44. data/lib/jwt/security_utils.rb +8 -0
  45. data/lib/jwt/signature.rb +7 -22
  46. data/lib/jwt/verify.rb +19 -8
  47. data/lib/jwt/version.rb +6 -2
  48. data/lib/jwt/x5c_key_finder.rb +55 -0
  49. data/lib/jwt.rb +12 -44
  50. data/ruby-jwt.gemspec +13 -9
  51. metadata +44 -97
  52. data/.travis.yml +0 -14
  53. data/Manifest +0 -8
  54. data/lib/jwt/default_options.rb +0 -15
  55. data/spec/fixtures/certs/ec256-private.pem +0 -8
  56. data/spec/fixtures/certs/ec256-public.pem +0 -4
  57. data/spec/fixtures/certs/ec256-wrong-private.pem +0 -8
  58. data/spec/fixtures/certs/ec256-wrong-public.pem +0 -4
  59. data/spec/fixtures/certs/ec384-private.pem +0 -9
  60. data/spec/fixtures/certs/ec384-public.pem +0 -5
  61. data/spec/fixtures/certs/ec384-wrong-private.pem +0 -9
  62. data/spec/fixtures/certs/ec384-wrong-public.pem +0 -5
  63. data/spec/fixtures/certs/ec512-private.pem +0 -10
  64. data/spec/fixtures/certs/ec512-public.pem +0 -6
  65. data/spec/fixtures/certs/ec512-wrong-private.pem +0 -10
  66. data/spec/fixtures/certs/ec512-wrong-public.pem +0 -6
  67. data/spec/fixtures/certs/rsa-1024-private.pem +0 -15
  68. data/spec/fixtures/certs/rsa-1024-public.pem +0 -6
  69. data/spec/fixtures/certs/rsa-2048-private.pem +0 -27
  70. data/spec/fixtures/certs/rsa-2048-public.pem +0 -9
  71. data/spec/fixtures/certs/rsa-2048-wrong-private.pem +0 -27
  72. data/spec/fixtures/certs/rsa-2048-wrong-public.pem +0 -9
  73. data/spec/fixtures/certs/rsa-4096-private.pem +0 -51
  74. data/spec/fixtures/certs/rsa-4096-public.pem +0 -14
  75. data/spec/integration/readme_examples_spec.rb +0 -202
  76. data/spec/jwt/verify_spec.rb +0 -232
  77. data/spec/jwt_spec.rb +0 -315
  78. data/spec/spec_helper.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0fca109273d0c036454af123d30bb3eb75f0de39
4
- data.tar.gz: 8848296d35465d3411f71d882da73ef05663f6a6
2
+ SHA256:
3
+ metadata.gz: a3098671a837e7b291103cde1921277c61ecaa0f0797b955e6adc65328498f0d
4
+ data.tar.gz: 3253833ac6d7743e40a5d5157b161cd0daecc9b77f61dfa7687d6b3da1be56ca
5
5
  SHA512:
6
- metadata.gz: 213d4ea31197a90be8b8cd08ea92dee4659f47b884bc3571440697db979cf98b04e3d1cf487bc94a7a8a8f3f29ee34ebf48d7cc5bd9cfa9f2ca65a092bb2c3d3
7
- data.tar.gz: 530335d90320cdc5501cc1f67984502f79a390641b904567971ad4858a285128cc4702dbf54d505324bcb1ea3ecdf5675057c942e9709ecf0f17b4099229c04d
6
+ metadata.gz: 306c946b1199301a3f1000c8ffba4a77d07fd05dd83f769da86fd29f254827b5af8488a4b6a54b11f1f7f3a028cb88caafb7ed67528e7004c0337f6506e595ea
7
+ data.tar.gz: 57d1eba7a06bc9d9f9fcb76b42aa3808415af5020c53969b4cada890b1646e7d348a96ce18010ab0a978e42825febbeb7b3f205b72e8ce60ef90132cf5887599
data/.codeclimate.yml CHANGED
@@ -1,20 +1,8 @@
1
- engines:
1
+ plugins:
2
+ fixme:
3
+ enabled: true
4
+ shellcheck:
5
+ enabled: true
2
6
  rubocop:
3
7
  enabled: true
4
- golint:
5
- enabled: false
6
- gofmt:
7
- enabled: false
8
- eslint:
9
- enabled: false
10
- csslint:
11
- enabled: false
12
-
13
- ratings:
14
- paths:
15
- - lib/**
16
- - "**.rb"
17
-
18
- exclude_paths:
19
- - spec/**/*
20
- - vendor/**/*
8
+ channel: rubocop-1-23-0
@@ -0,0 +1,27 @@
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
@@ -0,0 +1,67 @@
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 CHANGED
@@ -8,4 +8,6 @@ coverage/
8
8
  .ruby-version
9
9
  .vscode/
10
10
  .bundle
11
- bin/
11
+ *gemfile.lock
12
+ .byebug_history
13
+ *.gem
data/.reek.yml CHANGED
@@ -1,40 +1,22 @@
1
1
  ---
2
- TooManyStatements:
3
- max_statements: 10
4
- UncommunicativeMethodName:
5
- reject:
6
- - !ruby/regexp /^[a-z]$/
7
- - !ruby/regexp /[0-9]$/
8
- UncommunicativeParameterName:
9
- reject:
10
- - !ruby/regexp /^.$/
11
- - !ruby/regexp /[0-9]$/
12
- - !ruby/regexp /^_/
13
- UncommunicativeVariableName:
14
- reject:
15
- - !ruby/regexp /^.$/
16
- - !ruby/regexp /[0-9]$/
17
- UtilityFunction:
18
- enabled: false
19
- LongParameterList:
20
- enabled: false
21
- DuplicateMethodCall:
22
- max_calls: 2
23
- IrresponsibleModule:
24
- enabled: false
25
- NestedIterators:
26
- max_allowed_nesting: 2
27
- PrimaDonnaMethod:
28
- enabled: false
29
- UnusedParameters:
30
- enabled: false
31
- FeatureEnvy:
32
- enabled: false
33
- ControlParameter:
34
- enabled: false
35
- UnusedPrivateMethod:
36
- enabled: false
37
- InstanceVariableAssumption:
38
- exclude:
39
- - !ruby/regexp /Controller$/
40
- - !ruby/regexp /Mailer$/s
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 CHANGED
@@ -1 +1,2 @@
1
+ --require spec_helper
1
2
  --color
data/.rubocop.yml CHANGED
@@ -1,29 +1,10 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.5
3
+ NewCops: enable
4
+ SuggestExtensions: false
2
5
  Exclude:
3
- - 'bin/**/*'
4
- - 'db/**/*'
5
- - 'config/**/*'
6
- - 'script/**/*'
7
-
8
- Rails:
9
- Enabled: true
10
-
11
- Style/AlignParameters:
12
- EnforcedStyle: with_fixed_indentation
13
-
14
- Style/CaseIndentation:
15
- EnforcedStyle: end
16
-
17
- Style/AsciiComments:
18
- Enabled: false
19
-
20
- Style/IndentHash:
21
- Enabled: false
22
-
23
- Style/CollectionMethods:
24
- Enabled: true
25
- PreferredMethods:
26
- inject: 'inject'
6
+ - 'gemfiles/*.gemfile'
7
+ - 'vendor/**/*'
27
8
 
28
9
  Style/Documentation:
29
10
  Enabled: false
@@ -32,67 +13,55 @@ Style/BlockDelimiters:
32
13
  Exclude:
33
14
  - spec/**/*_spec.rb
34
15
 
35
- Style/BracesAroundHashParameters:
36
- Exclude:
37
- - spec/**/*_spec.rb
38
-
39
16
  Style/GuardClause:
40
17
  Enabled: false
41
18
 
42
19
  Style/IfUnlessModifier:
43
20
  Enabled: false
44
21
 
45
- Style/SpaceInsideHashLiteralBraces:
46
- Enabled: false
47
-
48
22
  Style/Lambda:
49
23
  Enabled: false
50
24
 
51
25
  Style/RaiseArgs:
52
26
  Enabled: false
53
27
 
54
- Style/SignalException:
55
- Enabled: false
56
-
57
28
  Metrics/AbcSize:
58
- Max: 20
29
+ Max: 25
59
30
 
60
31
  Metrics/ClassLength:
61
- Max: 100
32
+ Max: 112
62
33
 
63
34
  Metrics/ModuleLength:
64
35
  Max: 100
65
36
 
66
- Metrics/LineLength:
67
- Enabled: false
68
-
69
37
  Metrics/MethodLength:
70
- Max: 15
38
+ Max: 20
71
39
 
72
- Style/SingleLineBlockParams:
40
+ Metrics/BlockLength:
41
+ Exclude:
42
+ - spec/**/*_spec.rb
43
+
44
+ Layout/LineLength:
73
45
  Enabled: false
74
46
 
75
- Lint/EndAlignment:
47
+ Layout/EndAlignment:
76
48
  EnforcedStyleAlignWith: variable
77
49
 
50
+ Layout/EmptyLineBetweenDefs:
51
+ Enabled: true
52
+ AllowAdjacentOneLineDefs: true
53
+
78
54
  Style/FormatString:
79
55
  Enabled: false
80
56
 
81
- Style/MultilineMethodCallIndentation:
57
+ Layout/MultilineMethodCallIndentation:
82
58
  EnforcedStyle: indented
83
59
 
84
- Style/MultilineOperationIndentation:
60
+ Layout/MultilineOperationIndentation:
85
61
  EnforcedStyle: indented
86
62
 
87
63
  Style/WordArray:
88
64
  Enabled: false
89
65
 
90
- Style/RedundantSelf:
66
+ Gemspec/RequireMFA:
91
67
  Enabled: false
92
-
93
- Style/AlignHash:
94
- Enabled: true
95
- EnforcedLastArgumentHashStyle: always_ignore
96
-
97
- Style/TrivialAccessors:
98
- AllowPredicates: true
@@ -1,4 +1,3 @@
1
- styleguide: excpt/linters
2
1
  engines:
3
2
  reek:
4
3
  enabled: true
@@ -6,13 +5,13 @@ engines:
6
5
  enabled: true
7
6
  rubocop:
8
7
  enabled: true
9
- channel: rubocop-0-49
8
+ channel: latest
10
9
  duplication:
11
10
  config:
12
11
  languages:
13
12
  - ruby
14
13
  enabled: true
15
14
  remark-lint:
16
- enabled: true
15
+ enabled: false
17
16
  exclude_paths:
18
- - spec
17
+ - spec
data/AUTHORS ADDED
@@ -0,0 +1,119 @@
1
+ Tim Rudat
2
+ Joakim Antman
3
+ Jeff Lindsay
4
+ A.B
5
+ shields
6
+ Bob Aman
7
+ Emilio Cristalli
8
+ Egon Zemmer
9
+ Zane Shannon
10
+ Nikita Shatov
11
+ Paul Battley
12
+ Oliver
13
+ blackanger
14
+ Ville Lautanala
15
+ Tyler Pickett
16
+ James Stonehill
17
+ Adam Michael
18
+ Martin Emde
19
+ Saverio Trioni
20
+ Peter M. Goldstein
21
+ Korstiaan de Ridder
22
+ Richard Larocque
23
+ Andrew Davis
24
+ Yason Khaburzaniya
25
+ Klaas Jan Wierenga
26
+ Nick Hammond
27
+ Bart de Water
28
+ Steve Sloan
29
+ Antonis Berkakis
30
+ Bill Mill
31
+ Kevin Olbrich
32
+ Simon Fish
33
+ jb08
34
+ lukas
35
+ Rodrigo López Dato
36
+ ojab
37
+ Ritikesh
38
+ sawyerzhang
39
+ Larry Lv
40
+ smudge
41
+ wohlgejm
42
+ Tom Wey
43
+ yann ARMAND
44
+ Brian Flethcer
45
+ Jurriaan Pruis
46
+ Erik Michaels-Ober
47
+ Matthew Simpson
48
+ Steven Davidovitz
49
+ Nicolas Leger
50
+ Pierre Michard
51
+ RahulBajaj
52
+ Rob Wygand
53
+ Ryan Brushett
54
+ Ryan McIlmoyl
55
+ Ryan Metzler
56
+ Severin Schoepke
57
+ Shaun Guth
58
+ Steve Teti
59
+ T.J. Schuck
60
+ Taiki Sugawara
61
+ Takehiro Adachi
62
+ Tobias Haar
63
+ Toby Pinder
64
+ Tomé Duarte
65
+ Travis Hunter
66
+ Yuji Yaginuma
67
+ Zuzanna Stolińska
68
+ aarongray
69
+ danielgrippi
70
+ fusagiko/takayamaki
71
+ mai fujii
72
+ nycvotes-dev
73
+ revodoge
74
+ rono23
75
+ antonmorant
76
+ Adam Greene
77
+ Alexander Boyd
78
+ Alexandr Kostrikov
79
+ Aman Gupta
80
+ Ariel Salomon
81
+ Arnaud Mesureur
82
+ Artsiom Kuts
83
+ Austin Kabiru
84
+ B
85
+ Bouke van der Bijl
86
+ Brandon Keepers
87
+ Dan Leyden
88
+ Dave Grijalva
89
+ Dmitry Pashkevich
90
+ Dorian Marié
91
+ Ernie Miller
92
+ Evgeni Golov
93
+ Ewoud Kohl van Wijngaarden
94
+ HoneyryderChuck
95
+ Igor Victor
96
+ Ilyaaaaaaaaaaaaa Zhitomirskiy
97
+ Jens Hausherr
98
+ Jeremiah Wuenschel
99
+ John Downey
100
+ Jordan Brough
101
+ Josh Bodah
102
+ JotaSe
103
+ Juanito Fatas
104
+ Julio Lopez
105
+ Katelyn Kasperowicz
106
+ Leonardo Saraiva
107
+ Lowell Kirsh
108
+ Loïc Lengrand
109
+ Lucas Mazza
110
+ Makoto Chiba
111
+ Manuel Bustillo
112
+ Marco Adkins
113
+ Meredith Leu
114
+ Micah Gates
115
+ Michał Begejowicz
116
+ Mike Eirih
117
+ Mike Pastore
118
+ Mingan
119
+ Mitch Birti
data/Appraisals ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'standalone' do
4
+ # No additions
5
+ end
6
+
7
+ appraise 'openssl' do
8
+ gem 'openssl', '~> 2.1'
9
+ end
10
+
11
+ appraise 'rbnacl' do
12
+ gem 'rbnacl'
13
+ end