omniauth-campus 0.7.5 → 0.7.9

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: ef813010ead951d900ba3074b4e3b6bf2bbaa91e
4
- data.tar.gz: ae3c6b687d9a740ae09ec15736ca261b5b059059
3
+ metadata.gz: e8882f4f73a394eb7404a73821c48aef9f638b05
4
+ data.tar.gz: aeedfcb9f6f9d13dac366573a6777f0d61edced1
5
5
  SHA512:
6
- metadata.gz: 5f645d144414a0689f5b291ee5e5ef856006d4e29ab7691fa98f12ca41adbe1fa73d28b59608c58b024b32eba7fa442c899a3e0f66aad5b745f27c375a26811f
7
- data.tar.gz: cc02f17c7f61221f5aab2b422bfee5aca7b7f9d508761e12a0c6b330e235b5d9e2fe36e3df616453935b8905187c42036aa9f088b0aa4e9efc8fd791c619399f
6
+ metadata.gz: fabce4f9ca0c424376795489a3599f12dc504e505efa3900c38f2414b23a6015d5b7c581ceb3050bd0016091c531c479a9eced5bdde16401afbf5166e2ea3473
7
+ data.tar.gz: 65ee39f3d21a9f5e440c0520a5e66a3550651009e1962f613620e47df76883e29af8a459c62b8eefe10902a8536cd1ad5711aa69140c0a095f8722a00c4ad1f4
Binary file
Binary file
@@ -1,11 +1,11 @@
1
- require "omniauth-oauth"
2
1
  require 'multi_json'
3
2
  require 'faraday'
4
3
  require 'net/http'
5
4
  require 'open-uri'
6
5
  require 'openssl'
7
6
  require 'rack/utils'
8
-
7
+ require 'oauth'
8
+ require 'omniauth'
9
9
 
10
10
  require 'uri'
11
11
 
@@ -14,24 +14,21 @@ require 'uri'
14
14
  module OmniAuth
15
15
  module Strategies
16
16
  # Your code goes here...
17
- class Campus < OmniAuth::Strategies::OAuth
17
+ class Campus
18
+ include OmniAuth::Strategy
18
19
 
19
20
 
20
21
  option :name, 'campus'
21
22
  args [:consumer_key, :consumer_secret]
22
- #option :consumer_key, "YzjVHuk8xoXCTcNwYg57yiCW5w59tucC"
23
- #option :consumer_secret, "ZDrWuDsunNkRroU5psb6QyMmT86XkYST"
23
+ option :consumer_key, "YzjVHuk8xoXCTcNwYg57yiCW5w59tucC"
24
+ option :consumer_secret, "ZDrWuDsunNkRroU5psb6QyMmT86XkYST"
24
25
  option :client_options, {
25
- request_token_path: '/oauth/request_token',
26
- access_token_path: '/oauth/access_token',
27
- authorize_path: '/oauth/authorize',
26
+ #token_url: '/oauth/access_token',
27
+ #authorize_url: '/oauth/authorize',
28
28
  #request_token_path: '/oauth/request_token',
29
- site: 'http://dev-oauth-test.gotpantheon.com/myawesomejson',
30
- http_method: :get,
31
- scheme: :query_string
29
+ site: 'http://dev-oauth-test.gotpantheon.com/myawesomejson'
32
30
  }
33
31
 
34
- option :authorize_options, [:scope, :display, :auth_type]
35
32
 
36
33
 
37
34
  attr_accessor :access_token
@@ -48,6 +45,30 @@ module OmniAuth
48
45
  #
49
46
 
50
47
 
48
+ def consumer
49
+ consumer = ::OAuth::Consumer.new(options.consumer_key, options.consumer_secret, options.client_options)
50
+ consumer.http.open_timeout = options.open_timeout if options.open_timeout
51
+ consumer.http.read_timeout = options.read_timeout if options.read_timeout
52
+ consumer
53
+ end
54
+
55
+ def request_phase
56
+ request_token = consumer.get_request_token({:oauth_callback => callback_url}, options.request_params)
57
+ session['oauth'] ||= {}
58
+ session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
59
+
60
+ if request_token.callback_confirmed?
61
+ redirect request_token.authorize_url(options[:authorize_params])
62
+ else
63
+ redirect request_token.authorize_url(options[:authorize_params].merge(:oauth_callback => callback_url))
64
+ end
65
+
66
+ rescue ::Timeout::Error => e
67
+ fail!(:timeout, e)
68
+ rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
69
+ fail!(:service_unavailable, e)
70
+ end
71
+
51
72
  uid {raw_info['uid']}
52
73
 
53
74
  info do {
Binary file
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "0.7.5"
3
+ VERSION = "0.7.9"
4
4
  end
5
5
  end
6
6
 
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  #spec.add_dependency 'oauth2', '~> 0.8.0'
27
27
  spec.add_dependency 'faraday', ['>= 0.8', '<0.10']
28
28
  spec.add_dependency 'multi_json', '~> 1.3'
29
+ #spec.add_runtime_dependency 'zendesk_api', '> 0.2.2'
29
30
  end
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: 0.7.5
4
+ version: 0.7.9
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-13 00:00:00.000000000 Z
11
+ date: 2014-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler