hiu_auth 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hiu_auth.rb +17 -21
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1739918424178fc4fffa6fcdecfd94ab7af72da121933f4552a7fd96800966c1
4
- data.tar.gz: bf00c428cd763a08212fefc2a8217f0594d7223aec32200e8ac23f80a2874197
3
+ metadata.gz: b314505ea997350c0b18c59b42c1c5bf85510545015503717e04da8812c4401b
4
+ data.tar.gz: 0b88b7192f42d0c653591b16b31f1e5a286e1059fe5520925c19cfc2f4a60b65
5
5
  SHA512:
6
- metadata.gz: bfa831e85a9b135404b703301719652cb0ca2f00b736ce1561bac77a2c7aafa94bf61d670b2d5fbf9866b04df0a3e8078bc7b4c9156f4bc29c6aa26753683b77
7
- data.tar.gz: dcc6874efabe0028c88222c35df54f84c6a0998e23f422c6c5d3f36eb0127699d3e3fb1b5cf9e419c2a49a072d220a04cf4b352751a6def1d5712fc08f8dfcac
6
+ metadata.gz: 00f2a4b9d032120494f26a9dbffec902df61a66d7565343b9998f8b7c662d37dad3503e0c5f4664a3a29f7d321fea45df1f53a062b58f9fc6be90c64f17610bb
7
+ data.tar.gz: fd2d49645ae12a7480320ce7aadb2bdc0341fa390a7332a60a8a26fbc65e9697a785043c8a2c7a91dca21509aef1b7e4143bc24908e40b006e143d1de2b8ba49
data/lib/hiu_auth.rb CHANGED
@@ -1,25 +1,21 @@
1
+ require_relative 'hiu_http'
1
2
 
2
- module HiuAuth
3
- include ActiveSupport::Concern
4
-
5
- included do
6
-
7
- # Verify google id token from google credential response
8
- # Arguments:
9
- # id_token: (String)
10
- #
11
- # Output: [is_success(boolean), data(Hash)]
12
- def verify_google_credential(id_token)
13
- base_url = 'https://www.googleapis.com'
14
- uri = "/oauth2/v3/tokeninfo?id_token=#{id_token}"
15
- headers = { 'Content-Type': 'application/json' }
16
- request = Http.new(base_url, uri, :get, headers)
17
- response = request.call
18
- if response.status == 200
19
- data = JSON.parse(response.body)
20
- return [true, data]
21
- end
22
- [false]
3
+ class HiuAuth
4
+ # Verify google id token from google credential response
5
+ # Arguments:
6
+ # id_token: (String)
7
+ #
8
+ # Output: [is_success(boolean), data(Hash)]
9
+ def self.verify_google_credential(id_token)
10
+ base_url = 'https://www.googleapis.com'
11
+ uri = "/oauth2/v3/tokeninfo?id_token=#{id_token}"
12
+ headers = { 'Content-Type': 'application/json' }
13
+ request = HiuHttp.new(base_url, uri, :get, headers)
14
+ response = request.call
15
+ if response.status == 200
16
+ data = JSON.parse(response.body)
17
+ return [true, data]
23
18
  end
19
+ [false]
24
20
  end
25
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiu_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dino Hiu