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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c16d37434b9fe9e988bc915ecdcf8937926026c
4
- data.tar.gz: 2f33553fcad05d329a81d6fd82adb156ffb479c6
3
+ metadata.gz: 5a16303cd3e95f66adcdba091178fd3f39e32e1c
4
+ data.tar.gz: 9a755593eab4e01aacdc49836ac84fe6a2adffa9
5
5
  SHA512:
6
- metadata.gz: 93902abf2bf2375ed66de1e79d6d9b050cea1b11232f6d18d0d056b7c557cc4d4a4a99c38a51a8e0f58f352339c6541fc75ebd0e8c0562899ec7ae8603da062c
7
- data.tar.gz: 67a15df8815a6e56cad25f7ce6d122383cfebc072130e25e703e30b1c5d288892b52bc48c980c035dc8e471d1ef0bed5de21485a8f75d327d3bd8133f40f61fb
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['user_id'] }
83
+ uid{ request.params['uid'] }
51
84
 
52
85
  info do
53
86
  {
54
87
  :name => raw_info['name'],
55
- :location => raw_info['city']
88
+ :email => raw_info['email']
56
89
  }
57
90
  end
58
91
 
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "1.4"
3
+ VERSION = "1.5"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-campus
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: '1.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnvehr