omniauth-google-oauth2 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +14 -0
- data/lib/omniauth/google_oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/google_oauth2.rb +5 -8
- data/spec/omniauth/strategies/google_oauth2_spec.rb +10 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ede9c8b2ed21745e5e2455baa4bffa9b080a5af
|
4
|
+
data.tar.gz: 5a7c985d8e1940b7cf07ab4dcf8025491ec69e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d52a2e108594667e40b2334d7d5fdf3624ca2390cb7099b663747586765dc0ee0ba7527578fd4db43e2b16d82a703701be07346eef148c32e2e2e7fdfa45bb8
|
7
|
+
data.tar.gz: 06ec6644022308248167bceea0ff590b6964b24dd548497610ac28a6bd5cad64b38948caa8ca21ca4cf5a94566bfb6b9f595c5311375461ecd8d005c4eb33c7f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 0.2.10 - 2015-11-05
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Nothing.
|
8
|
+
|
9
|
+
### Deprecated
|
10
|
+
- Nothing.
|
11
|
+
|
12
|
+
### Removed
|
13
|
+
- Removed some checks on the id_token. Now only parses the id_token in the JWT processing.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Nothing.
|
17
|
+
|
4
18
|
## 0.2.9 - 2015-10-29
|
5
19
|
|
6
20
|
### Added
|
@@ -97,7 +97,7 @@ module OmniAuth
|
|
97
97
|
verifier = request.params['code']
|
98
98
|
redirect_uri = request.params['redirect_uri']
|
99
99
|
client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
|
100
|
-
elsif verify_token(request.params['
|
100
|
+
elsif verify_token(request.params['access_token'])
|
101
101
|
::OAuth2::AccessToken.from_hash(client, request.params.dup)
|
102
102
|
else
|
103
103
|
orig_build_access_token
|
@@ -169,13 +169,10 @@ module OmniAuth
|
|
169
169
|
query_hash
|
170
170
|
end
|
171
171
|
|
172
|
-
def verify_token(
|
173
|
-
return false unless
|
174
|
-
|
175
|
-
|
176
|
-
:id_token => id_token,
|
177
|
-
:access_token => access_token
|
178
|
-
}).parsed
|
172
|
+
def verify_token(access_token)
|
173
|
+
return false unless access_token
|
174
|
+
raw_response = client.request(:get, 'https://www.googleapis.com/oauth2/v2/tokeninfo',
|
175
|
+
params: { access_token: access_token }).parsed
|
179
176
|
raw_response['issued_to'] == options.client_id
|
180
177
|
end
|
181
178
|
end
|
@@ -521,8 +521,8 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
521
521
|
|
522
522
|
it 'should read access_token from hash if this is not an AJAX request with a code parameter' do
|
523
523
|
allow(request).to receive(:xhr?).and_return(false)
|
524
|
-
allow(request).to receive(:params).and_return('
|
525
|
-
expect(subject).to receive(:verify_token).with('
|
524
|
+
allow(request).to receive(:params).and_return('access_token' => 'valid_access_token')
|
525
|
+
expect(subject).to receive(:verify_token).with('valid_access_token').and_return true
|
526
526
|
expect(subject).to receive(:client).and_return(:client)
|
527
527
|
|
528
528
|
token = subject.build_access_token
|
@@ -544,7 +544,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
544
544
|
subject.options.client_options[:connection_build] = proc do |builder|
|
545
545
|
builder.request :url_encoded
|
546
546
|
builder.adapter :test do |stub|
|
547
|
-
stub.get('/oauth2/v2/tokeninfo?
|
547
|
+
stub.get('/oauth2/v2/tokeninfo?access_token=valid_access_token') do |env|
|
548
548
|
[200, {'Content-Type' => 'application/json; charset=UTF-8'}, MultiJson.encode(
|
549
549
|
:issued_to => '000000000000.apps.googleusercontent.com',
|
550
550
|
:audience => '000000000000.apps.googleusercontent.com',
|
@@ -556,25 +556,25 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
556
556
|
:access_type => 'online'
|
557
557
|
)]
|
558
558
|
end
|
559
|
-
stub.get('/oauth2/v2/tokeninfo?
|
559
|
+
stub.get('/oauth2/v2/tokeninfo?access_token=invalid_access_token') do |env|
|
560
560
|
[400, {'Content-Type' => 'application/json; charset=UTF-8'}, MultiJson.encode(:error_description => 'Invalid Value')]
|
561
561
|
end
|
562
562
|
end
|
563
563
|
end
|
564
564
|
end
|
565
565
|
|
566
|
-
it 'should verify token if access_token
|
566
|
+
it 'should verify token if access_token is valid and app_id equals' do
|
567
567
|
subject.options.client_id = '000000000000.apps.googleusercontent.com'
|
568
|
-
expect(subject.send(:verify_token, '
|
568
|
+
expect(subject.send(:verify_token, 'valid_access_token')).to eq(true)
|
569
569
|
end
|
570
570
|
|
571
|
-
it 'should not verify token if access_token
|
572
|
-
expect(subject.send(:verify_token, '
|
571
|
+
it 'should not verify token if access_token is valid but app_id is false' do
|
572
|
+
expect(subject.send(:verify_token, 'valid_access_token')).to eq(false)
|
573
573
|
end
|
574
574
|
|
575
|
-
it 'should raise error if access_token
|
575
|
+
it 'should raise error if access_token is invalid' do
|
576
576
|
expect {
|
577
|
-
subject.send(:verify_token, '
|
577
|
+
subject.send(:verify_token, 'invalid_access_token')
|
578
578
|
}.to raise_error(OAuth2::Error)
|
579
579
|
end
|
580
580
|
end
|
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: 0.2.
|
4
|
+
version: 0.2.10
|
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: 2015-
|
12
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|