omniauth-campus 3.3 → 3.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.
- checksums.yaml +4 -4
- data/lib/omniauth-campus/version.rb +1 -1
- data/lib/omniauth/strategies/campus.rb +54 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc3b877ea945bffcf1d74bb89b75367c31f762e5
|
4
|
+
data.tar.gz: b4b458094626c6dedaf1a4f7d40d384b733d27cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e405613132a75cc7ded7e23a6c631fd9e8b48b643de7027758ca55db43c4f0cfedf46a2a60d30d3aeb2d30c98ae8d7e7a6f1e4f666970c7f34d5ae4040dc0002
|
7
|
+
data.tar.gz: e249b9cb5560bd04f5e9fb02bf5b4c94f24d13345aebca4b8d730298a88e3dbd7bf4a61e3f5dc184f42da74ffa8612ff12ff8e3e83f2bd4cf5b47849065b3219
|
@@ -31,7 +31,59 @@ module OmniAuth
|
|
31
31
|
|
32
32
|
|
33
33
|
|
34
|
-
|
34
|
+
def consumer
|
35
|
+
consumer = ::OAuth::Consumer.new(options.consumer_key, options.consumer_secret, options.client_options)
|
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']
|
86
|
+
}
|
35
87
|
|
36
88
|
extra do
|
37
89
|
{
|
@@ -45,12 +97,7 @@ module OmniAuth
|
|
45
97
|
raise ::Timeout::Error
|
46
98
|
end
|
47
99
|
|
48
|
-
|
49
|
-
#options[:authorize_params] = {:perms => options[:scope]} if options[:scope]
|
50
|
-
options[:scope] ||= 'basic'
|
51
|
-
options[:response_type] ||= 'code'
|
52
|
-
super
|
53
|
-
end
|
100
|
+
|
54
101
|
|
55
102
|
#def auth_hash
|
56
103
|
# OmniAuth::Utils.deep_merge(super(), {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-campus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '3.
|
4
|
+
version: '3.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johnvehr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|