omniauth-github-organization 0.1.3 → 0.1.4

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: 811e39bdf5700e014003066910ba4001ddc406022ab790dbaae64fc11f397e63
4
- data.tar.gz: e85af1b4235f3ea36f4d0abff772b14110c64cf06f5c13b434fa7a6f872a78b4
3
+ metadata.gz: ed005e3234452c3e25991d0a86674958a78ae1e5c639781b7bef9e9c4724bc32
4
+ data.tar.gz: f9d0e856b1563899b2cdbd101fab408dae2f190e3410b248b8fd3fedb0518d22
5
5
  SHA512:
6
- metadata.gz: a71d07929ec95de6600df0357a5bf6a2a47d9aecdc3ff14960ef5ce5ba4a7cad3d293fe8c5c4c7cee63fc042ad969193b5840f2211365009bef24f9926e6af83
7
- data.tar.gz: 674b7fb11efed63f852fc2e08110c53717f6ef5a2943bfd5432f304c98221fcac8149aaed7a58613ec36abc0e9b4cc5894d72ed2207563690679d5521498eee1
6
+ metadata.gz: '046768792d03a3aee60644c9eabfaf5ce4b8a67b6d61be62e150120bed802e34153c31591ddf514e7370f78d96835854685152f0d2ff930c75d8d2e92d80d2c2'
7
+ data.tar.gz: 3a57df1a3aee43e152e9dddb34f8f5b194d900e4ff4e3b57e1ebdf62910f12f5de1c043a4910743aeb23d42e080a9ca8d73424483fc73fa6885f2f7da03882d2
data/README.md CHANGED
@@ -9,7 +9,7 @@ on the [GitHub Applications Page](https://github.com/settings/applications).
9
9
 
10
10
  ```ruby
11
11
  use OmniAuth::Builder do
12
- provider :github_organization, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], organization: ENV['GITHUB_ORGANIZATION_NAME']
12
+ provider :github_organization, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
13
13
  end
14
14
  ```
15
15
 
@@ -19,7 +19,7 @@ GitHub API v3 lets you set scopes to provide granular access to different types
19
19
 
20
20
  ```ruby
21
21
  use OmniAuth::Builder do
22
- provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], { organization: ENV['GITHUB_ORGANIZATION_NAME'], scope: "user,repo,gist" }
22
+ provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], { scope: "user,repo,gist" }
23
23
  end
24
24
  ```
25
25
 
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module GitHubOrganization
3
- VERSION = '0.1.3'.freeze
3
+ VERSION = '0.1.4'.freeze
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ module OmniAuth
5
5
  class GitHubOrganization < OmniAuth::Strategies::OAuth2
6
6
  option :name, 'github_organization'
7
7
  option :scope, 'user,read:org'
8
- option :organization, 'example'
8
+
9
9
  # rubocop:disable Style/BracesAroundHashParameters
10
10
  option :client_options, {
11
11
  site: 'https://api.github.com',
@@ -27,15 +27,11 @@ module OmniAuth
27
27
  end
28
28
  end
29
29
 
30
- def callback_phase
31
- super
32
- raise(CallbackError.new(:user_denied, options['organization'])) unless organizations.include? options['organization']
33
- end
34
-
35
30
  def organizations
36
31
  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'] }
32
+ organizations = access_token
33
+ .get('user/orgs', headers: { 'Accept' => 'application/vnd.github.v3' })
34
+ .parsed.map { |x| x['login'] }
39
35
  end
40
36
 
41
37
  uid { raw_info['id'].to_s }
@@ -54,7 +50,7 @@ module OmniAuth
54
50
  end
55
51
 
56
52
  extra do
57
- { raw_info: raw_info, all_emails: emails }
53
+ { raw_info: raw_info, all_emails: emails, organizations: organizations }
58
54
  end
59
55
 
60
56
  def raw_info
@@ -15,8 +15,7 @@ describe OmniAuth::Strategies::GitHubOrganization do
15
15
  site: enterprise_site,
16
16
  authorize_url: enterprise_authorize_url,
17
17
  token_url: enterprise_token_url
18
- },
19
- organization: 'test'
18
+ }
20
19
  }
21
20
  )
22
21
  end
@@ -46,10 +45,6 @@ describe OmniAuth::Strategies::GitHubOrganization do
46
45
  expect(subject.options.client_options.token_url).to eq('https://github.com/login/oauth/access_token')
47
46
  end
48
47
 
49
- it 'should have correct organization name' do
50
- expect(subject.options.organization).to eq('example')
51
- end
52
-
53
48
  describe 'should be overrideable' do
54
49
  it 'for site' do
55
50
  expect(enterprise.options.client_options.site).to eq(enterprise_site)
@@ -63,9 +58,6 @@ describe OmniAuth::Strategies::GitHubOrganization do
63
58
  expect(enterprise.options.client_options.token_url).to eq(enterprise_token_url)
64
59
  end
65
60
 
66
- it 'for organization name' do
67
- expect(enterprise.options.organization).to eq('test')
68
- end
69
61
  end
70
62
  end
71
63
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-github-organization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Ding