omniauth-campus 0.0.10 → 0.1.0
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: de319a8f2340e6e3097997c56a5b359199ccab24
|
4
|
+
data.tar.gz: d22a844895cf9b233504d7569fdca2d55c38f687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9acab6dffe9995ec7acbde7b13b82a7523dddad8d8b15d075a6bc9ba9a145a81af8ab05fc8fd92781861b57b69e526ffd33bd1f66bf1081e07c1abb165d81c8b
|
7
|
+
data.tar.gz: c3d430fc8fc8a0232cd2f795ceaf48324b520fe3cc0ac4dcc394e927bd34e9054b69cddcb59f79aa9802b1ca9ecbd69f5282b3e1846bb4c43084f77d407b5a92
|
Binary file
|
@@ -12,10 +12,13 @@ module OmniAuth
|
|
12
12
|
class Campus
|
13
13
|
include OmniAuth::Strategy
|
14
14
|
|
15
|
-
|
15
|
+
option :name, 'campus'
|
16
16
|
|
17
|
-
|
18
|
-
option :
|
17
|
+
args [:consumer_key, :consumer_secret]
|
18
|
+
option :consumer_key, nil
|
19
|
+
option :consumer_secret, nil
|
20
|
+
option :callback_url, nil
|
21
|
+
option :client_options, {}
|
19
22
|
|
20
23
|
#site: 'http://community3dev.devcloud.acquia-sites.com/api'
|
21
24
|
|
@@ -26,6 +29,8 @@ module OmniAuth
|
|
26
29
|
#
|
27
30
|
# }
|
28
31
|
#
|
32
|
+
#
|
33
|
+
uid {request.params['user_id']}
|
29
34
|
|
30
35
|
def request_phase
|
31
36
|
form = OmniAuth::Form.new(:title => options.title, :url => callback_path)
|
@@ -35,46 +40,8 @@ module OmniAuth
|
|
35
40
|
form.to_response
|
36
41
|
end
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
return fail!(:invalid_credentials) if !authentication_response
|
41
|
-
return fail!(:invalid_credentials) if authentication_response.code.to_i >= 400
|
42
|
-
super
|
43
|
-
end
|
44
|
-
|
45
|
-
protected
|
46
|
-
|
47
|
-
# by default we use static uri. If dynamic uri is required, override
|
48
|
-
# this method.
|
49
|
-
def api_uri
|
50
|
-
'http://community3dev.devcloud.acquia-sites.com/api'
|
51
|
-
end
|
52
|
-
|
53
|
-
def username
|
54
|
-
request['username']
|
55
|
-
end
|
56
|
-
|
57
|
-
def password
|
58
|
-
request['password']
|
59
|
-
end
|
60
|
-
|
61
|
-
def authentication_response
|
62
|
-
unless @authentication_response
|
63
|
-
return unless username && password
|
64
|
-
|
65
|
-
uri = URI(api_uri)
|
66
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
67
|
-
if uri.scheme == 'https'
|
68
|
-
http.use_ssl = true
|
69
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
70
|
-
end
|
71
|
-
|
72
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
73
|
-
req.basic_auth username, password
|
74
|
-
@authentication_response = http.request(req)
|
75
|
-
end
|
76
|
-
|
77
|
-
@authentication_response
|
43
|
+
def raw_info
|
44
|
+
@raw_info ||= MultiJson.decode(access_token.get('http://community3dev.devcloud.acquia-sites.com/api')).body
|
78
45
|
end
|
79
46
|
|
80
47
|
end
|
Binary file
|