omniauth-accounts9 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/omniauth-accounts9/version.rb +1 -1
- data/lib/omniauth/strategies/accounts9.rb +55 -51
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 266855154c773f692981bf5048cdc78e33536b64196d31cb759a1a580ab6086f
|
4
|
+
data.tar.gz: c699110ebeba6fe409c9e17d7c382a65afb0057438d4e9c3acaa17d8d8828b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e2d6d2fbd178ae1c76d7f9d50a8930994fe50ba34d5f7ead3fc625eb02b031098343dd6bc402eceae31f8dbeeeb70f77c45b9043a50b9726f2386c2d74ce43
|
7
|
+
data.tar.gz: 12626b6d225be83f41635c394f33d62a663cf52a31d2e5ed01e17aa9e12703d82abdb34dc3e28599995ff65f05932886e7e4590eedf430b9777cc6540498cd84
|
@@ -1,58 +1,62 @@
|
|
1
1
|
require 'omniauth-oauth2'
|
2
2
|
|
3
3
|
module OmniAuth
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
4
|
+
module Strategies
|
5
|
+
class Accounts9 < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, 'accounts9'
|
7
|
+
|
8
|
+
option :client_options, {:authorize_url => '/api/authorize',
|
9
|
+
:token_url => '/api/access_token',
|
10
|
+
:site => 'https://accounts.net9.org'}
|
11
|
+
option :token_params, { :parse => :json }
|
12
|
+
|
13
|
+
def request_phase
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def authorize_params
|
18
|
+
super.tap do |params|
|
19
|
+
%w[scope client_options].each do |v|
|
20
|
+
if request.params[v]
|
21
|
+
params[v.to_sym] = request.params[v]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
uid { raw_info['uid'].to_s }
|
28
|
+
|
29
|
+
info do
|
30
|
+
{
|
31
|
+
:email => raw_info['email'],
|
32
|
+
:nickname => raw_info['name'],
|
33
|
+
:last_name => raw_info['surname'],
|
34
|
+
:first_name => raw_info['givenname'],
|
35
|
+
:name => raw_info['fullname'],
|
36
|
+
:location => raw_info['address'],
|
37
|
+
:description => raw_info['bio'],
|
38
|
+
:urls => {
|
39
|
+
'Website' => raw_info['website'],
|
40
|
+
}
|
41
|
+
}
|
22
42
|
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
uid { raw_info['uid'].to_s }
|
28
|
-
|
29
|
-
info do
|
30
|
-
{
|
31
|
-
:email => raw_info['email'],
|
32
|
-
:nickname => raw_info['name'],
|
33
|
-
:last_name => raw_info['surname'],
|
34
|
-
:first_name => raw_info['givenname'],
|
35
|
-
:name => raw_info['fullname'],
|
36
|
-
:location => raw_info['address'],
|
37
|
-
:description => raw_info['bio'],
|
38
|
-
:urls => {
|
39
|
-
'Website' => raw_info['website'],
|
40
|
-
}
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
extra do
|
45
|
-
{
|
46
|
-
:raw_info => raw_info
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def raw_info
|
51
|
-
access_token.options[:mode] = :query
|
52
|
-
access_token.options[:param_name] = 'access_token'
|
53
|
-
@raw_info ||= access_token.get('https://accounts.net9.org/api/userinfo').parsed['user']
|
54
|
-
end
|
55
43
|
|
44
|
+
extra do
|
45
|
+
{
|
46
|
+
:raw_info => raw_info
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def raw_info
|
51
|
+
access_token.options[:mode] = :query
|
52
|
+
access_token.options[:param_name] = 'access_token'
|
53
|
+
@raw_info ||= access_token.get('https://accounts.net9.org/api/userinfo').parsed['user']
|
54
|
+
end
|
55
|
+
|
56
|
+
def callback_url
|
57
|
+
full_host + script_name + callback_path
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
56
61
|
end
|
57
|
-
end
|
58
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-accounts9
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- moreD Wen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project: omniauth-accounts9
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.7.6
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: OmniAuth strategy for Accounts9
|