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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e49926150ad0e4db2ede7d4f88a496f274f44477
4
- data.tar.gz: 7f8b88e5e84c7f3b75c07d45b29ba716b5631da0
3
+ metadata.gz: fc3b877ea945bffcf1d74bb89b75367c31f762e5
4
+ data.tar.gz: b4b458094626c6dedaf1a4f7d40d384b733d27cd
5
5
  SHA512:
6
- metadata.gz: 56a2c280cbae96c94be5bf92dd03348c8a58a0f730817ca38c75957732fda230c6f13dc2f0a0ff40fed635c33603ca7fb8d9ca7dcec23a470ebe1473a3051b70
7
- data.tar.gz: 40d9eab0cebcb5f3fe6546b888e8541d2ccc6b36590efd39f5bd9c5283b129be02fddbbcf113017f9001c1cf15b2dcca4e234c67f06526532678046306b187d0
6
+ metadata.gz: e405613132a75cc7ded7e23a6c631fd9e8b48b643de7027758ca55db43c4f0cfedf46a2a60d30d3aeb2d30c98ae8d7e7a6f1e4f666970c7f34d5ae4040dc0002
7
+ data.tar.gz: e249b9cb5560bd04f5e9fb02bf5b4c94f24d13345aebca4b8d730298a88e3dbd7bf4a61e3f5dc184f42da74ffa8612ff12ff8e3e83f2bd4cf5b47849065b3219
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "3.3"
3
+ VERSION = "3.4"
4
4
  end
5
5
  end
6
6
 
@@ -31,7 +31,59 @@ module OmniAuth
31
31
 
32
32
 
33
33
 
34
- uid {user_info['uid']}
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
- def request_phase
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.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-20 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler