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 +4 -4
- data/lib/omniauth/strategies/fenix.rb +15 -27
- data/lib/omniauth-fenix/version.rb +1 -1
- metadata +1 -2
- data/omniauth-fenix-0.1.8.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d0ddf9190d5adc238bbf0a98d119e6220f36e2a
|
4
|
+
data.tar.gz: 67753c7d0a93aee55466b737ffa200d4607c62de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
:
|
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
|
-
|
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
|
-
"#{
|
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
|
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.
|
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:
|
data/omniauth-fenix-0.1.8.gem
DELETED
Binary file
|