omniauth-github-organization 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811e39bdf5700e014003066910ba4001ddc406022ab790dbaae64fc11f397e63
|
4
|
+
data.tar.gz: e85af1b4235f3ea36f4d0abff772b14110c64cf06f5c13b434fa7a6f872a78b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a71d07929ec95de6600df0357a5bf6a2a47d9aecdc3ff14960ef5ce5ba4a7cad3d293fe8c5c4c7cee63fc042ad969193b5840f2211365009bef24f9926e6af83
|
7
|
+
data.tar.gz: 674b7fb11efed63f852fc2e08110c53717f6ef5a2943bfd5432f304c98221fcac8149aaed7a58613ec36abc0e9b4cc5894d72ed2207563690679d5521498eee1
|
@@ -28,25 +28,14 @@ module OmniAuth
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def callback_phase
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
self.access_token.options[:mode] = :query
|
40
|
-
organizations = self.access_token.get('user/orgs', headers: { 'Accept' => 'application/vnd.github.v3' }).parsed
|
41
|
-
fail!(:user_denied, CallbackError.new(:user_denied, options['organization'])) unless organizations.map { |x| x['login'] }.include? options['organization']
|
42
|
-
super
|
43
|
-
end
|
44
|
-
rescue ::OAuth2::Error, CallbackError => e
|
45
|
-
fail!(:invalid_credentials, e)
|
46
|
-
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
|
47
|
-
fail!(:timeout, e)
|
48
|
-
rescue ::SocketError => e
|
49
|
-
fail!(:failed_to_connect, e)
|
31
|
+
super
|
32
|
+
raise(CallbackError.new(:user_denied, options['organization'])) unless organizations.include? options['organization']
|
33
|
+
end
|
34
|
+
|
35
|
+
def organizations
|
36
|
+
access_token.options[:mode] = :query
|
37
|
+
organizations = access_token.get('user/orgs', headers: { 'Accept' => 'application/vnd.github.v3' }).parsed
|
38
|
+
organizations.map { |x| x['login'] }
|
50
39
|
end
|
51
40
|
|
52
41
|
uid { raw_info['id'].to_s }
|
@@ -31,9 +31,7 @@ describe OmniAuth::Strategies::GitHubOrganization do
|
|
31
31
|
allow(subject).to receive(:organizations).and_return(%w[example test])
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
OmniAuth.config.test_mode = false
|
36
|
-
end
|
34
|
+
|
37
35
|
|
38
36
|
context 'client options' do
|
39
37
|
it 'should have correct site' do
|