omniauth-humanid 0.0.18 → 0.0.22
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/update +9 -1
- data/lib/omniauth-humanid.rb +15 -18
- data/omniauth-humanid.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd57cf0904210119c820dc7867c5cd07a2984d0267cb8b22c88b9861f852ce7
|
4
|
+
data.tar.gz: 0a1bb5fa7f63898cacc492748befc9ca985340c74aa8ab96b5fa913cb9d2634e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc7c5b267bbfe4c812216e494ff9e1cdf4fe6ceb59d869c81701c73b9713842ff306622dcebccb9b84a8539cea867a0555043f21e0adafcd94432db5ebf920ce
|
7
|
+
data.tar.gz: 86a847799b4aad2576c9dd512e2971ac8b8678c028345106cb4f70e4055b78eadcd61304af102811b52ab13ae84017e8fcc54ac5354963906b487950be91b79b
|
data/Gemfile.lock
CHANGED
data/bin/update
CHANGED
@@ -26,8 +26,16 @@ x = x.join("\n")
|
|
26
26
|
puts x
|
27
27
|
File.write('./omniauth-humanid.gemspec', x)
|
28
28
|
puts "_______________________________________________"
|
29
|
+
puts "BUNDLE UPDATE"
|
30
|
+
puts `bundle update`
|
31
|
+
puts "_______________________________________________"
|
32
|
+
puts "GIT ADD"
|
29
33
|
puts `git add *`
|
30
34
|
puts "_______________________________________________"
|
35
|
+
puts "GIT COMMIT"
|
31
36
|
puts `git commit -m 'minor changes to version #{version_new}'`
|
32
37
|
puts "_______________________________________________"
|
33
|
-
puts
|
38
|
+
puts "INSTALL GEM LOCALLY"
|
39
|
+
puts `bundle exec rake install`
|
40
|
+
puts "_______________________________________________"
|
41
|
+
puts "info: write 'bundle exec rake release' to release the current version to the interwebz"
|
data/lib/omniauth-humanid.rb
CHANGED
@@ -21,6 +21,8 @@ module OmniAuth
|
|
21
21
|
option :client_id, nil
|
22
22
|
option :exchange_url, "https://core.human-id.org/[HUMANID_VERSION]/server/users/exchange"
|
23
23
|
|
24
|
+
attr_accessor :raw_info
|
25
|
+
|
24
26
|
# def self.humanid_button
|
25
27
|
# #see https://docs.human-id.org/web-sdk-integration-guide
|
26
28
|
# %Q{<a href="#{options.local_sign_up_url}">
|
@@ -108,6 +110,7 @@ module OmniAuth
|
|
108
110
|
#get the exchange_token from the humanID callback
|
109
111
|
Rails.logger.info("CALLBACK PHASE")
|
110
112
|
exchange_token = request.params['et']
|
113
|
+
Rails.logger.info("EXCHANGE TOKEN: #{exchange_token}")
|
111
114
|
|
112
115
|
#create the request (as per the humanID docs)
|
113
116
|
uri = get_exchange_uri
|
@@ -118,30 +121,24 @@ module OmniAuth
|
|
118
121
|
post_request.body = {"exchangeToken" => exchange_token}.to_json
|
119
122
|
#send the request, get the response.
|
120
123
|
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true){|http| http.request(post_request)}
|
124
|
+
Rails.logger.info("RESPONSE: #{res}")
|
121
125
|
if res.code == "200"
|
122
|
-
|
126
|
+
self.raw_info = JSON.parse(res.body)
|
127
|
+
Rails.logger.info("raw: #{raw_info}")
|
128
|
+
super
|
123
129
|
else
|
124
|
-
|
130
|
+
str = "Issue with the callback_phase of humanid omniauth, response from human id has code: #{res.code}, and body: #{res.body}"
|
131
|
+
Rails.logger.error str
|
132
|
+
raise StandardError.new(str)
|
125
133
|
end
|
126
134
|
end
|
127
135
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
alias userAppId uid
|
132
|
-
|
133
|
-
def countryCide
|
134
|
-
request.env['omniauth.auth']['data']['countryCide']
|
136
|
+
#not a method? Some DSL magic that is not explained in docs. Just looked at other projects and they did something like this so
|
137
|
+
info do
|
138
|
+
raw_info['data']
|
135
139
|
end
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
def info
|
140
|
-
request.env['omniauth.auth']['data']
|
141
|
-
end
|
142
|
-
|
143
|
-
def extra
|
144
|
-
request.env['omniauth.auth']
|
140
|
+
uid do
|
141
|
+
raw_info['data']['userAppId']
|
145
142
|
end
|
146
143
|
end
|
147
144
|
end
|
data/omniauth-humanid.gemspec
CHANGED