firebase_token_auth 1.2.0 → 1.3.0

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: 95fc13633c155f179c4a74a48826b61348bfeafe06a05c985fc4239c41d1a5e1
4
- data.tar.gz: 9645adc249d87ba2be7b38edc9dd941be199e048658ea680ff6c8614457ed98b
3
+ metadata.gz: d96a4c3041301e5af29e38a8a70454e2628c9edf5e7ad936d910790ca40613ce
4
+ data.tar.gz: 18827a9a5f2ea0826dd9981b524e1836c2a3c244ce85b794722ad2b6a1b93a69
5
5
  SHA512:
6
- metadata.gz: eb9d1699aa73a7c4bb49adaa31b3af9b0b0f779f7b495ec148aeebe47fe9bc37f541a5747ef84608b995694cc7c4e8fc8ecc081cf1c13ae265a9171de305b17a
7
- data.tar.gz: e716f21df00f2c90571243d4e4ef9df978552ad39b9a2729a6452ae98fb164f9d6dd039ce7b3239ebd495aebd7e6c5156f4a1058e01dd905b1fc04abafb79a37
6
+ metadata.gz: c2a5bf310a1b9aad1c2aac7eb562bc4968ea69b1cdd80ee3a0682388b2dd1a2d57ea1f26f521e332789d6cf6df01504a45c64f9d1493dcb98a0ccf3da16f67eb
7
+ data.tar.gz: ae028494a05b1979755e6f17e38edf1d51fbbe9dc03adac85ef6b5b3b3ac1adb540ac1694f0f6b9b6331318a0c85bb59a9f54027919a65162d6e0826a810cfa7
@@ -12,7 +12,7 @@ jobs:
12
12
  - uses: actions/checkout@v2
13
13
 
14
14
  - name: Set up Ruby
15
- uses: actions/setup-ruby@v1
15
+ uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby }}
18
18
 
data/README.md CHANGED
@@ -54,7 +54,7 @@ FirebaseTokenAuth.configure do |config|
54
54
  config.project_id = 'your_project_id'
55
55
  end
56
56
 
57
- client = Firebase.build
57
+ client = FirebaseTokenAuth.build
58
58
  result = client.verify_id_token(id_token)
59
59
 
60
60
  puts result.uid
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.add_dependency 'google-api-client'
27
+ spec.add_dependency 'google-apis-identitytoolkit_v3'
28
28
  spec.add_dependency 'jwt'
29
29
  end
@@ -32,6 +32,7 @@ module FirebaseTokenAuth
32
32
  public_key_manager.refresh_publickeys!
33
33
  validator.validate(configuration.project_id, decoded_jwt)
34
34
  default_options = { algorithm: ALGORITHM, verify_iat: true, verify_expiration: true, exp_leeway: configuration.exp_leeway }
35
+ raise ValidationError, 'Public key may have expired.' unless public_key_manager.public_keys.include?(public_key_id)
35
36
  jwt = JWT.decode(id_token, public_key_manager.public_keys[public_key_id].public_key, true, default_options.merge!(options))
36
37
  IdTokenResult.new(jwt[0]['sub'], IdToken.new(jwt[0], jwt[1]))
37
38
  end
@@ -29,6 +29,7 @@ module FirebaseTokenAuth
29
29
 
30
30
  @auth = if json_key_io
31
31
  io = json_key_io.respond_to?(:read) ? json_key_io : File.open(json_key_io)
32
+ io.rewind if io.respond_to?(:read)
32
33
  Google::Auth::ServiceAccountCredentials.make_creds(
33
34
  json_key_io: io,
34
35
  scope: scope
@@ -40,6 +41,7 @@ module FirebaseTokenAuth
40
41
 
41
42
  if json_key_io
42
43
  json_io = json_key_io.respond_to?(:read) ? json_key_io : File.open(json_key_io)
44
+ json_io.rewind if json_key_io.respond_to?(:read)
43
45
  parsed = JSON.parse(json_io.read)
44
46
  @private_key = OpenSSL::PKey::RSA.new(parsed['private_key'])
45
47
  @client_email = parsed['client_email']
@@ -25,7 +25,7 @@ module FirebaseTokenAuth
25
25
  end
26
26
 
27
27
  def expired?
28
- @expire_time.to_i > Time.now.to_i
28
+ @expire_time.to_i <= Time.now.to_i
29
29
  end
30
30
 
31
31
  def cache_control_header_to_expire_time(cache_control_header)
@@ -1,3 +1,3 @@
1
1
  module FirebaseTokenAuth
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase_token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyataka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-31 00:00:00.000000000 Z
11
+ date: 2021-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: google-api-client
14
+ name: google-apis-identitytoolkit_v3
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubygems_version: 3.0.3
90
+ rubygems_version: 3.1.4
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Firebase Authentication API wrapper for serverside. It support custom token