firebase-auth-id_token_keeper 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -7
- data/README.md +8 -6
- data/firebase-auth-id_token_keeper.gemspec +1 -1
- data/lib/firebase/auth/id_token_keeper/public_keys_endpoint.rb +1 -1
- data/lib/firebase/auth/id_token_keeper/testing/request_helpers.rb +20 -0
- data/lib/firebase/auth/id_token_keeper/testing.rb +0 -11
- data/lib/firebase/auth/id_token_keeper/version.rb +1 -1
- data/lib/firebase/auth/id_token_keeper.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22b488ff13adf3c2b2a61415ade7ef73ccf90b539223739a00f3d03bf1fe0985
|
4
|
+
data.tar.gz: e272eb6e3230bfe7aa8dbea9b44fa032cf729b7ebaabebb9d5b89de3b9ad46ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93a9356a24a6f9938ba4f76a0385de03843c9fcc5b039942f02dfc1f5ded02d23d06e4d2899a289c3d05646f3c906ec73e52a98c024ec3a37fc76f27b854702c
|
7
|
+
data.tar.gz: 200819845346cff119e8ac6463524469de90853ebaa31a6eab2d3da2846f6c7713493dbde3e64183b363ec83ad798086015d0ec48ad847a59e6d89c8f7977bb7
|
data/Gemfile.lock
CHANGED
@@ -8,18 +8,19 @@ PATH
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (6.0.3.1)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 0.7, < 2)
|
14
14
|
minitest (~> 5.1)
|
15
15
|
tzinfo (~> 1.1)
|
16
|
-
|
16
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
17
|
+
concurrent-ruby (1.1.6)
|
17
18
|
diff-lcs (1.3)
|
18
|
-
i18n (1.
|
19
|
+
i18n (1.8.3)
|
19
20
|
concurrent-ruby (~> 1.0)
|
20
21
|
jwt (2.1.0)
|
21
|
-
minitest (5.
|
22
|
-
rake (
|
22
|
+
minitest (5.14.1)
|
23
|
+
rake (13.0.1)
|
23
24
|
rspec (3.8.0)
|
24
25
|
rspec-core (~> 3.8.0)
|
25
26
|
rspec-expectations (~> 3.8.0)
|
@@ -34,8 +35,9 @@ GEM
|
|
34
35
|
rspec-support (~> 3.8.0)
|
35
36
|
rspec-support (3.8.0)
|
36
37
|
thread_safe (0.3.6)
|
37
|
-
tzinfo (1.2.
|
38
|
+
tzinfo (1.2.7)
|
38
39
|
thread_safe (~> 0.1)
|
40
|
+
zeitwerk (2.3.0)
|
39
41
|
|
40
42
|
PLATFORMS
|
41
43
|
ruby
|
@@ -43,7 +45,7 @@ PLATFORMS
|
|
43
45
|
DEPENDENCIES
|
44
46
|
bundler (~> 1.16)
|
45
47
|
firebase-auth-id_token_keeper!
|
46
|
-
rake (~>
|
48
|
+
rake (~> 13.0)
|
47
49
|
rspec (~> 3.0)
|
48
50
|
|
49
51
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -36,16 +36,16 @@ decoded_jwt = {
|
|
36
36
|
"aud"=>"project-id",
|
37
37
|
"auth_time"=>1535353624,
|
38
38
|
"user_id"=>"badcd9971aa1ba6a46bf3379db78",
|
39
|
-
"sub"=>"
|
39
|
+
"sub"=>"badcd9971aa1ba6a46bf3379db78",
|
40
40
|
"iat"=>1535353624,
|
41
|
-
"exp"=>
|
41
|
+
"exp"=>2000000000,
|
42
42
|
"email"=>"test.example@example.com",
|
43
43
|
"email_verified"=>false,
|
44
44
|
"firebase"=>{"identities"=>{"github.com"=>["xxxxxx"], "email"=>["test.example@example.com"]}, "sign_in_provider"=>"github.com"}
|
45
45
|
}
|
46
46
|
|
47
47
|
encoded_jwt = Firebase::Auth::IDTokenKeeper::Testing.generate_test_id_token(decoded_jwt)
|
48
|
-
# => "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.
|
48
|
+
# => "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tL3Byb2plY3QtaWQiLCJuYW1lIjoiVGVzdCBFeGFtcGxlIiwicGljdHVyZSI6Imh0dHBzOi8vZXhhbXBsZS5jb20iLCJhdWQiOiJwcm9qZWN0LWlkIiwiYXV0aF90aW1lIjoxNTM1MzUzNjI0LCJ1c2VyX2lkIjoiYmFkY2Q5OTcxYWExYmE2YTQ2YmYzMzc5ZGI3OCIsInN1YiI6ImJhZGNkOTk3MWFhMWJhNmE0NmJmMzM3OWRiNzgiLCJpYXQiOjE1MzUzNTM2MjQsImV4cCI6MjAwMDAwMDAwMCwiZW1haWwiOiJ0ZXN0LmV4YW1wbGVAZXhhbXBsZS5jb20iLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZ2l0aHViLmNvbSI6WyJ4eHh4eHgiXSwiZW1haWwiOlsidGVzdC5leGFtcGxlQGV4YW1wbGUuY29tIl19LCJzaWduX2luX3Byb3ZpZGVyIjoiZ2l0aHViLmNvbSJ9fQ."
|
49
49
|
|
50
50
|
Firebase::Auth::IDTokenKeeper::Testing.decode_test_id_token(encoded_jwt)
|
51
51
|
# => {
|
@@ -55,9 +55,9 @@ Firebase::Auth::IDTokenKeeper::Testing.decode_test_id_token(encoded_jwt)
|
|
55
55
|
# "aud"=>"project-id",
|
56
56
|
# "auth_time"=>1535353624,
|
57
57
|
# "user_id"=>"badcd9971aa1ba6a46bf3379db78",
|
58
|
-
# "sub"=>"
|
58
|
+
# "sub"=>"badcd9971aa1ba6a46bf3379db78",
|
59
59
|
# "iat"=>1535353624,
|
60
|
-
# "exp"=>
|
60
|
+
# "exp"=>2000000000,
|
61
61
|
# "email"=>"test.example@example.com",
|
62
62
|
# "email_verified"=>false,
|
63
63
|
# "firebase"=>{"identities"=>{"github.com"=>["xxxxxx"], "email"=>["test.example@example.com"]}, "sign_in_provider"=>"github.com"}
|
@@ -69,8 +69,10 @@ Firebase::Auth::IDTokenKeeper::Testing.decode_test_id_token(encoded_jwt)
|
|
69
69
|
Make a support file `spec/support/firebase_auth_id_token_keeper.rb` which contains following code.
|
70
70
|
|
71
71
|
```ruby
|
72
|
+
require 'firebase/auth/id_token_keeper/testing/request_helpers'
|
73
|
+
|
72
74
|
RSpec.configure do |config|
|
73
|
-
config.include Firebase::Auth::IDTokenKeeper::
|
75
|
+
config.include Firebase::Auth::IDTokenKeeper::Testing::RequestHelpers, type: :request
|
74
76
|
end
|
75
77
|
```
|
76
78
|
|
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency 'activesupport', '>= 5.1.0'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
29
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Firebase
|
4
|
+
module Auth
|
5
|
+
module IDTokenKeeper
|
6
|
+
module Testing
|
7
|
+
module RequestHelpers
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
::Firebase::Auth::IDTokenKeeper::IDToken.class_eval do
|
11
|
+
def verified_id_token
|
12
|
+
::Firebase::Auth::IDTokenKeeper::Testing.decode_test_id_token(encoded_jwt)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -4,7 +4,6 @@ module Firebase
|
|
4
4
|
module Auth
|
5
5
|
module IDTokenKeeper
|
6
6
|
module Testing
|
7
|
-
|
8
7
|
def self.generate_test_id_token(decoded_jwt)
|
9
8
|
JWT.encode(decoded_jwt, nil, 'none')
|
10
9
|
end
|
@@ -12,16 +11,6 @@ module Firebase
|
|
12
11
|
def self.decode_test_id_token(encoded_jwt)
|
13
12
|
JWT.decode(encoded_jwt, nil, false)
|
14
13
|
end
|
15
|
-
|
16
|
-
module Helpers
|
17
|
-
extend ActiveSupport::Concern
|
18
|
-
|
19
|
-
::Firebase::Auth::IDTokenKeeper::IDToken.class_eval do
|
20
|
-
def verified_id_token
|
21
|
-
::Firebase::Auth::IDTokenKeeper::Testing.decode_test_id_token(encoded_jwt)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
14
|
end
|
26
15
|
end
|
27
16
|
end
|
@@ -19,5 +19,6 @@ end
|
|
19
19
|
|
20
20
|
require 'firebase/auth/id_token_keeper/version'
|
21
21
|
require 'firebase/auth/id_token_keeper/config'
|
22
|
+
require 'firebase/auth/id_token_keeper/testing'
|
22
23
|
require 'firebase/auth/id_token_keeper/public_keys_endpoint'
|
23
24
|
require 'firebase/auth/id_token_keeper/id_token'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firebase-auth-id_token_keeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rui Onodera
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/firebase/auth/id_token_keeper/id_token.rb
|
104
104
|
- lib/firebase/auth/id_token_keeper/public_keys_endpoint.rb
|
105
105
|
- lib/firebase/auth/id_token_keeper/testing.rb
|
106
|
+
- lib/firebase/auth/id_token_keeper/testing/request_helpers.rb
|
106
107
|
- lib/firebase/auth/id_token_keeper/version.rb
|
107
108
|
- lib/generators/firebase/auth/id_token_keeper/install_generator.rb
|
108
109
|
- lib/generators/firebase/auth/id_token_keeper/templates/firebase_auth_id_token_keeper.rb
|
@@ -125,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: '0'
|
127
128
|
requirements: []
|
128
|
-
|
129
|
-
rubygems_version: 2.7.3
|
129
|
+
rubygems_version: 3.0.3.1
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Verify the Firebase ID Token which obtained at the client side.
|