firejwt 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +18 -16
- data/firejwt.gemspec +1 -1
- data/go.mod +6 -3
- data/go.sum +4 -22
- data/lib/firejwt/validator.rb +4 -4
- data/spec/firejwt/validator_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b9a5d7670a3300d3dc038179cda8d93b13424817df91600148cfd59563300c8
|
4
|
+
data.tar.gz: 68f78747998f2c7834bd4b0961ebdd1ef3f4fca1b3977ebc37a60ba84b6bc55e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19abf999c2a37a56f8ccc2748f8886a8d8a5aedb0596a413f0a0f9efb8f28f101f622e35d315f178e95b22d26cc87de2f1ad8695f3308f99075a3a12ed1d1ed5
|
7
|
+
data.tar.gz: '094cd158578989bba66641723567d47d09c9cbcc2d9d84e41aa25e8ee0d89e665c222466dd077d48af72a6abdcc3c966090993e59cd105f94f7839b790626f8e'
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
firejwt (0.1.
|
4
|
+
firejwt (0.1.1)
|
5
5
|
jwt
|
6
6
|
|
7
7
|
GEM
|
@@ -16,44 +16,46 @@ GEM
|
|
16
16
|
safe_yaml (~> 1.0.0)
|
17
17
|
diff-lcs (1.3)
|
18
18
|
e2mmap (0.1.0)
|
19
|
-
hashdiff (1.0.
|
19
|
+
hashdiff (1.0.1)
|
20
20
|
jaro_winkler (1.5.4)
|
21
21
|
jwt (2.2.1)
|
22
22
|
maruku (0.7.3)
|
23
23
|
mini_portile2 (2.4.0)
|
24
|
-
nokogiri (1.10.
|
24
|
+
nokogiri (1.10.9)
|
25
25
|
mini_portile2 (~> 2.4.0)
|
26
26
|
parallel (1.19.1)
|
27
|
-
parser (2.7.
|
27
|
+
parser (2.7.1.2)
|
28
28
|
ast (~> 2.4.0)
|
29
|
-
public_suffix (4.0.
|
29
|
+
public_suffix (4.0.4)
|
30
30
|
rainbow (3.0.0)
|
31
31
|
rake (13.0.1)
|
32
32
|
reverse_markdown (1.4.0)
|
33
33
|
nokogiri
|
34
|
+
rexml (3.2.4)
|
34
35
|
rspec (3.9.0)
|
35
36
|
rspec-core (~> 3.9.0)
|
36
37
|
rspec-expectations (~> 3.9.0)
|
37
38
|
rspec-mocks (~> 3.9.0)
|
38
|
-
rspec-core (3.9.
|
39
|
-
rspec-support (~> 3.9.
|
40
|
-
rspec-expectations (3.9.
|
39
|
+
rspec-core (3.9.2)
|
40
|
+
rspec-support (~> 3.9.3)
|
41
|
+
rspec-expectations (3.9.1)
|
41
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
43
|
rspec-support (~> 3.9.0)
|
43
44
|
rspec-mocks (3.9.1)
|
44
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
46
|
rspec-support (~> 3.9.0)
|
46
|
-
rspec-support (3.9.
|
47
|
-
rubocop (0.
|
47
|
+
rspec-support (3.9.3)
|
48
|
+
rubocop (0.82.0)
|
48
49
|
jaro_winkler (~> 1.5.1)
|
49
50
|
parallel (~> 1.10)
|
50
51
|
parser (>= 2.7.0.1)
|
51
52
|
rainbow (>= 2.2.2, < 4.0)
|
53
|
+
rexml
|
52
54
|
ruby-progressbar (~> 1.7)
|
53
|
-
unicode-display_width (>= 1.4.0, <
|
55
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
54
56
|
ruby-progressbar (1.10.1)
|
55
57
|
safe_yaml (1.0.5)
|
56
|
-
solargraph (0.
|
58
|
+
solargraph (0.39.7)
|
57
59
|
backport (~> 1.1)
|
58
60
|
benchmark
|
59
61
|
bundler (>= 1.17.2)
|
@@ -66,15 +68,15 @@ GEM
|
|
66
68
|
rubocop (~> 0.52)
|
67
69
|
thor (~> 1.0)
|
68
70
|
tilt (~> 2.0)
|
69
|
-
yard (~> 0.9)
|
71
|
+
yard (~> 0.9, >= 0.9.24)
|
70
72
|
thor (1.0.1)
|
71
73
|
tilt (2.0.10)
|
72
|
-
unicode-display_width (1.
|
73
|
-
webmock (3.8.
|
74
|
+
unicode-display_width (1.7.0)
|
75
|
+
webmock (3.8.3)
|
74
76
|
addressable (>= 2.3.6)
|
75
77
|
crack (>= 0.3.2)
|
76
78
|
hashdiff (>= 0.4.0, < 2.0.0)
|
77
|
-
yard (0.9.
|
79
|
+
yard (0.9.25)
|
78
80
|
|
79
81
|
PLATFORMS
|
80
82
|
ruby
|
data/firejwt.gemspec
CHANGED
data/go.mod
CHANGED
@@ -3,10 +3,13 @@ module github.com/bsm/firejwt
|
|
3
3
|
go 1.13
|
4
4
|
|
5
5
|
require (
|
6
|
-
github.com/bsm/bfs v0.9.0
|
7
|
-
github.com/bsm/feedx v0.9.2
|
8
6
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
9
|
-
github.com/golang/protobuf v1.3.2
|
7
|
+
github.com/golang/protobuf v1.3.2 // indirect
|
8
|
+
github.com/kr/pretty v0.1.0 // indirect
|
10
9
|
github.com/onsi/ginkgo v1.11.0
|
11
10
|
github.com/onsi/gomega v1.8.1
|
11
|
+
golang.org/x/net v0.0.0-20191007182048-72f939374954 // indirect
|
12
|
+
golang.org/x/sys v0.0.0-20191008105621-543471e840be // indirect
|
13
|
+
golang.org/x/text v0.3.2 // indirect
|
14
|
+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
12
15
|
)
|
data/go.sum
CHANGED
@@ -1,61 +1,43 @@
|
|
1
|
-
github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
2
|
-
github.com/bmatcuk/doublestar v1.2.2 h1:oC24CykoSAB8zd7XgruHo33E0cHJf/WhQA/7BeXj+x0=
|
3
|
-
github.com/bmatcuk/doublestar v1.2.2/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
4
|
-
github.com/bsm/bfs v0.8.1/go.mod h1:cVv0jyqUY/jbHoG/WYPuWvOaOhW/HZ4jl7/JMlypvAE=
|
5
|
-
github.com/bsm/bfs v0.9.0 h1:7sUB3a5ZzzhBlCELY+2pqCaI6MbO7F2a0jhIgHihhFs=
|
6
|
-
github.com/bsm/bfs v0.9.0/go.mod h1:N3md8kQvlteRDcfc8tqw759yW98dhj+6seWEVcg4CmM=
|
7
|
-
github.com/bsm/feedx v0.9.2 h1:9Af+bc6vvnPpli2D3Re4spwdKxox8kKjmnmE4qPICIc=
|
8
|
-
github.com/bsm/feedx v0.9.2/go.mod h1:63cqu0wUcW6RwIbhOnW27K8XluiOfdqnKFTVTroqNHI=
|
9
1
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
10
2
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
3
|
+
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
11
4
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
12
|
-
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
13
|
-
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
14
5
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
15
6
|
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
16
7
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
17
8
|
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
18
9
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
19
|
-
github.com/
|
20
|
-
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
10
|
+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
21
11
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
22
12
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
13
|
+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
23
14
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
24
15
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
25
|
-
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
26
|
-
github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
27
16
|
github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw=
|
28
17
|
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
29
|
-
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
30
|
-
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
31
18
|
github.com/onsi/gomega v1.8.1 h1:C5Dqfs/LeauYDX0jJXIe2SWmwCbGzx9yF8C8xy3Lh34=
|
32
19
|
github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
33
20
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
34
21
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
35
|
-
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
36
22
|
golang.org/x/net v0.0.0-20191007182048-72f939374954 h1:JGZucVF/L/TotR719NbujzadOZ2AgnYlqphQGHDCKaU=
|
37
23
|
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
38
24
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
39
25
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
40
26
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
41
|
-
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
42
27
|
golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU=
|
43
28
|
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
44
29
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
45
30
|
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
46
31
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
47
32
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
48
|
-
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
49
33
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
|
50
34
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
51
35
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
52
|
-
gopkg.in/check.v1 v1.0.0-
|
36
|
+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
53
37
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
54
38
|
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
55
39
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
56
40
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
57
41
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
58
|
-
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
59
|
-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
60
42
|
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
61
43
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
data/lib/firejwt/validator.rb
CHANGED
@@ -12,7 +12,7 @@ module FireJWT
|
|
12
12
|
# @option opts [Boolean] :verify_iat verify the issued at claim. Default: false.
|
13
13
|
# @option opts [Integer] :exp_leeway expiration leeway in seconds. Default: none.
|
14
14
|
def initialize(**opts)
|
15
|
-
@defaults =
|
15
|
+
@defaults = opts.dup
|
16
16
|
@keys = KeySet.new
|
17
17
|
end
|
18
18
|
|
@@ -38,9 +38,9 @@ module FireJWT
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def norm_opts(opts)
|
41
|
-
opts[:verify_aud] =
|
42
|
-
opts[:verify_iss] =
|
43
|
-
opts[:verify_sub] =
|
41
|
+
opts[:verify_aud] = opts.key?(:aud) unless opts.key?(:verify_aud)
|
42
|
+
opts[:verify_iss] = opts.key?(:iss) unless opts.key?(:verify_iss)
|
43
|
+
opts[:verify_sub] = opts.key?(:sub) unless opts.key?(:verify_sub)
|
44
44
|
opts[:algorithm] ||= 'RS256'
|
45
45
|
opts
|
46
46
|
end
|
@@ -38,6 +38,18 @@ RSpec.describe FireJWT::Validator do
|
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
41
|
+
it 'should normalize options' do
|
42
|
+
expect(JWT).to receive(:decode).with(
|
43
|
+
instance_of(String),
|
44
|
+
nil,
|
45
|
+
true,
|
46
|
+
algorithm: 'RS256',
|
47
|
+
verify_aud: false,
|
48
|
+
verify_iss: false,
|
49
|
+
verify_sub: false,
|
50
|
+
).and_return([{}, {}])
|
51
|
+
subject.decode(token)
|
52
|
+
end
|
41
53
|
it 'should reject bad tokens' do
|
42
54
|
expect { subject.decode('BAD') }.to raise_error(JWT::DecodeError)
|
43
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firejwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|