omniauth-google-oauth2 1.1.3 → 1.2.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 +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +16 -0
- data/README.md +1 -0
- data/examples/Gemfile +1 -1
- data/lib/omniauth/google_oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/google_oauth2.rb +23 -22
- data/omniauth-google-oauth2.gemspec +2 -2
- data/spec/omniauth/strategies/google_oauth2_spec.rb +93 -50
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45ce2b17155396ac41a875e3bcadfd9827cf45b30d2c64309992b84d3ef0088d
|
4
|
+
data.tar.gz: d9f9e89a3526a81b19a66a222b3534848c66914a34960500a6ed57fe23e40fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 543ac7161867df4ec9826c29ccebe89ae70348b3038095b747b2160f2988c2cdcfccb418d4afaaff6b564e8df4aafa5dd704f8632cbd755ef5d222b7a6e63697
|
7
|
+
data.tar.gz: 2585a702d4595b4986c6406fc8121e4f61ff4fc4558372fc689e28cc87ce21ba8a387b8999a2cc1c53bcfa96df6e68457777f493675c71a511f9e0d5adae12e6
|
data/.github/workflows/ci.yml
CHANGED
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby-version: ['2.
|
10
|
+
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2', truffleruby-head]
|
11
11
|
|
12
12
|
steps:
|
13
13
|
- uses: actions/checkout@v2
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 1.2.0 - 2024-09-15
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- jwt 2.9.0 support for their updated claims code.
|
8
|
+
|
9
|
+
### Deprecated
|
10
|
+
- Nothing.
|
11
|
+
|
12
|
+
### Removed
|
13
|
+
- Ruby 2.3 and 2.4 support.
|
14
|
+
- Support for jwt < 2.9.0.
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
- Fixed image sizing code.
|
18
|
+
- Rubocop configuration updates.
|
19
|
+
|
4
20
|
## 1.1.3 - 2024-08-29
|
5
21
|
|
6
22
|
### Added
|
data/README.md
CHANGED
@@ -64,6 +64,7 @@ You can configure several options, which you pass in to the `provider` method vi
|
|
64
64
|
* `image_aspect_ratio`: The shape of the user's profile picture. Possible values are:
|
65
65
|
* `original`: Picture maintains its original aspect ratio.
|
66
66
|
* `square`: Picture presents equal width and height.
|
67
|
+
* `smart`: Picture presents equal width and height with smart cropping.
|
67
68
|
|
68
69
|
Defaults to `original`.
|
69
70
|
|
data/examples/Gemfile
CHANGED
@@ -76,17 +76,17 @@ module OmniAuth
|
|
76
76
|
|
77
77
|
# We have to manually verify the claims because the third parameter to
|
78
78
|
# JWT.decode is false since no verification key is provided.
|
79
|
-
::JWT::
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
79
|
+
::JWT::Claims.verify!(decoded,
|
80
|
+
verify_iss: true,
|
81
|
+
iss: ALLOWED_ISSUERS,
|
82
|
+
verify_aud: true,
|
83
|
+
aud: options.client_id,
|
84
|
+
verify_sub: false,
|
85
|
+
verify_expiration: true,
|
86
|
+
verify_not_before: true,
|
87
|
+
verify_iat: false,
|
88
|
+
verify_jti: false,
|
89
|
+
leeway: options[:jwt_leeway])
|
90
90
|
|
91
91
|
hash[:id_info] = decoded
|
92
92
|
end
|
@@ -178,17 +178,16 @@ module OmniAuth
|
|
178
178
|
def image_url
|
179
179
|
return nil unless raw_info['picture']
|
180
180
|
|
181
|
-
u = URI.parse(raw_info['picture']
|
181
|
+
u = URI.parse(raw_info['picture'])
|
182
182
|
|
183
|
-
|
183
|
+
md = u.path.to_s.match(/(.*)(=((w[0-9]*|h[0-9]*|s[0-9]*|c|p)-?)*)$/)
|
184
184
|
|
185
|
-
|
186
|
-
|
187
|
-
u.path = u.path.gsub('//', '/')
|
185
|
+
# Check for sizing, remove if present.
|
186
|
+
u.path = md[1] if md && !md[1].nil? && !md[2].nil?
|
188
187
|
|
189
|
-
|
190
|
-
|
191
|
-
u.path = u.path.
|
188
|
+
if image_size_opts_passed?
|
189
|
+
u.path += image_params
|
190
|
+
u.path = u.path.gsub('//', '/')
|
192
191
|
end
|
193
192
|
|
194
193
|
u.query = strip_unnecessary_query_parameters(u.query)
|
@@ -202,15 +201,17 @@ module OmniAuth
|
|
202
201
|
|
203
202
|
def image_params
|
204
203
|
image_params = []
|
205
|
-
|
204
|
+
case options[:image_size]
|
205
|
+
when Integer
|
206
206
|
image_params << "s#{options[:image_size]}"
|
207
|
-
|
207
|
+
when Hash
|
208
208
|
image_params << "w#{options[:image_size][:width]}" if options[:image_size][:width]
|
209
209
|
image_params << "h#{options[:image_size][:height]}" if options[:image_size][:height]
|
210
210
|
end
|
211
211
|
image_params << 'c' if options[:image_aspect_ratio] == 'square'
|
212
|
+
image_params << 'p' if options[:image_aspect_ratio] == 'smart'
|
212
213
|
|
213
|
-
|
214
|
+
"=#{image_params.join('-')}"
|
214
215
|
end
|
215
216
|
|
216
217
|
def strip_unnecessary_query_parameters(query_parameters)
|
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.files = `git ls-files`.split("\n")
|
19
19
|
gem.require_paths = ['lib']
|
20
20
|
|
21
|
-
gem.required_ruby_version = '>= 2.
|
21
|
+
gem.required_ruby_version = '>= 2.5'
|
22
22
|
|
23
|
-
gem.add_runtime_dependency 'jwt', '>= 2.
|
23
|
+
gem.add_runtime_dependency 'jwt', '>= 2.9'
|
24
24
|
gem.add_runtime_dependency 'oauth2', '~> 2.0'
|
25
25
|
gem.add_runtime_dependency 'omniauth', '~> 2.0'
|
26
26
|
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.8'
|
@@ -324,20 +324,20 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
324
324
|
it 'has the correct default callback path' do
|
325
325
|
allow(subject).to receive(:full_host) { base_url }
|
326
326
|
allow(subject).to receive(:script_name) { '' }
|
327
|
-
expect(subject.send(:callback_url)).to eq(base_url
|
327
|
+
expect(subject.send(:callback_url)).to eq("#{base_url}/auth/google_oauth2/callback")
|
328
328
|
end
|
329
329
|
|
330
330
|
it 'should set the callback path with script_name if present' do
|
331
331
|
allow(subject).to receive(:full_host) { base_url }
|
332
332
|
allow(subject).to receive(:script_name) { '/v1' }
|
333
|
-
expect(subject.send(:callback_url)).to eq(base_url
|
333
|
+
expect(subject.send(:callback_url)).to eq("#{base_url}/v1/auth/google_oauth2/callback")
|
334
334
|
end
|
335
335
|
|
336
336
|
it 'should set the callback_path parameter if present' do
|
337
337
|
@options = { callback_path: '/auth/foo/callback' }
|
338
338
|
allow(subject).to receive(:full_host) { base_url }
|
339
339
|
allow(subject).to receive(:script_name) { '' }
|
340
|
-
expect(subject.send(:callback_url)).to eq(base_url
|
340
|
+
expect(subject.send(:callback_url)).to eq("#{base_url}/auth/foo/callback")
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
@@ -544,103 +544,146 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
544
544
|
describe 'when a picture is returned from google' do
|
545
545
|
it 'should return the image with size specified in the `image_size` option' do
|
546
546
|
@options = { image_size: 50 }
|
547
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
548
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
547
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
548
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50')
|
549
549
|
end
|
550
550
|
|
551
551
|
it 'should return the image with size specified in the `image_size` option when sizing is in the picture' do
|
552
552
|
@options = { image_size: 50 }
|
553
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://
|
554
|
-
expect(subject.info[:image]).to eq('https://
|
553
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s96' } }
|
554
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50')
|
555
555
|
end
|
556
556
|
|
557
|
-
it 'should
|
557
|
+
it 'should return the image with size specified in the `image_size` option when sizing is in the picture and cropped' do
|
558
558
|
@options = { image_size: 50 }
|
559
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
560
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
559
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s96-c' } }
|
560
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50')
|
561
561
|
end
|
562
562
|
|
563
|
-
it 'should handle a picture with
|
563
|
+
it 'should handle a picture with too many slashes' do
|
564
564
|
@options = { image_size: 50 }
|
565
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
566
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
565
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a//ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
566
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50')
|
567
|
+
end
|
568
|
+
|
569
|
+
it 'should handle a picture with a size query parameter' do
|
570
|
+
@options = { image_size: 50 }
|
571
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0?sz=96' } }
|
572
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50')
|
573
|
+
end
|
574
|
+
|
575
|
+
it 'should handle a picture with a size query parameter and sizing is in the picture' do
|
576
|
+
@options = { image_size: 50 }
|
577
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s96-c?sz=96' } }
|
578
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50')
|
567
579
|
end
|
568
580
|
|
569
581
|
it 'should handle a picture with a size query parameter and other valid query parameters correctly' do
|
570
582
|
@options = { image_size: 50 }
|
571
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
572
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
583
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0?sz=50&hello=true&life=42' } }
|
584
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50?hello=true&life=42')
|
585
|
+
end
|
586
|
+
|
587
|
+
it 'should handle a picture with a size query parameter, other valid query parameters and sizing is in the picture correctly' do
|
588
|
+
@options = { image_size: 50 }
|
589
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s96-c?sz=50&hello=true&life=42' } }
|
590
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50?hello=true&life=42')
|
573
591
|
end
|
574
592
|
|
575
593
|
it 'should handle a picture with other valid query parameters correctly' do
|
576
594
|
@options = { image_size: 50 }
|
577
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
578
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
595
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0?hello=true&life=42' } }
|
596
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50?hello=true&life=42')
|
579
597
|
end
|
580
598
|
|
581
599
|
it 'should return the image with width and height specified in the `image_size` option' do
|
582
600
|
@options = { image_size: { width: 50, height: 40 } }
|
583
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
584
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
601
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
602
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w50-h40')
|
585
603
|
end
|
586
604
|
|
587
605
|
it 'should return the image with width and height specified in the `image_size` option when sizing is in the picture' do
|
588
606
|
@options = { image_size: { width: 50, height: 40 } }
|
589
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
590
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
607
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w100-h80-c' } }
|
608
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w50-h40')
|
591
609
|
end
|
592
610
|
|
593
|
-
it 'should return square image when `image_aspect_ratio` is specified' do
|
611
|
+
it 'should return square image when square `image_aspect_ratio` is specified' do
|
594
612
|
@options = { image_aspect_ratio: 'square' }
|
595
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
596
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
613
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
614
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=c')
|
597
615
|
end
|
598
616
|
|
599
|
-
it 'should return square image when `image_aspect_ratio` is specified and sizing is in the picture' do
|
617
|
+
it 'should return square image when square `image_aspect_ratio` is specified and sizing is in the picture' do
|
600
618
|
@options = { image_aspect_ratio: 'square' }
|
601
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
602
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
619
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50-c' } }
|
620
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=c')
|
621
|
+
end
|
622
|
+
|
623
|
+
it 'should return smart image when smart `image_aspect_ratio` is specified' do
|
624
|
+
@options = { image_aspect_ratio: 'smart' }
|
625
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
626
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=p')
|
603
627
|
end
|
604
628
|
|
605
|
-
it 'should return
|
629
|
+
it 'should return smart image when smart `image_aspect_ratio` is specified and sizing is in the picture' do
|
630
|
+
@options = { image_aspect_ratio: 'smart' }
|
631
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50-c' } }
|
632
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=p')
|
633
|
+
end
|
634
|
+
|
635
|
+
it 'should return square sized image when square `image_aspect_ratio` and `image_size` is set' do
|
606
636
|
@options = { image_aspect_ratio: 'square', image_size: 50 }
|
607
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
608
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
637
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
638
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50-c')
|
609
639
|
end
|
610
640
|
|
611
|
-
it 'should return square sized image when `image_aspect_ratio` and `image_size` is set and sizing is in the picture' do
|
641
|
+
it 'should return square sized image when square `image_aspect_ratio` and `image_size` is set and sizing is in the picture' do
|
612
642
|
@options = { image_aspect_ratio: 'square', image_size: 50 }
|
613
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
614
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
643
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s90' } }
|
644
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50-c')
|
645
|
+
end
|
646
|
+
|
647
|
+
it 'should return smart sized image when smart `image_aspect_ratio` and `image_size` is set' do
|
648
|
+
@options = { image_aspect_ratio: 'smart', image_size: 50 }
|
649
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
650
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50-p')
|
651
|
+
end
|
652
|
+
|
653
|
+
it 'should return smart sized image when smart `image_aspect_ratio` and `image_size` is set and sizing is in the picture' do
|
654
|
+
@options = { image_aspect_ratio: 'smart', image_size: 50 }
|
655
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s90' } }
|
656
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=s50-p')
|
615
657
|
end
|
616
658
|
|
617
|
-
it 'should return square sized image when `image_aspect_ratio` and `image_size` has height and width' do
|
659
|
+
it 'should return square sized image when square `image_aspect_ratio` and `image_size` has height and width' do
|
618
660
|
@options = { image_aspect_ratio: 'square', image_size: { width: 50, height: 40 } }
|
619
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
620
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
661
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
662
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w50-h40-c')
|
621
663
|
end
|
622
664
|
|
623
|
-
it 'should return square sized image when `image_aspect_ratio` and `image_size` has height and width and sizing is in the picture' do
|
665
|
+
it 'should return square sized image when square `image_aspect_ratio` and `image_size` has height and width and sizing is in the picture' do
|
624
666
|
@options = { image_aspect_ratio: 'square', image_size: { width: 50, height: 40 } }
|
625
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
626
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
667
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w100-h80-c' } }
|
668
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w50-h40-c')
|
627
669
|
end
|
628
670
|
|
629
|
-
it 'should return
|
630
|
-
@options = { image_size: 50 }
|
631
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/
|
632
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
671
|
+
it 'should return smart sized image when smart `image_aspect_ratio` and `image_size` has height and width' do
|
672
|
+
@options = { image_aspect_ratio: 'smart', image_size: { width: 50, height: 40 } }
|
673
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
674
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w50-h40-p')
|
633
675
|
end
|
634
|
-
end
|
635
676
|
|
636
|
-
|
637
|
-
|
638
|
-
|
677
|
+
it 'should return smart sized image when smart `image_aspect_ratio` and `image_size` has height and width and sizing is in the picture' do
|
678
|
+
@options = { image_aspect_ratio: 'smart', image_size: { width: 50, height: 40 } }
|
679
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w100-h80-c' } }
|
680
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0=w50-h40-p')
|
681
|
+
end
|
639
682
|
end
|
640
683
|
|
641
|
-
it 'should return
|
642
|
-
allow(subject).to receive(:raw_info) { { 'picture' => 'https
|
643
|
-
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/
|
684
|
+
it 'should return original image if no options are provided' do
|
685
|
+
allow(subject).to receive(:raw_info) { { 'picture' => 'https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0' } }
|
686
|
+
expect(subject.info[:image]).to eq('https://lh3.googleusercontent.com/a/ACg8ocKN8F32STvmW-LG0Rl_9re5-Pv2cCn0ayodas6BQFPGEArMOtn0')
|
644
687
|
end
|
645
688
|
end
|
646
689
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-google-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Ellithorpe
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jwt
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '2.
|
20
|
+
version: '2.9'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '2.
|
27
|
+
version: '2.9'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: oauth2
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
147
|
requirements:
|
148
148
|
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '2.
|
150
|
+
version: '2.5'
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
153
|
- - ">="
|