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 +4 -4
- data/README.md +4 -0
- data/lib/omniauth-gitlab/version.rb +1 -1
- data/lib/omniauth/strategies/gitlab.rb +5 -1
- data/omniauth-gitlab.gemspec +1 -0
- data/spec/omniauth/strategies/gitlab_spec.rb +14 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c597b6b76d64221a58a0a3667d0db7d3f4cda1e
|
4
|
+
data.tar.gz: 50572bf66940d26d090044206c53c3386bc550fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
@@ -24,11 +24,15 @@ module OmniAuth
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def raw_info
|
27
|
-
@raw_info ||= access_token.get(
|
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
|
data/omniauth-gitlab.gemspec
CHANGED
@@ -50,9 +50,20 @@ describe OmniAuth::Strategies::GitLab do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe '#raw_info' do
|
53
|
-
|
54
|
-
|
55
|
-
|
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.
|
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-
|
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
|