omniauth-campus 8.3 → 8.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: 1753d34eee439d9cf0a4977432eff8013319f69f
4
- data.tar.gz: 338c6db8e616b4ff2b3b3c8cf0722d2d838eb967
3
+ metadata.gz: b83c42f59a52b501d1d913a2adcf5dab376cb637
4
+ data.tar.gz: 4adbc562e1a6230f79a3792d06bd4dc3b5fe06b2
5
5
  SHA512:
6
- metadata.gz: da88d311b5831633f98c332af20a2a100fd1db6f58d83257ad6cea0f71d850c3770ede906589bd1fabe8f5fed2c1217422c379b8a5ca0c3b9c9d80568e4804c1
7
- data.tar.gz: 5ec5c6dd9378652092e72f77378cab78018b4a5f188bf5afa8a24a3cf6ab2983808931643ec407b5b6f145fcfd7c57ad87e93b549645ea5f1a66fc6da139554b
6
+ metadata.gz: a52c92f2e090c7a7b1d5f12b4de6fd19739158d418e2cc51fc596e6243baa9bdd383dc43c7be42e8b7cad1e128e28acec7cd4423fb266a0797e47d1b5118628b
7
+ data.tar.gz: e91525672723467e132d969b9726fe93751515c0644ba8f8fb38369fd593545b2d64ff255ca76b1089cf4a3b745407063aa4b61c0fc9baa58a9030a796e92625
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "8.3"
3
+ VERSION = "8.4"
4
4
  end
5
5
  end
6
6
 
@@ -1,43 +1,30 @@
1
- require 'omniauth'
2
- require 'oauth'
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
3
 
4
4
  module OmniAuth
5
5
  module Strategies
6
- class Campus
7
- include OmniAuth::Strategy
8
-
9
- option :user_model, nil # default set to 'User' below
10
- option :login_field, :email
11
-
12
- def request_phase
13
- redirect "/session/new"
14
- end
15
-
16
- def callback_phase
17
- return fail!(:invalid_credentials) unless user.try(:authenticate, password)
18
- super
19
- end
20
-
21
- def user
22
- @user ||= user_model.send("find_by_#{options[:login_field]}", login)
23
- end
24
-
25
- def user_model
26
- options[:user_model] || ::User
27
- end
28
-
29
- def login
30
- request[:sessions][options[:login_field].to_s]
31
- end
32
-
33
- def password
34
- request[:sessions]['password']
35
- end
6
+ class Campus < OmniAuth::Strategies::OAuth
7
+ option :name, :campus
36
8
 
9
+ option :client_options, {
10
+ :site => "http://community3dev.devcloud.acquia-sites.com/api"
11
+ }
12
+
37
13
  uid do
38
- user.password_digest
14
+ raw_info[0]['uid']
15
+ end
16
+
17
+ info do
18
+ {
19
+ :name => raw_info[0]['users_name'],
20
+ :email => raw_info[0]['users_mail']
21
+ }
39
22
  end
40
23
 
41
- end
24
+ def raw_info
25
+ @raw_info ||= MultiJson.decode(access_token.get("http://community3dev.devcloud.acquia-sites.com/api").body)
26
+ end
27
+ end
42
28
  end
43
29
  end
30
+
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: '8.3'
4
+ version: '8.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnvehr