firebase_id_token 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +18 -12
- data/lib/firebase_id_token/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10e2e87315caff74a53a4899cc088d737e8d7b5a
|
4
|
+
data.tar.gz: 823c6b4809fc6c8b998d7a5e76f7ba978464b8c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 301165fd8085b562c37c0e6440655886ca0abe310a9d3a57a46770a7317159db476a396f7d2a4253e5c0854eeb14ee5290291374e8587697f4849467b52712f0
|
7
|
+
data.tar.gz: 8c46a36573cee0c8d6463768566aa58995e3b544ecf70c9aa8b0708047b9fa510e6d983b2aa12547329bd153e4e74f5e1a179f05040f934abf7ad1ef153ebbba
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -34,7 +34,7 @@ gem install firebase_id_token
|
|
34
34
|
|
35
35
|
or in your Gemfile
|
36
36
|
```
|
37
|
-
gem 'firebase_id_token'
|
37
|
+
gem 'firebase_id_token', '~> 1.2.1'
|
38
38
|
```
|
39
39
|
then
|
40
40
|
```
|
@@ -62,7 +62,7 @@ In this case you must have the gem `redis` in your `Gemfile`.
|
|
62
62
|
```ruby
|
63
63
|
FirebaseIdToken.configure do |config|
|
64
64
|
config.project_ids = ['your-firebase-project-id']
|
65
|
-
congig.redis = Redis.new(:
|
65
|
+
congig.redis = Redis.new(host: '10.0.1.1', port: 6380, db: 15)
|
66
66
|
end
|
67
67
|
```
|
68
68
|
|
@@ -86,24 +86,30 @@ FirebaseIdToken::Certificates.request_anyway
|
|
86
86
|
|
87
87
|
Google give us information about the certificates expiration time, it's used to set a Redis TTL (Time-To-Live) when saving it. By doing so, the certificates will be automatically deleted after it's expiration.
|
88
88
|
|
89
|
-
|
89
|
+
#### Certificates Info
|
90
|
+
|
91
|
+
Checks the presence of certificates in Redis database.
|
90
92
|
```ruby
|
91
|
-
# Boolean representing the presence of certificates in Redis database.
|
92
93
|
FirebaseIdToken::Certificates.present?
|
93
94
|
=> true
|
95
|
+
```
|
94
96
|
|
95
|
-
|
97
|
+
How many seconds until the certificates expiration.
|
98
|
+
```ruby
|
96
99
|
FirebaseIdToken::Certificates.ttl
|
97
100
|
=> 22352
|
101
|
+
```
|
98
102
|
|
99
|
-
|
103
|
+
Lists all certificates in database.
|
104
|
+
```ruby
|
100
105
|
FirebaseIdToken::Certificates.all
|
101
|
-
=> [{"ec8f292sd30224afac5c55540df66d1f999d" => <OpenSSL::X509::Certificate: [...]
|
106
|
+
=> [{"ec8f292sd30224afac5c55540df66d1f999d" => <OpenSSL::X509::Certificate: [...]]
|
107
|
+
```
|
102
108
|
|
103
|
-
|
109
|
+
Finds the respective certificate of a given Key ID.
|
110
|
+
```ruby
|
104
111
|
FirebaseIdToken::Certificates.find('ec8f292sd30224afac5c55540df66d1f999d')
|
105
|
-
=> <OpenSSL::X509::Certificate: subject=<OpenSSL::X509 [...]
|
106
|
-
|
112
|
+
=> <OpenSSL::X509::Certificate: subject=<OpenSSL::X509 [...]>
|
107
113
|
```
|
108
114
|
|
109
115
|
#### Downloading in Rails
|
@@ -129,7 +135,7 @@ Pass the Firebase ID Token to `FirebaseIdToken::Signature.verify` and it will re
|
|
129
135
|
|
130
136
|
```ruby
|
131
137
|
FirebaseIdToken::Signature.verify(token)
|
132
|
-
=> {"iss"=>"https://securetoken.google.com/firebase-id-token", "name"=>"Bob Test", [...]
|
138
|
+
=> {"iss"=>"https://securetoken.google.com/firebase-id-token", "name"=>"Bob Test", [...]}
|
133
139
|
```
|
134
140
|
|
135
141
|
When either the signature is false or the token is invalid, it will return `nil`:
|
@@ -145,7 +151,7 @@ FirebaseIdToken::Signature.verify('aaaaaa')
|
|
145
151
|
|
146
152
|
#### Payload Structure
|
147
153
|
|
148
|
-
In case you need, here's a example of the payload structure in JSON.
|
154
|
+
In case you need, here's a example of the payload structure from a Google login in JSON.
|
149
155
|
```json
|
150
156
|
{
|
151
157
|
"iss":"https://securetoken.google.com/firebase-id-token",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firebase_id_token
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Schuindt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|