omniauth-campus 0.4.4 → 0.4.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: 5c6ab4e15231c614c5cfa4341e3ad05ac630815e
4
- data.tar.gz: 585dc3acb07de42dc99d0e2764d8ed6a424301cb
3
+ metadata.gz: 0b3624ed9f880116dc64155630ae4fc797ba426c
4
+ data.tar.gz: 762766d465585783b4e5148b3af69eab8316b1a4
5
5
  SHA512:
6
- metadata.gz: d5b90a753a922d1b41f61c4db21b3e1329108b2d75d6b51581958d9d5818049460c0ca835c08212eeab6ccf4ff45fd6a79da7b2639f6a6f374b509b428abf772
7
- data.tar.gz: e01c4ff107dcd85c348ca09a55708a3ebf531dcc6b79554c09a280d3189efcae7baa353adeb7da10e93bf5c6ca92287e69a9c746c2eb8135d9d439d3cb4e702e
6
+ metadata.gz: eaea6b184428695052ec587b030f6cd94195a5be8f9ce997fce2c9e7a341455998d0e389675b59f0146047a934f078ebff7bed37931a0b7302050ea6cb064def
7
+ data.tar.gz: 7c0fd8883d467cd8d0ff984f591829fd57670b78cf00854fd469839b03474d1bad50b175a6c5242f7d003baa6968ce332e6a4719c68380950a718dfc31dc9914
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "0.4.4"
3
+ VERSION = "0.4.5"
4
4
  end
5
5
  end
6
6
 
Binary file
@@ -1,4 +1,4 @@
1
- require 'oauth'
1
+ require 'oauth2'
2
2
  #require 'oauth'
3
3
  require 'omniauth'
4
4
  require 'multi_json'
@@ -18,23 +18,25 @@ module OmniAuth
18
18
  include OmniAuth::Strategy
19
19
 
20
20
  option :name, 'campus'
21
- args [:consumer_key, :consumer_secret, :endpoint]
22
- option :endpoint, 'http://community3dev.devcloud.acquia-sites.com/api'
23
- option :consumer_key, "YzjVHuk8xoXCTcNwYg57yiCW5w59tucC"
24
- option :consumer_secret, "ZDrWuDsunNkRroU5psb6QyMmT86XkYST"
25
- option :authorize_params, {}
26
- option :request_params, {}
21
+ args [:client_id, :client_secret]
22
+ #option :consumer_key, "YzjVHuk8xoXCTcNwYg57yiCW5w59tucC"
23
+ #option :consumer_secret, "ZDrWuDsunNkRroU5psb6QyMmT86XkYST"
24
+ option :client_options, {
25
+ authorize_url: '/oauth/authorize',
26
+ token_url: '/oauth/token',
27
+ site: 'http://vistacampus.org'
28
+ }
27
29
 
28
30
  option :fields, [:name, :email]
29
31
 
32
+ option :auth_token_params, {
33
+ param_name: 'access_token',
34
+ mode: :query
35
+ }
30
36
 
31
- attr_accessor :access_token
32
37
 
33
- def request_phase
34
- response = Rack::Response.new
35
- response.redirect(options.endpoint)
36
- response.finish
37
- end
38
+
39
+ attr_accessor :access_token
38
40
 
39
41
 
40
42
 
@@ -52,14 +54,39 @@ module OmniAuth
52
54
 
53
55
 
54
56
 
55
- uid {request['uid']}
57
+ uid {raw_info['uid']}
56
58
 
57
59
  info do {
58
- name: request['name'],
59
- email: request['email']
60
+ name: raw_info['name'],
61
+ email: raw_info['email']
60
62
  }
61
63
  end
62
64
 
65
+ def callback_url
66
+ options.authorize_params.callback_url or super
67
+ end
68
+
69
+ def request_phase
70
+ redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(options.authorize_params))
71
+ end
72
+
73
+ def raw_info
74
+ @raw_info ||= access_token.get('/api/v1/me.json').parsed
75
+ rescue ::Errno::ETIMEDOUT
76
+ raise ::Timeout::Error
77
+ end
78
+
79
+ def build_access_token
80
+ token_params = options.token_params.merge({
81
+ code: request.params['code'],
82
+ redirect_uri: callback_url,
83
+ client_id: client.id,
84
+ client_secret: client.secret
85
+ })
86
+
87
+ client.get_token(token_params, deep_symbolize(options.auth_token_params))
88
+ end
89
+
63
90
 
64
91
 
65
92
  end
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_runtime_dependency 'omniauth', '~> 1.0'
23
+ #spec.add_runtime_dependency 'omniauth', '~> 1.0'
24
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.1.1'
24
25
  spec.add_runtime_dependency 'oauth'
25
26
  #spec.add_dependency 'oauth2', '~> 0.8.0'
26
27
  spec.add_dependency 'faraday', ['>= 0.8', '<0.10']
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: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnvehr
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: omniauth
42
+ name: omniauth-oauth2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: 1.1.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
54
+ version: 1.1.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: oauth
57
57
  requirement: !ruby/object:Gem::Requirement