omniauth-fenix 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7c0dfdf79931817867f85aa8fa1835db61fc33f
4
- data.tar.gz: c75859319b456ee11efaf0333952f3129ea7ed3f
3
+ metadata.gz: 5d0ddf9190d5adc238bbf0a98d119e6220f36e2a
4
+ data.tar.gz: 67753c7d0a93aee55466b737ffa200d4607c62de
5
5
  SHA512:
6
- metadata.gz: 0df246a86b521cfb9ba50f7b80f5da3cac7a6fe3e0c2748e750087fb61626cf40e4d2467f5ce58c7da4bfe2d182d12b9c315e08e650a830d4a3803e8d75c5a26
7
- data.tar.gz: 36846cc1cb9ec73738b07b7afc8f4c1ccd354aed47a06dea29759155cf4ec76250a2306f9000c80f080d81d07f041318ab7c6f47f005fdb9a77f9370d036ecdb
6
+ metadata.gz: 85128f7f1872b51b76112a721fb89ab0e5e91b3eada77a9b766b5a67a2a0a2369ba99aef7bdd39e89d9787e9f851ec26352aed2e60a1e9656fc4ad25b3602593
7
+ data.tar.gz: 84e20e489fadbe986a5344ca7a846eee49c128397e00fccea911382ff52ced9e1bda32bbd3a7ea2739ac58c5752a9b3940668887b11f5c00681022b06d9f7dc3
@@ -6,51 +6,39 @@ module OmniAuth
6
6
  option :name, 'fenix'
7
7
 
8
8
  option :client_options, {
9
- :token_url => 'https://fenix.tecnico.ulisboa.pt/oauth/access_token'
9
+ :site => 'https://fenix.tecnico.ulisboa.pt/api/fenix/v1'
10
+ :token_url => 'https://fenix.tecnico.ulisboa.pt/oauth/access_token',
11
+ :authorize_url => 'https://fenix.tecnico.ulisboa.pt/oauth/'
10
12
  }
11
13
 
12
- args [:api_key, :api_secret]
13
-
14
- AUTHORIZE_URL = 'https://fenix.tecnico.ulisboa.pt/oauth/'
15
-
16
14
  def request_phase
17
15
  redirect request_url
18
16
  end
19
17
 
18
+ def raw_info
19
+ access_token.options[:parse] = :json
20
+ url = "/person"
21
+ params = { :params => { :access_token => access_token.token } }
22
+ @raw_info ||= access_token.client.request(:get, url, params).parsed
23
+ end
24
+
20
25
  def build_access_token
21
26
  token_params = {
22
27
  :client_id => client.id,
23
28
  :client_secret => client.secret,
24
- :redirect_uri => callback_url
29
+ :redirect_uri => callback_url,
30
+ :code => request.params['code'],
31
+ :grant_type => 'authorization_code'
25
32
  }
26
33
 
27
- log :info, ">>>>>>>> calling build_access_token"
28
- verifier = request.params['code']
29
- log :info, ">>>>>>> code: #{verifier.inspect}"
30
- log :info, ">>>>> getting auth token now"
31
- token = client.auth_code.get_token(verifier, token_params)
32
- log :info, ">>>>>> token: #{token.inspect}"
33
- token
34
+ client.get_token(token_params)
34
35
  end
35
36
 
36
37
  private
37
38
 
38
39
  def request_url
39
- "#{AUTHORIZE_URL}userdialog?client_id=#{options.api_key}&redirect_uri=#{callback_url}"
40
+ "#{client_options.authorize_url}userdialog?client_id=#{client.id}&redirect_uri=#{callback_url}"
40
41
  end
41
42
  end
42
43
  end
43
44
  end
44
- # uid { raw_info["username"] }
45
- #
46
- # info do
47
- # {
48
- # 'name' => raw_info['name'],
49
- # 'email' => raw_info['email'],
50
- # 'username' => raw_info['username']
51
- # }
52
- # end
53
- #
54
- # def raw_info
55
- # @raw_info ||= access_token.get("/api/fenix/v1/person").parsed
56
- # end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Fenix
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-fenix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rui Mangas Pereira
@@ -71,7 +71,6 @@ files:
71
71
  - lib/omniauth-fenix.rb
72
72
  - lib/omniauth-fenix/version.rb
73
73
  - lib/omniauth/strategies/fenix.rb
74
- - omniauth-fenix-0.1.8.gem
75
74
  - omniauth-fenix.gemspec
76
75
  homepage:
77
76
  licenses:
Binary file