omniauth-myvr 0.0.16 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/lib/omniauth/strategies/myvr.rb +4 -129
- data/omniauth-myvr.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b6b2b9962d037578e6ce6a6baeb9c2fdd499e0b
|
4
|
+
data.tar.gz: 2527eafdc4ac9ff68493649af3ae490be3aa382e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76074916c6b915b25c0bbc40b9eb0238418559a502d8ab8caa98722a79ff49d3913d3670c489ea42b234b96e4ac14b831e1c5be7f642e24b6a05e3a911a5b308
|
7
|
+
data.tar.gz: 698a44cc3beebf7b2171b94696144aafc42c88b22d585a42f347040e59dd57d5042d489f3db919bc9bfb0cb08f1df55e334a83f9376786f5f54ef2f3b64122ef
|
data/.gitignore
CHANGED
@@ -19,36 +19,6 @@ module OmniAuth
|
|
19
19
|
:token_url => 'http://api.local.myvr.com:8000/oauth/token/'
|
20
20
|
}
|
21
21
|
|
22
|
-
def request_phase
|
23
|
-
puts authorize_params
|
24
|
-
super
|
25
|
-
end
|
26
|
-
|
27
|
-
def authorize_params
|
28
|
-
super.tap do |params|
|
29
|
-
if request.params['scope']
|
30
|
-
params[:scope] = request.params['scope']
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# def authorize_params
|
36
|
-
# super.tap do |params|
|
37
|
-
# options[:authorize_options].each do |k|
|
38
|
-
# params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
|
39
|
-
# end
|
40
|
-
#
|
41
|
-
# raw_scope = params[:scope] || DEFAULT_SCOPE
|
42
|
-
# scope_list = raw_scope.split(" ").map {|item| item.split(",")}.flatten
|
43
|
-
# scope_list.map! { |s| s =~ /^https?:\/\// || BASE_SCOPES.include?(s) ? s : "#{BASE_SCOPE_URL}#{s}" }
|
44
|
-
# params[:scope] = scope_list.join(" ")
|
45
|
-
# params[:access_type] = 'offline' if params[:access_type].nil?
|
46
|
-
# params['openid.realm'] = params.delete(:openid_realm) unless params[:openid_realm].nil?
|
47
|
-
#
|
48
|
-
# session['omniauth.state'] = params[:state] if params['state']
|
49
|
-
# end
|
50
|
-
# end
|
51
|
-
|
52
22
|
# uid { raw_info['sub'] || verified_email }
|
53
23
|
#
|
54
24
|
# info do
|
@@ -99,38 +69,18 @@ module OmniAuth
|
|
99
69
|
# def raw_image_info(id)
|
100
70
|
# @raw_image_info ||= access_token.get("https://www.googleapis.com/plus/v1/people/#{id}?fields=image").parsed
|
101
71
|
# end
|
102
|
-
|
103
|
-
|
72
|
+
|
73
|
+
|
104
74
|
def build_access_token
|
105
75
|
token_params = {
|
106
76
|
:client_secret => client.secret,
|
107
|
-
:grant_type => 'authorization_code'
|
77
|
+
:grant_type => 'authorization_code',
|
78
|
+
:parse => true
|
108
79
|
}
|
109
80
|
verifier = request.params['code']
|
110
81
|
client.auth_code.get_token(verifier, token_params)
|
111
82
|
end
|
112
83
|
|
113
|
-
# def custom_build_access_token
|
114
|
-
# verifier = request.params.fetch('code')
|
115
|
-
# # access_token =
|
116
|
-
# # if request.xhr? && request.params['code']
|
117
|
-
# # verifier = request.params['code']
|
118
|
-
# # client.auth_code.get_token(verifier, get_token_options('postmessage'), deep_symbolize(options.auth_token_params || {}))
|
119
|
-
# # elsif request.params['code'] && request.params['redirect_uri']
|
120
|
-
# # verifier = request.params['code']
|
121
|
-
# # redirect_uri = request.params['redirect_uri']
|
122
|
-
# # client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
|
123
|
-
# # elsif verify_token(request.params['access_token'])
|
124
|
-
# # ::OAuth2::AccessToken.from_hash(client, request.params.dup)
|
125
|
-
# # else
|
126
|
-
# # verifier = request.params["code"]
|
127
|
-
# client.auth_code.get_token(verifier)
|
128
|
-
# # end
|
129
|
-
# # verify_hd(access_token)
|
130
|
-
# # access_token
|
131
|
-
# end
|
132
|
-
# alias_method :build_access_token, :custom_build_access_token
|
133
|
-
|
134
84
|
private
|
135
85
|
|
136
86
|
def callback_url
|
@@ -140,81 +90,6 @@ module OmniAuth
|
|
140
90
|
def get_token_options(redirect_uri)
|
141
91
|
{ :redirect_uri => redirect_uri }.merge(token_params.to_hash(:symbolize_keys => true))
|
142
92
|
end
|
143
|
-
|
144
|
-
# def prune!(hash)
|
145
|
-
# hash.delete_if do |_, v|
|
146
|
-
# prune!(v) if v.is_a?(Hash)
|
147
|
-
# v.nil? || (v.respond_to?(:empty?) && v.empty?)
|
148
|
-
# end
|
149
|
-
# end
|
150
|
-
#
|
151
|
-
# def verified_email
|
152
|
-
# raw_info['email_verified'] ? raw_info['email'] : nil
|
153
|
-
# end
|
154
|
-
#
|
155
|
-
# def image_url
|
156
|
-
# return nil unless raw_info['picture']
|
157
|
-
#
|
158
|
-
# u = URI.parse(raw_info['picture'].gsub('https:https', 'https'))
|
159
|
-
#
|
160
|
-
# path_index = u.path.to_s.index('/photo.jpg')
|
161
|
-
#
|
162
|
-
# if path_index && image_size_opts_passed?
|
163
|
-
# u.path.insert(path_index, image_params)
|
164
|
-
# u.path = u.path.gsub('//', '/')
|
165
|
-
# end
|
166
|
-
#
|
167
|
-
# u.query = strip_unnecessary_query_parameters(u.query)
|
168
|
-
#
|
169
|
-
# u.to_s
|
170
|
-
# end
|
171
|
-
#
|
172
|
-
# def image_size_opts_passed?
|
173
|
-
# !!(options[:image_size] || options[:image_aspect_ratio])
|
174
|
-
# end
|
175
|
-
#
|
176
|
-
# def image_params
|
177
|
-
# image_params = []
|
178
|
-
# if options[:image_size].is_a?(Integer)
|
179
|
-
# image_params << "s#{options[:image_size]}"
|
180
|
-
# elsif options[:image_size].is_a?(Hash)
|
181
|
-
# image_params << "w#{options[:image_size][:width]}" if options[:image_size][:width]
|
182
|
-
# image_params << "h#{options[:image_size][:height]}" if options[:image_size][:height]
|
183
|
-
# end
|
184
|
-
# image_params << 'c' if options[:image_aspect_ratio] == 'square'
|
185
|
-
#
|
186
|
-
# '/' + image_params.join('-')
|
187
|
-
# end
|
188
|
-
#
|
189
|
-
# def strip_unnecessary_query_parameters(query_parameters)
|
190
|
-
# # strip `sz` parameter (defaults to sz=50) which overrides `image_size` options
|
191
|
-
# return nil if query_parameters.nil?
|
192
|
-
#
|
193
|
-
# params = CGI.parse(query_parameters)
|
194
|
-
# stripped_params = params.delete_if { |key| key == "sz" }
|
195
|
-
#
|
196
|
-
# # don't return an empty Hash since that would result
|
197
|
-
# # in URLs with a trailing ? character: http://image.url?
|
198
|
-
# return nil if stripped_params.empty?
|
199
|
-
#
|
200
|
-
# URI.encode_www_form(stripped_params)
|
201
|
-
# end
|
202
|
-
#
|
203
|
-
# def verify_token(access_token)
|
204
|
-
# return false unless access_token
|
205
|
-
# raw_response = client.request(:get, 'https://www.googleapis.com/oauth2/v3/tokeninfo',
|
206
|
-
# params: { access_token: access_token }).parsed
|
207
|
-
# raw_response['aud'] == options.client_id || options.authorized_client_ids.include?(raw_response['aud'])
|
208
|
-
# end
|
209
|
-
#
|
210
|
-
# def verify_hd(access_token)
|
211
|
-
# return true unless options.hd
|
212
|
-
# @raw_info ||= access_token.get('https://www.googleapis.com/plus/v1/people/me/openIdConnect').parsed
|
213
|
-
# allowed_hosted_domains = Array(options.hd)
|
214
|
-
#
|
215
|
-
# raise CallbackError.new(:invalid_hd, "Invalid Hosted Domain") unless allowed_hosted_domains.include? @raw_info['hd']
|
216
|
-
# true
|
217
|
-
# end
|
218
93
|
end
|
219
94
|
end
|
220
95
|
end
|
data/omniauth-myvr.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "omniauth-myvr"
|
6
|
-
s.version = "0.0
|
6
|
+
s.version = "0.1.0"
|
7
7
|
s.authors = ["CJ Avilla"]
|
8
8
|
s.email = ["cjavilla@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/w1zeman1p/omniauth-myvr"
|