omniauth-participa 1.0.0.rc0 → 1.0.0.rc1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7a272a3766bb500a97631c0beaab69f4d94786
|
4
|
+
data.tar.gz: 05e76ad5f0d24b87db4197d42828799bc24466b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d32d273c138553293f152c3550f9cf2f79996dea8ecc4167ce99a201a847b076d5126ed1d80728a8fe7578c73600749a6b234a3bb7951fe0669d90368b101c8
|
7
|
+
data.tar.gz: 7952a299fbc2123e2b89b6a78496451635ad91c757be1be708bbc7bc6dbb01f0a92e1d592f16f85c1ddfecb6f19c87a1b6193c9562c82b50bdeff6a74d990eb7
|
@@ -7,11 +7,13 @@ module OmniAuth
|
|
7
7
|
option :name, :participa
|
8
8
|
option :scope, 'public'
|
9
9
|
option :authorize_options, [:redirect_uri, :scope]
|
10
|
+
option :provider_ignores_state, true
|
10
11
|
|
11
12
|
option :client_options, {
|
12
13
|
site: 'http://participa.dev',
|
13
14
|
authorize_url: '/oauth/authorize',
|
14
|
-
token_url: '/oauth/token'
|
15
|
+
token_url: '/oauth/token',
|
16
|
+
endpoint_url: '/api/v2/users/me'
|
15
17
|
}
|
16
18
|
|
17
19
|
def authorize_params
|
@@ -26,7 +28,6 @@ module OmniAuth
|
|
26
28
|
|
27
29
|
uid { raw_info['id'] }
|
28
30
|
|
29
|
-
# TODO: add user groups
|
30
31
|
info do
|
31
32
|
{
|
32
33
|
email: raw_info['email'],
|
@@ -36,12 +37,13 @@ module OmniAuth
|
|
36
37
|
}
|
37
38
|
end
|
38
39
|
|
40
|
+
# TODO: add user groups
|
39
41
|
extra do
|
40
42
|
skip_info? ? {} : { raw_info: raw_info }
|
41
43
|
end
|
42
44
|
|
43
45
|
def raw_info
|
44
|
-
@raw_info ||= acces_token.get(
|
46
|
+
@raw_info ||= acces_token.get(options[:client_options].try(:endpoint_url)).parsed
|
45
47
|
end
|
46
48
|
|
47
49
|
# https://github.com/intridea/omniauth-oauth2/issues/81
|
@@ -30,6 +30,10 @@ describe OmniAuth::Strategies::Participa do
|
|
30
30
|
expect(subject.client.options[:token_url]).to eq('/oauth/token')
|
31
31
|
end
|
32
32
|
|
33
|
+
it 'has correct endpoint_url' do
|
34
|
+
expect(subject.client.options[:endpoint_url]).to eq('/api/v2/users/me')
|
35
|
+
end
|
36
|
+
|
33
37
|
describe 'overrides' do
|
34
38
|
it 'should allow overriding the site' do
|
35
39
|
@options = { client_options: {'site' => 'https://example.com'} }
|
@@ -45,6 +49,11 @@ describe OmniAuth::Strategies::Participa do
|
|
45
49
|
@options = { client_options: {'token_url' => 'https://example.com/oauth/token'} }
|
46
50
|
expect(subject.client.options[:token_url]).to eq('https://example.com/oauth/token')
|
47
51
|
end
|
52
|
+
|
53
|
+
it 'should allow overriding the endpoint_url' do
|
54
|
+
@options = { client_options: {'endpoint_url' => 'https://example.com/api/v1/users/show'} }
|
55
|
+
expect(subject.client.options[:endpoint_url]).to eq('https://example.com/api/v1/users/show')
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|