omniauth-campus 3.5 → 3.6
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/lib/omniauth-campus/version.rb +1 -1
- data/lib/omniauth/strategies/campus.rb +14 -60
- 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: f6b56a4db2f34d1942c266dae65587fb0917f771
|
|
4
|
+
data.tar.gz: 0b47057576b54653559852a1766e0be3e229ab92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b7650c85f9caae15f28319acc4549072bad0b59fdbf22771b76a147a7d55fc9b39740fbbaddcb5280421b5fe75dd2705a8cfbdf2987c26c1c3a535b4c2c47da
|
|
7
|
+
data.tar.gz: 2574bc2dd0d445e5556e5af395abe6acfa5e0c658cc8e2cca9bb8618fbecc9fae142631a60529245ba6261a34f5dfb5b13ab6aa0453edfde58ba19e4d03889cf
|
|
@@ -30,68 +30,17 @@ module OmniAuth
|
|
|
30
30
|
#:proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
uid{access_token.params['uid']}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
consumer.http.open_timeout = options.open_timeout if options.open_timeout
|
|
37
|
-
consumer.http.read_timeout = options.read_timeout if options.read_timeout
|
|
38
|
-
consumer
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def request_phase
|
|
42
|
-
request_token = consumer.get_request_token({:oauth_callback => callback_url}, options.request_params)
|
|
43
|
-
session['oauth'] ||= {}
|
|
44
|
-
session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
|
|
45
|
-
|
|
46
|
-
if request_token.callback_confirmed?
|
|
47
|
-
redirect request_token.authorize_url(options[:authorize_params])
|
|
48
|
-
else
|
|
49
|
-
redirect request_token.authorize_url(options[:authorize_params].merge(:oauth_callback => callback_url))
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
rescue ::Timeout::Error => e
|
|
53
|
-
fail!(:timeout, e)
|
|
54
|
-
rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
|
|
55
|
-
fail!(:service_unavailable, e)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def callback_phase
|
|
59
|
-
raise OmniAuth::NoSessionError.new("Session Expired") if session['oauth'].nil?
|
|
60
|
-
|
|
61
|
-
request_token = ::OAuth::RequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret'))
|
|
62
|
-
|
|
63
|
-
opts = {}
|
|
64
|
-
if session['oauth'][name.to_s]['callback_confirmed']
|
|
65
|
-
opts[:oauth_verifier] = request['oauth_verifier']
|
|
66
|
-
else
|
|
67
|
-
opts[:oauth_callback] = callback_url
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
@access_token = request_token.get_access_token(opts)
|
|
71
|
-
super
|
|
72
|
-
rescue ::Timeout::Error => e
|
|
73
|
-
fail!(:timeout, e)
|
|
74
|
-
rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
|
|
75
|
-
fail!(:service_unavailable, e)
|
|
76
|
-
rescue ::OAuth::Unauthorized => e
|
|
77
|
-
fail!(:invalid_credentials, e)
|
|
78
|
-
rescue ::MultiJson::DecodeError => e
|
|
79
|
-
fail!(:invalid_response, e)
|
|
80
|
-
rescue ::OmniAuth::NoSessionError => e
|
|
81
|
-
fail!(:session_expired, e)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
uid {
|
|
85
|
-
access_token.params['uid']
|
|
35
|
+
info do {
|
|
36
|
+
:email => access_token.params['email']
|
|
86
37
|
}
|
|
38
|
+
end
|
|
87
39
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
extra do
|
|
93
|
-
{'access_token' => access_token}
|
|
94
|
-
end
|
|
40
|
+
extra do {
|
|
41
|
+
'raw_info' => raw_info
|
|
42
|
+
}
|
|
43
|
+
end
|
|
95
44
|
|
|
96
45
|
def raw_info
|
|
97
46
|
@raw_info ||= MultiJson.decode(access_token.get('/users.json').body)
|
|
@@ -99,6 +48,11 @@ module OmniAuth
|
|
|
99
48
|
raise ::Timeout::Error
|
|
100
49
|
end
|
|
101
50
|
|
|
51
|
+
def request_phase
|
|
52
|
+
options[:authorize_params] = {:perms => options[:scope]} if options[:scope]
|
|
53
|
+
super
|
|
54
|
+
end
|
|
55
|
+
|
|
102
56
|
|
|
103
57
|
|
|
104
58
|
#def auth_hash
|
|
@@ -108,7 +62,7 @@ module OmniAuth
|
|
|
108
62
|
#end
|
|
109
63
|
|
|
110
64
|
|
|
111
|
-
end
|
|
112
65
|
end
|
|
113
66
|
end
|
|
67
|
+
end
|
|
114
68
|
|