omniauth-gitlab 1.0.3 → 1.0.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
  SHA1:
3
- metadata.gz: '09a621d84d0ca9c607f349887115c8c243689f8a'
4
- data.tar.gz: 9033ecc6420c9821bdd09ae446773d65b266e141
3
+ metadata.gz: 7c597b6b76d64221a58a0a3667d0db7d3f4cda1e
4
+ data.tar.gz: 50572bf66940d26d090044206c53c3386bc550fc
5
5
  SHA512:
6
- metadata.gz: a92f292b33ac370abe67821c10f97aaeb2bd026c2e39cfac74bb740cad9da670d2cdfe1a128d7ee1f560d59b0f798d66637b896eca18511c9957e8b539ebe434
7
- data.tar.gz: a20742007b746b20406f8dbcf52775ccdab7618505b7c7f3835eb697df520c2639fdfbbd1f7a8dba2d66e6865a2527142bc577106eed24e8f43527aec0a74589
6
+ metadata.gz: 93f9e5652960989210433e6b59837106ca1d853ea6559acede43d72ce99061dec9ffbae13897c9b3abea26ba82d7bd28a18f281232c7d7d2da292f57af651ad6
7
+ data.tar.gz: 889483d8c773d67728714831abaa13d0228feafd88bbcdc2155de0cd643f54ea7e415ef7e6e21f4d9adeeb8b6ad21d0c73dbf3dbab84e382a6320a0032484eda
data/README.md CHANGED
@@ -41,10 +41,14 @@ Or install it yourself as:
41
41
 
42
42
  ## Custom scopes
43
43
 
44
+ By default, the `api` scope is requested and must be allowed in GitLab's application configuration. To use different scopes:
45
+
44
46
  use OmniAuth::Builder do
45
47
  provider :gitlab, ENV['GITLAB_KEY'], ENV['GITLAB_SECRET'], scope: 'read_user openid'
46
48
  end
47
49
 
50
+ Requesting a scope that is not configured will result the error "The requested scope is invalid, unknown, or malformed.".
51
+
48
52
  ## Old API version
49
53
 
50
54
  API V3 will be unsupported from GitLab 9.5 and will be removed in GitLab 9.5 or later.
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Gitlab
3
- VERSION = '1.0.3'
3
+ VERSION = '1.0.4'
4
4
  end
5
5
  end
@@ -24,11 +24,15 @@ module OmniAuth
24
24
  end
25
25
 
26
26
  def raw_info
27
- @raw_info ||= access_token.get('user').parsed
27
+ @raw_info ||= access_token.get(user_endpoint_url).parsed
28
28
  end
29
29
 
30
30
  private
31
31
 
32
+ def user_endpoint_url
33
+ options.client_options.site.match(%r{v(\d+)/?$}) ? 'user' : '/api/v3/user'
34
+ end
35
+
32
36
  def callback_url
33
37
  options.redirect_url || (full_host + script_name + callback_path)
34
38
  end
@@ -22,4 +22,5 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency 'rspec', '~> 3.1'
23
23
  gem.add_development_dependency 'rspec-its', '~> 1.0'
24
24
  gem.add_development_dependency 'simplecov'
25
+ gem.add_development_dependency 'rake', '>= 12.0'
25
26
  end
@@ -50,9 +50,20 @@ describe OmniAuth::Strategies::GitLab do
50
50
  end
51
51
 
52
52
  describe '#raw_info' do
53
- it 'sent request to current user endpoint' do
54
- expect(access_token).to receive(:get).with('user').and_return(response)
55
- expect(subject.raw_info).to eq(parsed_response)
53
+ context 'with new configuration' do
54
+ it 'sent request to current user endpoint' do
55
+ expect(access_token).to receive(:get).with('user').and_return(response)
56
+ expect(subject.raw_info).to eq(parsed_response)
57
+ end
58
+ end
59
+
60
+ context 'with old style configuration' do
61
+ let(:enterprise_site) { 'https://some.other.site.com/' }
62
+ subject { enterprise }
63
+ it 'sent request to current user endpoint' do
64
+ expect(access_token).to receive(:get).with('/api/v3/user').and_return(response)
65
+ expect(subject.raw_info).to eq(parsed_response)
66
+ end
56
67
  end
57
68
  end
58
69
  end
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Sein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-10 00:00:00.000000000 Z
11
+ date: 2018-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '12.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '12.0'
83
97
  description: This is the strategy for authenticating to your GitLab service
84
98
  email:
85
99
  - linchus@gmail.com