omniauth-aid 1.0.0 → 2.0.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/LICENSE +21 -0
- data/README.md +1 -1
- data/lib/omniauth/aid/version.rb +1 -1
- data/lib/omniauth/strategies/aid.rb +26 -9
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1550ab83b145950553e634f284ae678696b9b9eb
|
4
|
+
data.tar.gz: 60d2bd9b52a1772c04972ed132ff8c1a27d4b28a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f59f5443f132eb7cb5e0914be568790fc9bbe570e783177aff7ee5137d088d9aa18ff9b7a4662ac3714bab19ffe6aaec29fe50e50771e8317707390139a8a70
|
7
|
+
data.tar.gz: 4eb2a49757bce3c0d2f53422dc5cf7e1bab2c19f99cfecce70e895d4051999594095b6c200130266f2370b5c38b3586d0de603bb265bcf0e6453b98c6241014d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT LICENSE
|
2
|
+
|
3
|
+
Copyright (c) Jonas Helgemo <jonas.helgemo@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ You can configure several options, which you pass in to the `provider` method vi
|
|
38
38
|
|
39
39
|
Hash name | Default | Explanation
|
40
40
|
--- | --- | ---
|
41
|
-
`scope
|
41
|
+
`scope` | `id name` | A space-separated list of permissions you want to request from the user. Optional scopes are: `email`, `phone`, `birth_date`, `tracking_key`, `access`, `external_accounts`, `customer`, `avatar`
|
42
42
|
|
43
43
|
For example, to request `name`, `birth_date` and `email` permissions and display the authentication page:
|
44
44
|
|
data/lib/omniauth/aid/version.rb
CHANGED
@@ -1,25 +1,42 @@
|
|
1
1
|
require 'omniauth/strategies/oauth2'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module OmniAuth
|
4
5
|
module Strategies
|
5
|
-
|
6
|
+
# Class used to parse and return omniauth responses from aID
|
7
|
+
class Aid < OmniAuth::Strategies::OAuth2
|
6
8
|
option :name, :aid
|
7
9
|
option :authorize_options, [:scope]
|
8
10
|
|
9
|
-
option :client_options,
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
11
|
+
option :client_options,
|
12
|
+
site: 'https://www.aid.no',
|
13
|
+
authorize_url: '/api/portunus/v1/oauth/authorize',
|
14
|
+
token_url: '/api/portunus/v1/oauth/token'
|
14
15
|
|
15
|
-
uid { raw_info
|
16
|
+
uid { raw_info['uuid'] || raw_info.key['id'] }
|
16
17
|
|
17
18
|
info do
|
18
|
-
|
19
|
+
prune!('id' => raw_info['id'],
|
20
|
+
'uuid' => raw_info['uuid'],
|
21
|
+
'nickname' => raw_info['name'],
|
22
|
+
'email' => raw_info['email'],
|
23
|
+
'name' => raw_info['name'],
|
24
|
+
'image' => raw_info
|
25
|
+
.fetch('_links') { {} }
|
26
|
+
.fetch('avatar') { {} }['href']
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def prune!(hash)
|
31
|
+
hash.delete_if do |_, value|
|
32
|
+
prune!(value) if value.is_a?(Hash)
|
33
|
+
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
34
|
+
end
|
19
35
|
end
|
20
36
|
|
21
37
|
def raw_info
|
22
|
-
|
38
|
+
response_body = access_token.get('/api/mercury/v2/users/me').body
|
39
|
+
@raw_info ||= JSON.parse(response_body) || {}
|
23
40
|
end
|
24
41
|
end
|
25
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-aid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Helgemo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- ".travis.yml"
|
64
64
|
- Gemfile
|
65
65
|
- Gemfile.lock
|
66
|
+
- LICENSE
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
68
69
|
- bin/console
|
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.4.5
|
97
|
+
rubygems_version: 2.4.5.1
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: Omniauth-strategy for using aID as an OAuth2-provider
|