omniauth-gitlab 3.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f47d5dde46b9dc356bd1ec717ba0b7dc87b49e188b84dcf1617d366709f390f
4
- data.tar.gz: 6661be3cca493f7891e4663fead785e36639e121c4dde78b7b61de281dd3b08d
3
+ metadata.gz: c36f216de3933b8e782706e7fe0951a9df1d796df257ddc712398162245c9117
4
+ data.tar.gz: 45b8a3bfbb477ec3ec98f428bc582db73259528875e08ad38792b78ff23981e1
5
5
  SHA512:
6
- metadata.gz: 8c25c70c310391102a0c594ab09b1122e2ca4d8d761a631a7460e04ecce9120bdaa17bc29c3cd40cfbc17b62936c85973c8a10e63d1f6c37d6bbc268175ef33f
7
- data.tar.gz: 91165b4ffb9b274608f91a131c4514611536626384ed7ddcfe356bf4b0049bc8b4fb143b6cc159d974d1657a1e5f084d32b4985d215727c15d7d6f45ec12b449
6
+ metadata.gz: 66021915a9373712a724e8348bd6948bc0d3c31cd98afbbcdf6bd4b4f20a67a6c4344939e82475c6de8faca1abc1ea99e052f5bb9b85f342544f488d3418e632
7
+ data.tar.gz: c6d4db7f49f3eb046eb34d17509ee5beabf6ea7e6eb2096e41a5bccdaa3df58a8da37c6f5997a19b835eb08bc38d4d56bcbf280dc0aae7fcbf86975aee19b272
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby ${{ matrix.ruby-version }}
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby-version }}
18
+ bundler-cache: true # 'bundle install' and cache
19
+ - name: Run specs
20
+ run: |
21
+ bundle exec rspec
data/README.md CHANGED
@@ -34,7 +34,7 @@ Or install it yourself as:
34
34
  provider :gitlab, ENV['GITLAB_KEY'], ENV['GITLAB_SECRET'],
35
35
  {
36
36
  client_options: {
37
- site: 'https://gitlab.YOURDOMAIN.com/api/v4'
37
+ site: 'https://gitlab.YOURDOMAIN.com'
38
38
  }
39
39
  }
40
40
  end
@@ -4,7 +4,7 @@ require 'omniauth-oauth2'
4
4
  module OmniAuth
5
5
  module Strategies
6
6
  class GitLab < OmniAuth::Strategies::OAuth2
7
- option :client_options, site: 'https://gitlab.com/api/v4'
7
+ option :client_options, site: 'https://gitlab.com'
8
8
 
9
9
  option :redirect_url
10
10
 
@@ -24,13 +24,11 @@ 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('api/v4/user').parsed
28
28
  end
29
29
 
30
- private
31
-
32
30
  def callback_url
33
- options.redirect_url || (full_host + script_name + callback_path)
31
+ options.redirect_url || (full_host + callback_path)
34
32
  end
35
33
  end
36
34
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Gitlab
3
- VERSION = '3.0.0'
3
+ VERSION = '4.1.0'
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ['lib']
19
19
 
20
20
  gem.add_dependency 'omniauth', '~> 2.0'
21
- gem.add_dependency 'omniauth-oauth2', '~> 1.7.1'
21
+ gem.add_dependency 'omniauth-oauth2', '~> 1.8.0'
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'
@@ -5,7 +5,7 @@ describe OmniAuth::Strategies::GitLab do
5
5
  let(:parsed_response) { double('ParsedResponse') }
6
6
  let(:response) { double('Response', parsed: parsed_response) }
7
7
 
8
- let(:enterprise_site) { 'https://some.other.site.com/api/v3' }
8
+ let(:enterprise_site) { 'https://some.other.site.com' }
9
9
 
10
10
  let(:gitlab_service) { OmniAuth::Strategies::GitLab.new({}) }
11
11
  let(:enterprise) do
@@ -27,7 +27,7 @@ describe OmniAuth::Strategies::GitLab do
27
27
  context 'with defaults' do
28
28
  subject { gitlab_service.options.client_options }
29
29
 
30
- its(:site) { is_expected.to eq 'https://gitlab.com/api/v4' }
30
+ its(:site) { is_expected.to eq 'https://gitlab.com' }
31
31
  end
32
32
 
33
33
  context 'with override' do
@@ -51,8 +51,30 @@ describe OmniAuth::Strategies::GitLab do
51
51
 
52
52
  describe '#raw_info' do
53
53
  it 'sent request to current user endpoint' do
54
- expect(access_token).to receive(:get).with('user').and_return(response)
54
+ expect(access_token).to receive(:get).with('api/v4/user').and_return(response)
55
55
  expect(subject.raw_info).to eq(parsed_response)
56
56
  end
57
57
  end
58
+
59
+ describe '#callback_url' do
60
+ let(:base_url) { 'https://example.com' }
61
+
62
+ context 'no script name present' do
63
+ it 'has the correct default callback path' do
64
+ allow(subject).to receive(:full_host) { base_url }
65
+ allow(subject).to receive(:script_name) { '' }
66
+ allow(subject).to receive(:query_string) { '' }
67
+ expect(subject.callback_url).to eq(base_url + '/auth/gitlab/callback')
68
+ end
69
+ end
70
+
71
+ context 'script name' do
72
+ it 'should set the callback path with script_name' do
73
+ allow(subject).to receive(:full_host) { base_url }
74
+ allow(subject).to receive(:script_name) { '/v1' }
75
+ allow(subject).to receive(:query_string) { '' }
76
+ expect(subject.callback_url).to eq(base_url + '/v1/auth/gitlab/callback')
77
+ end
78
+ end
79
+ end
58
80
  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: 3.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Sein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-12 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.1
33
+ version: 1.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.7.1
40
+ version: 1.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +101,7 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".github/workflows/ruby.yml"
104
105
  - ".gitignore"
105
106
  - ".project"
106
107
  - ".rspec"
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  - !ruby/object:Gem::Version
133
134
  version: '0'
134
135
  requirements: []
135
- rubygems_version: 3.0.3
136
+ rubygems_version: 3.1.4
136
137
  signing_key:
137
138
  specification_version: 4
138
139
  summary: This is the strategy for authenticating to your GitLab service