omniauth-nexaas_id 0.1.2 → 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/nexaas_id.rb +26 -17
- data/omniauth-nexaas_id.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee50a8da395581f909946e3cc2bdec09042aca82ea70a40080806f13e527c3bb
|
4
|
+
data.tar.gz: f64fda075171ea4a8c6b5efdc9816cb4128e9ed72a585811e01a501e7a81f174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05bd32f7fbbee299b3288d74a19587b65a668148d2fbab7b631ec39f2cfa5daabcc8905bf14735ea532cd235f4820a97281788458df456d2fc73d9dcb54b982
|
7
|
+
data.tar.gz: 245b22912f473395ce671afbdbd99dfa05e51ad1284fc761aa08c5eb46bea0ef7c270629b38a3c46c3afd5bda3aac09fcab63d2da4253fb0ea25dbebe2c6ee88
|
@@ -14,12 +14,14 @@ module OmniAuth
|
|
14
14
|
|
15
15
|
option :name, :nexaas_id
|
16
16
|
option :client_options, site: 'https://id.nexaas.com'
|
17
|
+
option :list_emails, false
|
17
18
|
|
18
19
|
uid do
|
19
20
|
raw_info['id']
|
20
21
|
end
|
21
22
|
|
22
23
|
info do
|
24
|
+
main_email = raw_info['email']
|
23
25
|
{
|
24
26
|
id: raw_info['id'],
|
25
27
|
name: {
|
@@ -27,7 +29,8 @@ module OmniAuth
|
|
27
29
|
last: raw_info['last_name']
|
28
30
|
},
|
29
31
|
fullname: raw_info['full_name'],
|
30
|
-
email:
|
32
|
+
email: main_email,
|
33
|
+
emails: raw_info['emails'] || [main_email],
|
31
34
|
picture_url: raw_info['picture']
|
32
35
|
}
|
33
36
|
end
|
@@ -39,23 +42,8 @@ module OmniAuth
|
|
39
42
|
}
|
40
43
|
end
|
41
44
|
|
42
|
-
# Example:
|
43
|
-
#
|
44
|
-
# {
|
45
|
-
# "id"=>"e9fa918b-a90e-49f3-86ec-e3ce92488a3e",
|
46
|
-
# "full_name"=>"John Doe",
|
47
|
-
# "email"=>"john@doe.com",
|
48
|
-
# "emails"=>[{"address"=>"john@doe.com", "confirmed"=>true}],
|
49
|
-
# "created_at"=>"2016-07-21T22:02:17Z",
|
50
|
-
# "updated_at"=>"2016-07-21T22:02:17Z",
|
51
|
-
# "_links"=>{
|
52
|
-
# "self"=>{
|
53
|
-
# "href"=>"https://id.nexaas.com/api/v1/users/e9fa918b-a90e-49f3-86ec-e3ce92488a3e"
|
54
|
-
# }
|
55
|
-
# }
|
56
|
-
# }
|
57
45
|
def raw_info
|
58
|
-
@raw_info ||=
|
46
|
+
@raw_info ||= build_raw_info
|
59
47
|
end
|
60
48
|
|
61
49
|
def request_phase
|
@@ -71,6 +59,27 @@ module OmniAuth
|
|
71
59
|
end
|
72
60
|
token
|
73
61
|
end
|
62
|
+
|
63
|
+
def build_raw_info
|
64
|
+
add_email_list_to(access_token.get('/api/v1/profile').parsed)
|
65
|
+
end
|
66
|
+
|
67
|
+
def add_email_list_to(acc)
|
68
|
+
acc['emails'] = retrieve_emails(acc['id'])
|
69
|
+
acc
|
70
|
+
end
|
71
|
+
|
72
|
+
def retrieve_emails(id)
|
73
|
+
return unless options[:list_emails] # guard: access endpoint only if allowed
|
74
|
+
emails = access_token.get('/api/v1/profile/emails').parsed
|
75
|
+
got = email['id']
|
76
|
+
raise "unexpected id #{got} retrieving e-mails for #{id}" unless got == id
|
77
|
+
emails['emails']
|
78
|
+
|
79
|
+
rescue StandardError => err
|
80
|
+
warn(err)
|
81
|
+
nil
|
82
|
+
end
|
74
83
|
end
|
75
84
|
end
|
76
85
|
end
|
data/omniauth-nexaas_id.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "omniauth-nexaas_id"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.2.0"
|
8
8
|
spec.authors = ["Rodrigo Tassinari de Oliveira", "Luiz Carlos Buiatte"]
|
9
9
|
spec.email = ["rodrigo@pittlandia.net", "luiz.buiatte@nexaas.com"]
|
10
10
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-nexaas_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Tassinari de Oliveira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|