omniauth-campus 0.2.3 → 0.2.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 906a0718fa48d59ead21b2ffa93e81dcdeb3b7b9
|
4
|
+
data.tar.gz: df946044012de80f8141aef8656151c1aa514460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5a2f5bf7c2e8ee948bee97e7d308f2ae1afbd907a98733b7c2d664b8317f4f4dabce6d693015cad334d6e4b72102dc1ad00129c425f5acd7facbe961f47d933
|
7
|
+
data.tar.gz: 81648f274247e04161540b82971ef19e06b0ba87b58efded82318a4a8a7ec020d7d9464f4b1ed3a33f6935feb91871b4530dbb043c480e207d59a9bcde4bba0f
|
Binary file
|
Binary file
|
@@ -1,7 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'oauth'
|
2
2
|
#require 'oauth'
|
3
3
|
require 'omniauth'
|
4
4
|
require 'multi_json'
|
5
|
+
require 'net/http'
|
5
6
|
require 'uri'
|
6
7
|
|
7
8
|
#require 'rack/utils'
|
@@ -13,32 +14,18 @@ module OmniAuth
|
|
13
14
|
include OmniAuth::Strategy
|
14
15
|
|
15
16
|
option :name, 'campus'
|
16
|
-
args [:consumer_key, :consumer_secret]
|
17
|
+
args [:consumer_key, :consumer_secret, :endpoint]
|
18
|
+
option :endpoing, 'http://community3dev.devcloud.acquia-sites.com/api'
|
17
19
|
option :consumer_key, nil
|
18
20
|
option :consumer_secret, nil
|
21
|
+
option :authorize_params, {}
|
22
|
+
option :request_params, {}
|
19
23
|
|
20
|
-
option :client_options, {
|
21
|
-
#:site => 'http://community3dev.devcloud.acquia-sites.com/api',
|
22
|
-
#:token_url => "/oauth/request_token",
|
23
|
-
#:access_url => "/oauth/request_access",
|
24
|
-
#:authorize_path => "/oauth/authorize"
|
25
|
-
|
26
|
-
:site => "www.vistacampus.org/",
|
27
|
-
:token_url => '/oauth/access_token',
|
28
|
-
:ssl => {:version => "SSLv3"}
|
29
|
-
}
|
30
24
|
option :fields, [:name, :email]
|
31
25
|
|
32
|
-
option :access_token_options, {
|
33
|
-
:header_format => 'OAuth %s',
|
34
|
-
:param_name => 'access_token'
|
35
|
-
}
|
36
26
|
|
37
27
|
attr_accessor :access_token
|
38
28
|
|
39
|
-
def client
|
40
|
-
::OAuth2::Client.new(options.consumer_id, options.consumer_secret, deep_symbolize(options.client_options))
|
41
|
-
end
|
42
29
|
|
43
30
|
|
44
31
|
#site: 'http://community3dev.devcloud.acquia-sites.com/api'
|
@@ -61,23 +48,59 @@ module OmniAuth
|
|
61
48
|
form.to_response
|
62
49
|
end
|
63
50
|
|
51
|
+
def callback_phase
|
52
|
+
return fail!(:invalid_credentials) if !authentication_response
|
53
|
+
return fail!(:invalid_credentials) if authentication_response.code.to_i >= 400
|
54
|
+
super
|
55
|
+
end
|
64
56
|
|
65
|
-
|
66
|
-
|
67
|
-
info do {
|
68
|
-
name: raw_info['name'],
|
69
|
-
email: raw_info['email']
|
70
|
-
}
|
57
|
+
def api_uri
|
58
|
+
options.endpoint
|
71
59
|
end
|
72
60
|
|
73
|
-
|
74
|
-
|
61
|
+
def name
|
62
|
+
request['name']
|
75
63
|
end
|
76
64
|
|
77
|
-
def
|
78
|
-
|
65
|
+
def email
|
66
|
+
request['email']
|
79
67
|
end
|
80
68
|
|
69
|
+
|
70
|
+
#uid {raw_info['uid']}
|
71
|
+
|
72
|
+
#info do {
|
73
|
+
# name: raw_info['name'],
|
74
|
+
# email: raw_info['email']
|
75
|
+
#}
|
76
|
+
#end
|
77
|
+
#
|
78
|
+
# extra do
|
79
|
+
# raw_info
|
80
|
+
# end
|
81
|
+
|
82
|
+
# def raw_info
|
83
|
+
# @raw_info ||= MultiJson.decode(access_token.get('/me')).body
|
84
|
+
# end
|
85
|
+
|
86
|
+
def authentication_response
|
87
|
+
unless @authentication_response
|
88
|
+
return unless name && email
|
89
|
+
|
90
|
+
uri = URI(api_uri)
|
91
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
92
|
+
if uri.scheme == 'https'
|
93
|
+
http.use_ssl = true
|
94
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
95
|
+
end
|
96
|
+
|
97
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
98
|
+
req.basic_auth name, email
|
99
|
+
@authentication_response = http.request(req)
|
100
|
+
end
|
101
|
+
|
102
|
+
@authentication_response
|
103
|
+
end
|
81
104
|
end
|
82
105
|
end
|
83
106
|
end
|
Binary file
|
data/omniauth-campus.gemspec
CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_runtime_dependency 'omniauth', '~> 1.0'
|
24
|
-
|
25
|
-
spec.add_dependency 'oauth2', '~> 0.8.0'
|
24
|
+
spec.add_runtime_dependency 'oauth'
|
25
|
+
#spec.add_dependency 'oauth2', '~> 0.8.0'
|
26
26
|
spec.add_dependency 'faraday', ['>= 0.8', '<0.10']
|
27
27
|
spec.add_dependency 'multi_json', '~> 1.3'
|
28
28
|
end
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- johnvehr
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: oauth
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faraday
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|