omniauth-campus 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/strategies/campus.rb +35 -2
- data/lib/omniauth-campus/version.rb +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: 5a16303cd3e95f66adcdba091178fd3f39e32e1c
|
4
|
+
data.tar.gz: 9a755593eab4e01aacdc49836ac84fe6a2adffa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01cb02fa21f1369af15fa92274362cd37b13a2bf3b5be3546bcff786c5f7ea6776c328caabf3d5e37ae96390289f0920221e0f7bea84edb31df71758af8c55b4
|
7
|
+
data.tar.gz: 52bf61422a9c82a449fbf294df4cb3700d95158b88759058925b1ed9c3a65bd758955309c2b16606b694fb9aeff203cb7629932d4551b8cc1cda8276a34cf98f
|
@@ -18,6 +18,9 @@ module OmniAuth
|
|
18
18
|
option :consumer_key, nil
|
19
19
|
option :consumer_secret, nil
|
20
20
|
|
21
|
+
option :name, "campus"
|
22
|
+
|
23
|
+
attr_reader :access_token
|
21
24
|
#option :client_options, {:authorize_path => '/oauth/authenticate'
|
22
25
|
#:site => 'http://dev-oauth-test.gotpantheon.com/myawesomejson',
|
23
26
|
#:proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil}
|
@@ -46,13 +49,43 @@ def consumer
|
|
46
49
|
fail!(:service_unavailable, e)
|
47
50
|
end
|
48
51
|
|
52
|
+
def callback_phase
|
53
|
+
raise OmniAuth::NoSessionError.new("Session Expired") if session['oauth'].nil?
|
54
|
+
|
55
|
+
request_token = ::OAuth::RequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret'))
|
56
|
+
|
57
|
+
opts = {}
|
58
|
+
if session['oauth'][name.to_s]['callback_confirmed']
|
59
|
+
opts[:oauth_verifier] = request['oauth_verifier']
|
60
|
+
else
|
61
|
+
opts[:oauth_callback] = callback_url
|
62
|
+
end
|
63
|
+
|
64
|
+
@access_token = request_token.get_access_token(opts)
|
65
|
+
super
|
66
|
+
rescue ::Timeout::Error => e
|
67
|
+
fail!(:timeout, e)
|
68
|
+
rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
|
69
|
+
fail!(:service_unavailable, e)
|
70
|
+
rescue ::OAuth::Unauthorized => e
|
71
|
+
fail!(:invalid_credentials, e)
|
72
|
+
rescue ::MultiJson::DecodeError => e
|
73
|
+
fail!(:invalid_response, e)
|
74
|
+
rescue ::OmniAuth::NoSessionError => e
|
75
|
+
fail!(:session_expired, e)
|
76
|
+
end
|
77
|
+
|
78
|
+
credentials do
|
79
|
+
{'token' => access_token.token, 'secret' => access_token.secret}
|
80
|
+
end
|
81
|
+
|
49
82
|
|
50
|
-
uid{ request.params['
|
83
|
+
uid{ request.params['uid'] }
|
51
84
|
|
52
85
|
info do
|
53
86
|
{
|
54
87
|
:name => raw_info['name'],
|
55
|
-
:
|
88
|
+
:email => raw_info['email']
|
56
89
|
}
|
57
90
|
end
|
58
91
|
|