firebase_id_token 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 536ac169a34db614f7501d80d974dbd9048a917bb3c0887b6e16f90381772b61
4
- data.tar.gz: 83e7a5258af798b479f1a9eea253e4d0dfae6cac5aa0f003787973abb87dc28d
3
+ metadata.gz: 04e416cf72a26dfef4ba1555005cce301af06b10d68c34cb31873e4de4204307
4
+ data.tar.gz: b35dbae1fcb4f1da7e6a240be49662ec090e70f22e9e940a2173583c35a3e91b
5
5
  SHA512:
6
- metadata.gz: 1e721876bcfa5f946236d42461bae05365adbfe61c37fd744029fc1e2b27b3c1fe22bc20bf850a6a23fbd18d4e45f2a2572190a76fc86ef5ad022f689ace8d6a
7
- data.tar.gz: d06b0c0f60dc2dfe15762ba19fc9ef9549f3efcd46bc124ab0572ba992993fdd06cfd59a3aea8c0708d56916eba3551dade16026ee57fa7ddd1fe103fbf48d5c
6
+ metadata.gz: 59a99e199abc3b4280500cc6202b78d125cb89874c7e4c0fc19956c25f89362ec8262af785fcfd1efd38c8a429dc5a231c6cca39b0a170c007cf7d2962c84429
7
+ data.tar.gz: c3654c443865086ba7aaaa66a5851ea6cf6549fc590ae24055491c0b44619a22399ea148d34e7e245dd5fc7ccf0bad0e04a2c3a3d1746ba1b40088db212e8f0b
@@ -17,14 +17,12 @@ Gem::Specification.new do |spec|
17
17
  spec.homepage = 'https://github.com/fschuindt/firebase_id_token'
18
18
  spec.license = 'MIT'
19
19
 
20
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
- f.match(%r{^(test|spec|features)/})
22
- end
20
+ spec.files = `git ls-files -z`.split("\x0")
23
21
  spec.bindir = 'exe'
24
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
23
  spec.require_paths = ['lib']
26
24
 
27
- spec.add_development_dependency 'bundler', '~> 1.14'
25
+ spec.add_development_dependency 'bundler'
28
26
  spec.add_development_dependency 'rake', '~> 10.0'
29
27
  spec.add_development_dependency 'rspec', '~> 3.0'
30
28
  spec.add_development_dependency 'redcarpet', '~> 3.4', '>= 3.4.0'
@@ -1,3 +1,3 @@
1
1
  module FirebaseIdToken
2
- VERSION = '2.3.1'
2
+ VERSION = '2.3.2'
3
3
  end
@@ -0,0 +1,142 @@
1
+ require 'spec_helper'
2
+
3
+ module FirebaseIdToken
4
+ describe Certificates do
5
+ let (:redis) { Redis::Namespace.new 'firebase_id_token', redis: Redis.new }
6
+ let (:certs) { File.read('spec/fixtures/files/certificates.json') }
7
+ let (:cache) { 'public, max-age=19302, must-revalidate, no-transform' }
8
+ let (:low_cache) { 'public, max-age=2160, must-revalidate, no-transform' }
9
+ let (:kid) { JSON.parse(certs).first[0] }
10
+ let (:expires_in) { (DateTime.now + (5/24r)).to_s }
11
+ let (:response) { double }
12
+
13
+ let (:mock_response) {
14
+ allow(response).to receive(:code) { 200 }
15
+ allow(response).to receive(:headers) { { 'cache-control' => cache } }
16
+ allow(response).to receive(:body) { certs }
17
+ }
18
+
19
+ let(:mock_request) {
20
+ mock_response
21
+ allow(HTTParty).to receive(:get).
22
+ with(an_instance_of(String)) { response }
23
+ }
24
+
25
+ before :each do
26
+ redis.del 'certificates'
27
+ mock_request
28
+ end
29
+
30
+ describe '#request' do
31
+ it 'requests certificates when Redis database is empty' do
32
+ expect(HTTParty).to receive(:get).
33
+ with(FirebaseIdToken::Certificates::URL)
34
+ described_class.request
35
+ end
36
+
37
+ it 'does not requests certificates when Redis database is written' do
38
+ expect(HTTParty).to receive(:get).
39
+ with(FirebaseIdToken::Certificates::URL).once
40
+ 2.times { described_class.request }
41
+ end
42
+ end
43
+
44
+ describe '#request!' do
45
+ it 'always requests certificates' do
46
+ expect(HTTParty).to receive(:get).
47
+ with(FirebaseIdToken::Certificates::URL).twice
48
+ 2.times { described_class.request! }
49
+ end
50
+
51
+ it 'sets the certificate expiration time as Redis TTL' do
52
+ described_class.request!
53
+ expect(redis.ttl('certificates')).to be > 3600
54
+ end
55
+
56
+ it 'raises a error when certificates expires in less than 1 hour' do
57
+ allow(response).to receive(:headers) {{'cache-control' => low_cache}}
58
+ expect{ described_class.request! }.
59
+ to raise_error(Exceptions::CertificatesTtlError)
60
+ end
61
+
62
+ it 'raises a error when HTTP response code is other than 200' do
63
+ allow(response).to receive(:code) { 401 }
64
+ expect{ described_class.request! }.
65
+ to raise_error(Exceptions::CertificatesRequestError)
66
+ end
67
+ end
68
+
69
+ describe '#request_anyway' do
70
+ it 'also requests certificates' do
71
+ expect(HTTParty).to receive(:get).
72
+ with(FirebaseIdToken::Certificates::URL)
73
+
74
+ described_class.request_anyway
75
+ end
76
+ end
77
+
78
+ describe '.present?' do
79
+ it 'returns false when Redis database is empty' do
80
+ expect(described_class.present?).to be(false)
81
+ end
82
+
83
+ it 'returns true when Redis database is written' do
84
+ described_class.request
85
+ expect(described_class.present?).to be(true)
86
+ end
87
+ end
88
+
89
+ describe '.all' do
90
+ context 'before requesting certificates' do
91
+ it 'returns a empty Array' do
92
+ expect(described_class.all).to eq([])
93
+ end
94
+ end
95
+
96
+ context 'after requesting certificates' do
97
+ it 'returns a array of hashes: String keys' do
98
+ described_class.request
99
+ expect(described_class.all.first.keys[0]).to be_a(String)
100
+ end
101
+
102
+ it 'returns a array of hashes: OpenSSL::X509::Certificate values' do
103
+ described_class.request
104
+ expect(described_class.all.first.values[0]).
105
+ to be_a(OpenSSL::X509::Certificate)
106
+ end
107
+ end
108
+ end
109
+
110
+ describe '.find' do
111
+ context 'without certificates in Redis database' do
112
+ it 'raises a exception' do
113
+ expect{ described_class.find(kid)}.
114
+ to raise_error(Exceptions::NoCertificatesError)
115
+ end
116
+ end
117
+
118
+ context 'with certificates in Redis database' do
119
+ it 'returns a OpenSSL::X509::Certificate when it finds the kid' do
120
+ described_class.request
121
+ expect(described_class.find(kid)).to be_a(OpenSSL::X509::Certificate)
122
+ end
123
+
124
+ it 'returns nil when it can not find the kid' do
125
+ described_class.request
126
+ expect(described_class.find('')).to be(nil)
127
+ end
128
+ end
129
+ end
130
+
131
+ describe '.ttl' do
132
+ it 'returns a positive number when has certificates in Redis' do
133
+ described_class.request
134
+ expect(described_class.ttl).to be > 0
135
+ end
136
+
137
+ it 'returns zero when has no certificates in Redis' do
138
+ expect(described_class.ttl).to eq(0)
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ module FirebaseIdToken
4
+ describe Configuration do
5
+ describe '.project_ids' do
6
+ it 'sets [] as default' do
7
+ expect(Configuration.new.project_ids).to eq([])
8
+ end
9
+ end
10
+
11
+ describe '.project_ids=' do
12
+ it 'changes default values' do
13
+ config = Configuration.new
14
+ config.project_ids = String.new
15
+ expect(config.project_ids).to be_a(String)
16
+ end
17
+ end
18
+
19
+ describe '.redis' do
20
+ it 'sets a Redis instance as default' do
21
+ expect(Configuration.new.redis).to be_a(Redis)
22
+ end
23
+ end
24
+
25
+ describe '.redis=' do
26
+ it 'changes default values' do
27
+ config = Configuration.new
28
+ config.redis = String.new
29
+ expect(config.redis).to be_a(String)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ module FirebaseIdToken
4
+ describe Signature do
5
+ let(:jwt) { JSON.parse File.read('spec/fixtures/files/jwt.json') }
6
+
7
+ let (:mock_certificates) {
8
+ allow(Certificates).to receive(:find).with(an_instance_of(String)) {
9
+ OpenSSL::X509::Certificate.new(jwt['certificate']) }
10
+ }
11
+
12
+ before :each do
13
+ mock_certificates
14
+ FirebaseIdToken.configure do |config|
15
+ config.project_ids = ['firebase-id-token']
16
+ end
17
+ end
18
+
19
+ describe '#verify' do
20
+ it 'returns a Hash when the signature is valid' do
21
+ expect(described_class.verify(jwt['jwt_token'])).to be_a(Hash)
22
+ end
23
+
24
+ it 'returns nil when the signature is invalid' do
25
+ expect(described_class.verify(jwt['bad_jwt_token'])).to be(nil)
26
+ end
27
+
28
+ it 'returns nil with a invalid key format' do
29
+ expect(described_class.verify('aaa')).to be(nil)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ module FirebaseIdToken
4
+ describe Signature do
5
+ let(:jwt) { JSON.parse File.read('spec/fixtures/files/jwt.json') }
6
+ let(:payload) { JSON.parse File.read('spec/fixtures/files/payload.json') }
7
+ let(:rsa_private) { OpenSSL::PKey::RSA.new(FirebaseIdToken::Testing::Certificates.private_key) }
8
+
9
+ before :each do
10
+ FirebaseIdToken.configure do |config|
11
+ config.project_ids = ['firebase-id-token']
12
+ end
13
+ FirebaseIdToken.test!
14
+ end
15
+
16
+ describe '#verify' do
17
+
18
+ it 'test mode is valid' do
19
+ expect(described_class.verify(jwt['jwt_token'])).to be_a(Hash)
20
+ end
21
+
22
+ it 'test mode encode is valid' do
23
+ JWT.encode payload, rsa_private, 'RS256'
24
+ expect(described_class.verify(jwt['jwt_token'])).to be_a(Hash)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe FirebaseIdToken do
4
+ let(:jwt) { JSON.parse File.read('spec/fixtures/files/jwt.json') }
5
+
6
+ let (:mock_certificates) {
7
+ allow(FirebaseIdToken::Certificates).to receive(:find).
8
+ with(an_instance_of(String)) {
9
+ OpenSSL::X509::Certificate.new(jwt['certificate']) }
10
+ }
11
+
12
+ it 'has a version number' do
13
+ expect(FirebaseIdToken::VERSION).not_to be nil
14
+ end
15
+
16
+ describe '#configure' do
17
+ before :each do
18
+ mock_certificates
19
+ FirebaseIdToken.configure do |config|
20
+ config.project_ids = ['firebase-id-token']
21
+ end
22
+ end
23
+
24
+ it 'sets global project_ids' do
25
+ expect(FirebaseIdToken::Signature.verify(jwt['jwt_token'])).to be_a(Hash)
26
+ end
27
+
28
+ after :each do
29
+ FirebaseIdToken.reset
30
+ end
31
+ end
32
+
33
+ describe '#reset' do
34
+ before :each do
35
+ FirebaseIdToken.configure do |config|
36
+ config.project_ids = 1
37
+ end
38
+ end
39
+
40
+ it 'resets the configuration' do
41
+ FirebaseIdToken.reset
42
+ config = FirebaseIdToken.configuration
43
+ expect(config.project_ids).to eq([])
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ About the payload.json
2
+
3
+ Keep it for didactic and debugging reasons.
@@ -0,0 +1,5 @@
1
+ {
2
+ "1d6d911c0c01c7871befbedab6fe4aa932cb14b1":"-----BEGIN CERTIFICATE-----\nMIIDHDCCAgSgAwIBAgIIcM5ipUjH60gwDQYJKoZIhvcNAQEFBQAwMTEvMC0GA1UE\nAxMmc2VjdXJldG9rZW4uc3lzdGVtLmdzZXJ2aWNlYWNjb3VudC5jb20wHhcNMTcw\nNDIwMDA0NTI2WhcNMTcwNDIzMDExNTI2WjAxMS8wLQYDVQQDEyZzZWN1cmV0b2tl\nbi5zeXN0ZW0uZ3NlcnZpY2VhY2NvdW50LmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD\nggEPADCCAQoCggEBAL1PdoFtJ6YI+TLRPZcNNElRlOHmGGvBvilmgZEa3Pn5P6BH\n7NIi1PuLlRKoAOh+m+NBxEP+o6X6SVyLxhmLqoUmNxJP1UzdP4iUV4taSe5Ar6LG\nuPFwzzFTygHVZmiED+0/YhaigcPWakU29rDKBBzi3mbHOrftCENc4MjSj+VgN0f7\namTXEHvs/mnCaKs9llIKLFNkxZMCLYYUI8z/fAswkvF+16jr1hWMQhJ0EtsrS7+s\nAaDainDxRHQdL/C3invOp/+MdtV9JD76uTcwRaJnevtMAwReGsuVuQ9ytueFMjDR\ndwAcXEj7DFum7UlG4YUJNyrwfFMP7STdXMDIcU0CAwEAAaM4MDYwDAYDVR0TAQH/\nBAIwADAOBgNVHQ8BAf8EBAMCB4AwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJ\nKoZIhvcNAQEFBQADggEBACUU6SbF+W/PIQLu4JKc2AuyqFG3+HMHTggq6lFD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MT0dqygh2qxqvbouCGjum0REg",
5
+ "bad_jwt_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEyM3F3ZSJ9.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZmlyZWJhc2UtaWQtdG9rZW4iLCJuYW1lIjoiVWdseSBCb2IiLCJwaWN0dXJlIjoiaHR0cHM6Ly9zb21ldXJsLmNvbS9waG90by5qcGciLCJhdWQiOiJmaXJlYmFzZS1pZC10b2tlbiIsImF1dGhfdGltZSI6MTQ5Mjk4MTE5MiwidXNlcl9pZCI6InRoZVVzZXJJRCIsInN1YiI6InRoZVVzZXJJRCIsImlhdCI6MTQ5Mjk4MTIwMCwiZXhwIjozMzAyOTAwMDAxNywiZW1haWwiOiJ1Z2x5Ym9iQGVtYWlsdXJsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7Imdvb2dsZS5jb20iOlsiMTAxMDEwMTAxMDEwMTAxMDEwMSJdLCJlbWFpbCI6WyJ1Z2x5Ym9iQGVtYWlsdXJsLmNvbSJdfSwic2lnbl9pbl9wcm92aWRlciI6Imdvb2dsZS5jb20ifX0.rR9237-LJAgdt6ICqR7qoB5625tsat8uGTszB55rSEBEop8WFvXQo0maEfwtl_3JTxUfefDkLWUaBnFqArEMPoT9TIRuBOdJtVRDSxfNjio87DumsXPb97ALX2bTUU49fwDHGBiZqkBq9m0V49O-50MfyQqS0otC2p4_pRisS4o"
6
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "iss":"https://securetoken.google.com/firebase-id-token",
3
+ "name":"Ugly Bob",
4
+ "picture":"https://someurl.com/photo.jpg",
5
+ "aud":"firebase-id-token",
6
+ "auth_time":1492981192,
7
+ "user_id":"theUserID",
8
+ "sub":"theUserID",
9
+ "iat":1492981200,
10
+ "exp":33029000017,
11
+ "email":"uglybob@emailurl.com",
12
+ "email_verified":true,
13
+ "firebase":{
14
+ "identities":{
15
+ "google.com":[
16
+ "1010101010101010101"
17
+ ],
18
+ "email":[
19
+ "uglybob@emailurl.com"
20
+ ]
21
+ },
22
+ "sign_in_provider":"google.com"
23
+ }
24
+ }
@@ -0,0 +1,19 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ require 'bundler/setup'
5
+ require 'redis'
6
+ require 'redis-namespace'
7
+ require 'httparty'
8
+ require 'jwt'
9
+ require 'firebase_id_token'
10
+ require 'pry'
11
+
12
+ RSpec.configure do |config|
13
+ # Enable flags like --only-failures and --next-failure
14
+ config.example_status_persistence_file_path = '.rspec_status'
15
+
16
+ config.expect_with :rspec do |c|
17
+ c.syntax = :expect
18
+ end
19
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase_id_token
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Schuindt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2020-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -231,6 +231,16 @@ files:
231
231
  - lib/firebase_id_token/signature.rb
232
232
  - lib/firebase_id_token/testing/certificates.rb
233
233
  - lib/firebase_id_token/version.rb
234
+ - spec/firebase_id_token/certificates_spec.rb
235
+ - spec/firebase_id_token/configuration_spec.rb
236
+ - spec/firebase_id_token/signature_spec.rb
237
+ - spec/firebase_id_token/signature_test_spec.rb
238
+ - spec/firebase_id_token_spec.rb
239
+ - spec/fixtures/files/.about_payload_file
240
+ - spec/fixtures/files/certificates.json
241
+ - spec/fixtures/files/jwt.json
242
+ - spec/fixtures/files/payload.json
243
+ - spec/spec_helper.rb
234
244
  homepage: https://github.com/fschuindt/firebase_id_token
235
245
  licenses:
236
246
  - MIT