omniauth-google-oauth2 1.1.3 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/ci.yml +1 -1
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +30 -0
- data/README.md +3 -1
- data/examples/Gemfile +2 -2
- data/lib/omniauth/google_oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/google_oauth2.rb +17 -22
- data/omniauth-google-oauth2.gemspec +2 -2
- data/spec/omniauth/strategies/google_oauth2_spec.rb +93 -50
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb04de5f033f4c247c0cd004619d2e8cbb9f54b29a1861c5810d539608c278c0
|
4
|
+
data.tar.gz: a0a71c285455501e4904ea4c184db32298907be93f1def96d3a180ca60df9684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cd913d3979e3c3e9dd93f76ed40aeff42bc95a8841db4b4287e92d28a00fe85a4bbc14483b25478fbdde0552877617d4b32c57eb03c67472e43fd857c1e9180
|
7
|
+
data.tar.gz: '0078d9d52c2661b12895509ce17320818360aa968904742d45665158334af0a219064999cabe71e1af9ce93cddd45481b7aee263d729d582f99d088b68242905'
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: [zquestz]
|
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/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,36 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 1.2.1 - 2025-01-18
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Use jwt v2.9.2's public claims verification API - https://github.com/zquestz/omniauth-google-oauth2/pull/465
|
8
|
+
|
9
|
+
### Deprecated
|
10
|
+
- Nothing.
|
11
|
+
|
12
|
+
### Removed
|
13
|
+
- Support for jwt < 2.9.2.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Nothing.
|
17
|
+
|
18
|
+
## 1.2.0 - 2024-09-15
|
19
|
+
|
20
|
+
### Added
|
21
|
+
- jwt 2.9.0 support for their updated claims code.
|
22
|
+
|
23
|
+
### Deprecated
|
24
|
+
- Nothing.
|
25
|
+
|
26
|
+
### Removed
|
27
|
+
- Ruby 2.3 and 2.4 support.
|
28
|
+
- Support for jwt < 2.9.0.
|
29
|
+
|
30
|
+
### Fixed
|
31
|
+
- Fixed image sizing code.
|
32
|
+
- Rubocop configuration updates.
|
33
|
+
|
4
34
|
## 1.1.3 - 2024-08-29
|
5
35
|
|
6
36
|
### 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
|
|
@@ -195,7 +196,8 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
195
196
|
flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: 'Google'
|
196
197
|
sign_in_and_redirect @user, event: :authentication
|
197
198
|
else
|
198
|
-
|
199
|
+
# Useful for debugging login failures. Uncomment for development.
|
200
|
+
# session['devise.google_data'] = request.env['omniauth.auth'].except('extra') # Removing extra as it can overflow some session stores
|
199
201
|
redirect_to new_user_registration_url, alert: @user.errors.full_messages.join("\n")
|
200
202
|
end
|
201
203
|
end
|
data/examples/Gemfile
CHANGED
@@ -76,17 +76,11 @@ 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
|
-
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])
|
79
|
+
::JWT::Claims.verify_payload!(decoded,
|
80
|
+
iss: ALLOWED_ISSUERS,
|
81
|
+
aud: options.client_id,
|
82
|
+
exp: { leeway: options.jwt_leeway },
|
83
|
+
nbf: { leeway: options.jwt_leeway })
|
90
84
|
|
91
85
|
hash[:id_info] = decoded
|
92
86
|
end
|
@@ -178,17 +172,16 @@ module OmniAuth
|
|
178
172
|
def image_url
|
179
173
|
return nil unless raw_info['picture']
|
180
174
|
|
181
|
-
u = URI.parse(raw_info['picture']
|
175
|
+
u = URI.parse(raw_info['picture'])
|
182
176
|
|
183
|
-
|
177
|
+
md = u.path.to_s.match(/(.*)(=((w[0-9]*|h[0-9]*|s[0-9]*|c|p)-?)*)$/)
|
184
178
|
|
185
|
-
|
186
|
-
|
187
|
-
u.path = u.path.gsub('//', '/')
|
179
|
+
# Check for sizing, remove if present.
|
180
|
+
u.path = md[1] if md && !md[1].nil? && !md[2].nil?
|
188
181
|
|
189
|
-
|
190
|
-
|
191
|
-
u.path = u.path.
|
182
|
+
if image_size_opts_passed?
|
183
|
+
u.path += image_params
|
184
|
+
u.path = u.path.gsub('//', '/')
|
192
185
|
end
|
193
186
|
|
194
187
|
u.query = strip_unnecessary_query_parameters(u.query)
|
@@ -202,15 +195,17 @@ module OmniAuth
|
|
202
195
|
|
203
196
|
def image_params
|
204
197
|
image_params = []
|
205
|
-
|
198
|
+
case options[:image_size]
|
199
|
+
when Integer
|
206
200
|
image_params << "s#{options[:image_size]}"
|
207
|
-
|
201
|
+
when Hash
|
208
202
|
image_params << "w#{options[:image_size][:width]}" if options[:image_size][:width]
|
209
203
|
image_params << "h#{options[:image_size][:height]}" if options[:image_size][:height]
|
210
204
|
end
|
211
205
|
image_params << 'c' if options[:image_aspect_ratio] == 'square'
|
206
|
+
image_params << 'p' if options[:image_aspect_ratio] == 'smart'
|
212
207
|
|
213
|
-
|
208
|
+
"=#{image_params.join('-')}"
|
214
209
|
end
|
215
210
|
|
216
211
|
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.2'
|
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.1
|
4
|
+
version: 1.2.1
|
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:
|
12
|
+
date: 2025-01-19 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:
|
20
|
+
version: 2.9.2
|
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:
|
27
|
+
version: 2.9.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: oauth2
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,6 +117,7 @@ executables: []
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
+
- ".github/FUNDING.yml"
|
120
121
|
- ".github/workflows/ci.yml"
|
121
122
|
- ".gitignore"
|
122
123
|
- ".rubocop.yml"
|
@@ -147,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
148
|
requirements:
|
148
149
|
- - ">="
|
149
150
|
- !ruby/object:Gem::Version
|
150
|
-
version: '2.
|
151
|
+
version: '2.5'
|
151
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
153
|
requirements:
|
153
154
|
- - ">="
|