omniauth-gitlab 1.0.2 → 1.0.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
  SHA1:
3
- metadata.gz: 6c90ebc7ccce82e78ef6218157792adbf2a8be97
4
- data.tar.gz: 78aa9a9c27a1b99fe18a70cc619547552af6b88c
3
+ metadata.gz: '09a621d84d0ca9c607f349887115c8c243689f8a'
4
+ data.tar.gz: 9033ecc6420c9821bdd09ae446773d65b266e141
5
5
  SHA512:
6
- metadata.gz: 46f9f7128e336fb1f6c11050982378c633ef5a2702db33f8d8acaed89669b85d6d40ce39c9ba525840ed9a6918c20a44c0ed04d54dfe169fe82ebc8995ba83e8
7
- data.tar.gz: f9712c2a6af44bd34cfc20abb593576acf05aaa2f2aa646536fd034267e2acb872235811376d3cad91669f9caa255f6abda976b2010c2c49ef43b060f752b2b5
6
+ metadata.gz: a92f292b33ac370abe67821c10f97aaeb2bd026c2e39cfac74bb740cad9da670d2cdfe1a128d7ee1f560d59b0f798d66637b896eca18511c9957e8b539ebe434
7
+ data.tar.gz: a20742007b746b20406f8dbcf52775ccdab7618505b7c7f3835eb697df520c2639fdfbbd1f7a8dba2d66e6865a2527142bc577106eed24e8f43527aec0a74589
data/README.md CHANGED
@@ -31,12 +31,35 @@ Or install it yourself as:
31
31
  ## Standalone Usage
32
32
 
33
33
  use OmniAuth::Builder do
34
- provider :gitlab, ENV['GITLAB_KEY'], ENV['GITLAB_SECRET'],
35
- client_options: {
36
- site: 'https://gitlab.YOURDOMAIN.com',
37
- authorize_url: '/oauth/authorize',
38
- token_url: '/oauth/token'
39
- }
34
+ provider :gitlab, ENV['GITLAB_KEY'], ENV['GITLAB_SECRET'],
35
+ {
36
+ client_options: {
37
+ site: 'https://gitlab.YOURDOMAIN.com/api/v4'
38
+ }
39
+ }
40
+ end
41
+
42
+ ## Custom scopes
43
+
44
+ use OmniAuth::Builder do
45
+ provider :gitlab, ENV['GITLAB_KEY'], ENV['GITLAB_SECRET'], scope: 'read_user openid'
46
+ end
47
+
48
+ ## Old API version
49
+
50
+ API V3 will be unsupported from GitLab 9.5 and will be removed in GitLab 9.5 or later.
51
+
52
+ [https://gitlab.com/help/api/v3_to_v4.md](https://gitlab.com/help/api/v3_to_v4.md)
53
+
54
+ If you use GitLab 9.0 and below you could configure V3 API:
55
+
56
+ use OmniAuth::Builder do
57
+ provider :gitlab, ENV['GITLAB_KEY'], ENV['GITLAB_SECRET'],
58
+ {
59
+ client_options: {
60
+ site: 'https://gitlab.YOURDOMAIN.com/api/v3'
61
+ }
62
+ }
40
63
  end
41
64
 
42
65
  ## Contributing
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new
5
5
 
6
6
  desc 'Run specs'
7
- task :default => :spec
7
+ task default: :spec
@@ -1,2 +1,2 @@
1
- require "omniauth-gitlab/version"
1
+ require 'omniauth-gitlab/version'
2
2
  require 'omniauth/strategies/gitlab'
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Gitlab
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  end
5
5
  end
@@ -4,12 +4,7 @@ require 'omniauth-oauth2'
4
4
  module OmniAuth
5
5
  module Strategies
6
6
  class GitLab < OmniAuth::Strategies::OAuth2
7
-
8
- option :client_options, {
9
- site: 'https://gitlab.com',
10
- authorize_url: '/oauth/authorize',
11
- token_url: '/oauth/token'
12
- }
7
+ option :client_options, site: 'https://gitlab.com/api/v4'
13
8
 
14
9
  option :redirect_url
15
10
 
@@ -17,10 +12,10 @@ module OmniAuth
17
12
 
18
13
  info do
19
14
  {
20
- name: raw_info['name'],
21
- username: raw_info['username'],
22
- email: raw_info['email'],
23
- image: raw_info['avatar_url']
15
+ name: raw_info['name'],
16
+ username: raw_info['username'],
17
+ email: raw_info['email'],
18
+ image: raw_info['avatar_url']
24
19
  }
25
20
  end
26
21
 
@@ -29,7 +24,7 @@ module OmniAuth
29
24
  end
30
25
 
31
26
  def raw_info
32
- @raw_info ||= access_token.get('/api/v3/user').parsed
27
+ @raw_info ||= access_token.get('user').parsed
33
28
  end
34
29
 
35
30
  private
@@ -41,5 +36,4 @@ module OmniAuth
41
36
  end
42
37
  end
43
38
 
44
-
45
39
  OmniAuth.config.add_camelization 'gitlab', 'GitLab'
@@ -6,14 +6,14 @@ require 'omniauth-gitlab/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = 'omniauth-gitlab'
8
8
  gem.version = Omniauth::Gitlab::VERSION
9
- gem.authors = ['ssein']
9
+ gem.authors = ['Sergey Sein']
10
10
  gem.email = ['linchus@gmail.com']
11
- gem.description = %q{This is the strategy for authenticating to your GitLab service}
12
- gem.summary = %q{This is the strategy for authenticating to your GitLab service}
11
+ gem.description = 'This is the strategy for authenticating to your GitLab service'
12
+ gem.summary = 'This is the strategy for authenticating to your GitLab service'
13
13
  gem.homepage = 'https://github.com/linchus/omniauth-gitlab'
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ['lib']
19
19
 
@@ -21,7 +21,5 @@ Gem::Specification.new do |gem|
21
21
  gem.add_dependency 'omniauth-oauth2', '~> 1.0'
22
22
  gem.add_development_dependency 'rspec', '~> 3.1'
23
23
  gem.add_development_dependency 'rspec-its', '~> 1.0'
24
- gem.add_development_dependency 'rack-test'
25
24
  gem.add_development_dependency 'simplecov'
26
- gem.add_development_dependency 'webmock'
27
25
  end
@@ -1,24 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OmniAuth::Strategies::GitLab do
4
-
5
4
  let(:access_token) { double('AccessToken') }
6
5
  let(:parsed_response) { double('ParsedResponse') }
7
6
  let(:response) { double('Response', parsed: parsed_response) }
8
7
 
9
- let(:enterprise_site) { 'https://some.other.site.com/api/v3' }
10
- let(:enterprise_authorize_url) { '/oauth/authorize' }
11
- let(:enterprise_token_url) { '/oauth/access_token' }
8
+ let(:enterprise_site) { 'https://some.other.site.com/api/v3' }
12
9
 
13
10
  let(:gitlab_service) { OmniAuth::Strategies::GitLab.new({}) }
14
11
  let(:enterprise) do
15
- OmniAuth::Strategies::GitLab.new('GITLAB_KEY', 'GITLAB_SECRET',
16
- client_options: {
17
- site: enterprise_site,
18
- authorize_url: enterprise_authorize_url,
19
- token_url: enterprise_token_url
20
- },
21
- redirect_url: 'http://localhost:9292/callback_url'
12
+ OmniAuth::Strategies::GitLab.new(
13
+ 'GITLAB_KEY',
14
+ 'GITLAB_SECRET',
15
+ client_options: { site: enterprise_site },
16
+ redirect_url: 'http://localhost:9292/callback_url'
22
17
  )
23
18
  end
24
19
 
@@ -32,17 +27,13 @@ describe OmniAuth::Strategies::GitLab do
32
27
  context 'with defaults' do
33
28
  subject { gitlab_service.options.client_options }
34
29
 
35
- its(:site) { is_expected.to eq 'https://gitlab.com' }
36
- its(:authorize_url) { is_expected.to eq '/oauth/authorize' }
37
- its(:token_url) { is_expected.to eq '/oauth/token' }
30
+ its(:site) { is_expected.to eq 'https://gitlab.com/api/v4' }
38
31
  end
39
32
 
40
33
  context 'with override' do
41
34
  subject { enterprise.options.client_options }
42
35
 
43
36
  its(:site) { is_expected.to eq enterprise_site }
44
- its(:authorize_url) { is_expected.to eq enterprise_authorize_url }
45
- its(:token_url) { is_expected.to eq enterprise_token_url }
46
37
  end
47
38
  end
48
39
 
@@ -60,7 +51,7 @@ describe OmniAuth::Strategies::GitLab do
60
51
 
61
52
  describe '#raw_info' do
62
53
  it 'sent request to current user endpoint' do
63
- expect(access_token).to receive(:get).with('/api/v3/user').and_return(response)
54
+ expect(access_token).to receive(:get).with('user').and_return(response)
64
55
  expect(subject.raw_info).to eq(parsed_response)
65
56
  end
66
57
  end
@@ -1,18 +1,8 @@
1
- $:.unshift File.expand_path('..', __FILE__)
2
- $:.unshift File.expand_path('../../lib', __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('..', __FILE__)
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
3
  require 'simplecov'
4
4
  SimpleCov.start
5
5
  require 'rspec'
6
6
  require 'rspec/its'
7
- require 'rack/test'
8
- require 'webmock/rspec'
9
7
  require 'omniauth'
10
8
  require 'omniauth-gitlab'
11
-
12
- RSpec.configure do |config|
13
- config.include WebMock::API
14
- config.include Rack::Test::Methods
15
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
16
- end
17
-
18
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - ssein
7
+ - Sergey Sein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-13 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rack-test
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: simplecov
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +80,6 @@ dependencies:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: webmock
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
83
  description: This is the strategy for authenticating to your GitLab service
112
84
  email:
113
85
  - linchus@gmail.com
@@ -147,11 +119,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
119
  version: '0'
148
120
  requirements: []
149
121
  rubyforge_project:
150
- rubygems_version: 2.2.2
122
+ rubygems_version: 2.5.2
151
123
  signing_key:
152
124
  specification_version: 4
153
125
  summary: This is the strategy for authenticating to your GitLab service
154
126
  test_files:
155
127
  - spec/omniauth/strategies/gitlab_spec.rb
156
128
  - spec/spec_helper.rb
157
- has_rdoc: