omniauth-google-oauth2 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -2
- data/CHANGELOG.md +16 -0
- data/examples/Gemfile +1 -0
- data/examples/config.ru +4 -5
- data/lib/omniauth/google_oauth2/version.rb +1 -1
- data/lib/omniauth/strategies/google_oauth2.rb +2 -3
- data/omniauth-google-oauth2.gemspec +4 -6
- data/spec/omniauth/strategies/google_oauth2_spec.rb +11 -5
- metadata +16 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b272ef7383811111988e246c36713b9cb05808ee
|
4
|
+
data.tar.gz: bcfc5288908b05a8b6b12694e1a5fffb423f3a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e8acd4f1a5936771232d7eb36f45bd94c652f2732827235d0c14e0d0cfd57db34a6fd0f9205838eecb922e8ca4a429c84fc5f21af971b119bc467a3de76313
|
7
|
+
data.tar.gz: 906640488bc922b90bb224027c2f748e40bd6ae5554ed49a5e63210bbdfeeda17d3e058e21e89ab4a0442468fcebb883afcdf29486b734b6be49003fba085928
|
data/.rubocop.yml
CHANGED
@@ -14,7 +14,10 @@ Metrics/MethodLength:
|
|
14
14
|
Enabled: false
|
15
15
|
Metrics/PerceivedComplexity:
|
16
16
|
Enabled: false
|
17
|
-
|
17
|
+
Naming:
|
18
18
|
Enabled: false
|
19
19
|
Style/MutableConstant:
|
20
|
-
Enabled: false
|
20
|
+
Enabled: false
|
21
|
+
Gemspec/RequiredRubyVersion:
|
22
|
+
Enabled: false
|
23
|
+
|
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
|
+
## 0.5.3 - 2018-01-25
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Added support for the JWT 2.x gem.
|
8
|
+
- Now fully qualifies the `JWT` class to prevent conflicts with the `Omniauth::JWT` strategy.
|
9
|
+
|
10
|
+
### Deprecated
|
11
|
+
- Nothing.
|
12
|
+
|
13
|
+
### Removed
|
14
|
+
- Removed the `multijson` dependency.
|
15
|
+
- Support for versions of `omniauth-oauth2` < 1.5.
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- Nothing.
|
19
|
+
|
4
20
|
## 0.5.2 - 2017-07-30
|
5
21
|
|
6
22
|
### Added
|
data/examples/Gemfile
CHANGED
data/examples/config.ru
CHANGED
@@ -85,7 +85,7 @@ class App < Sinatra::Base
|
|
85
85
|
content_type 'text/plain'
|
86
86
|
begin
|
87
87
|
request.env['omniauth.auth'].to_hash.inspect
|
88
|
-
rescue
|
88
|
+
rescue StandardError
|
89
89
|
'No Data'
|
90
90
|
end
|
91
91
|
end
|
@@ -94,7 +94,7 @@ class App < Sinatra::Base
|
|
94
94
|
content_type 'text/plain'
|
95
95
|
begin
|
96
96
|
request.env['omniauth.auth'].to_hash.inspect
|
97
|
-
rescue
|
97
|
+
rescue StandardError
|
98
98
|
'No Data'
|
99
99
|
end
|
100
100
|
end
|
@@ -103,7 +103,7 @@ class App < Sinatra::Base
|
|
103
103
|
content_type 'text/plain'
|
104
104
|
begin
|
105
105
|
request.env['omniauth.auth'].to_hash.inspect
|
106
|
-
rescue
|
106
|
+
rescue StandardError
|
107
107
|
'No Data'
|
108
108
|
end
|
109
109
|
end
|
@@ -114,8 +114,7 @@ use Rack::Session::Cookie, secret: ENV['RACK_COOKIE_SECRET']
|
|
114
114
|
use OmniAuth::Builder do
|
115
115
|
# For additional provider examples please look at 'omni_auth.rb'
|
116
116
|
# The key provider_ignores_state is only for AJAX flows. It is not recommended for normal logins.
|
117
|
-
|
118
|
-
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], verify_iss: false, access_type: 'offline', prompt: 'consent', provider_ignores_state: true, scope: 'email,profile,calendar'
|
117
|
+
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], access_type: 'offline', prompt: 'consent', provider_ignores_state: true, scope: 'email,profile,calendar'
|
119
118
|
end
|
120
119
|
|
121
120
|
run App.new
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'multi_json'
|
4
3
|
require 'jwt'
|
5
4
|
require 'omniauth/strategies/oauth2'
|
6
5
|
require 'uri'
|
@@ -60,7 +59,7 @@ module OmniAuth
|
|
60
59
|
hash = {}
|
61
60
|
hash[:id_token] = access_token['id_token']
|
62
61
|
if !options[:skip_jwt] && !access_token['id_token'].nil?
|
63
|
-
hash[:id_info] = JWT.decode(
|
62
|
+
hash[:id_info] = ::JWT.decode(
|
64
63
|
access_token['id_token'], nil, false, verify_iss: options.verify_iss,
|
65
64
|
iss: 'accounts.google.com',
|
66
65
|
verify_aud: true,
|
@@ -206,7 +205,7 @@ module OmniAuth
|
|
206
205
|
options.hd = options.hd.call if options.hd.is_a? Proc
|
207
206
|
allowed_hosted_domains = Array(options.hd)
|
208
207
|
|
209
|
-
raise CallbackError.new(:invalid_hd, 'Invalid Hosted Domain') unless allowed_hosted_domains.include?
|
208
|
+
raise CallbackError.new(:invalid_hd, 'Invalid Hosted Domain') unless allowed_hosted_domains.include?(@raw_info['hd']) || options.hd == '*'
|
210
209
|
true
|
211
210
|
end
|
212
211
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require File.expand_path(
|
@@ -19,14 +18,13 @@ Gem::Specification.new do |gem|
|
|
19
18
|
gem.files = `git ls-files`.split("\n")
|
20
19
|
gem.require_paths = ['lib']
|
21
20
|
|
22
|
-
gem.required_ruby_version = '>= 2.
|
21
|
+
gem.required_ruby_version = '>= 2.1'
|
23
22
|
|
23
|
+
gem.add_runtime_dependency 'jwt', '>= 1.5'
|
24
24
|
gem.add_runtime_dependency 'omniauth', '>= 1.1.1'
|
25
|
-
gem.add_runtime_dependency 'omniauth-oauth2', '>= 1.
|
26
|
-
gem.add_runtime_dependency 'jwt', '~> 1.5'
|
27
|
-
gem.add_runtime_dependency 'multi_json', '~> 1.3'
|
25
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '>= 1.5'
|
28
26
|
|
29
|
-
gem.add_development_dependency 'rspec', '~> 3.6'
|
30
27
|
gem.add_development_dependency 'rake', '~> 12.0'
|
28
|
+
gem.add_development_dependency 'rspec', '~> 3.6'
|
31
29
|
gem.add_development_dependency 'rubocop', '~> 0.49'
|
32
30
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
|
+
require 'json'
|
4
5
|
require 'omniauth-google-oauth2'
|
5
6
|
|
6
7
|
describe OmniAuth::Strategies::GoogleOauth2 do
|
@@ -123,6 +124,11 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
123
124
|
@options = { hd: nil }
|
124
125
|
expect(subject.authorize_params['hd']).to eq(nil)
|
125
126
|
end
|
127
|
+
|
128
|
+
it 'should set the hd parameter to * if set (only allows G Suite emails)' do
|
129
|
+
@options = { hd: '*' }
|
130
|
+
expect(subject.authorize_params['hd']).to eq('*')
|
131
|
+
end
|
126
132
|
end
|
127
133
|
|
128
134
|
describe 'login_hint' do
|
@@ -600,7 +606,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
600
606
|
builder.adapter :test do |stub|
|
601
607
|
stub.get('/oauth2/v3/tokeninfo?access_token=invalid_iss_token') do
|
602
608
|
[200, { 'Content-Type' => 'application/json; charset=UTF-8' },
|
603
|
-
|
609
|
+
JSON.dump(
|
604
610
|
aud: '000000000000.apps.googleusercontent.com',
|
605
611
|
sub: '123456789',
|
606
612
|
email_verified: 'true',
|
@@ -630,7 +636,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
630
636
|
builder.request :url_encoded
|
631
637
|
builder.adapter :test do |stub|
|
632
638
|
stub.get('/oauth2/v3/tokeninfo?access_token=valid_access_token') do
|
633
|
-
[200, { 'Content-Type' => 'application/json; charset=UTF-8' },
|
639
|
+
[200, { 'Content-Type' => 'application/json; charset=UTF-8' }, JSON.dump(
|
634
640
|
aud: '000000000000.apps.googleusercontent.com',
|
635
641
|
sub: '123456789',
|
636
642
|
email_verified: 'true',
|
@@ -641,7 +647,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
641
647
|
)]
|
642
648
|
end
|
643
649
|
stub.get('/oauth2/v3/tokeninfo?access_token=invalid_access_token') do
|
644
|
-
[400, { 'Content-Type' => 'application/json; charset=UTF-8' },
|
650
|
+
[400, { 'Content-Type' => 'application/json; charset=UTF-8' }, JSON.dump(error_description: 'Invalid Value')]
|
645
651
|
end
|
646
652
|
end
|
647
653
|
end
|
@@ -674,7 +680,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
674
680
|
builder.request :url_encoded
|
675
681
|
builder.adapter :test do |stub|
|
676
682
|
stub.get('/plus/v1/people/me/openIdConnect') do
|
677
|
-
[200, { 'Content-Type' => 'application/json; charset=UTF-8' },
|
683
|
+
[200, { 'Content-Type' => 'application/json; charset=UTF-8' }, JSON.dump(
|
678
684
|
hd: 'example.com'
|
679
685
|
)]
|
680
686
|
end
|
@@ -689,7 +695,7 @@ describe OmniAuth::Strategies::GoogleOauth2 do
|
|
689
695
|
builder.request :url_encoded
|
690
696
|
builder.adapter :test do |stub|
|
691
697
|
stub.get('/plus/v1/people/me/openIdConnect') do
|
692
|
-
[200, { 'Content-Type' => 'application/json; charset=UTF-8' },
|
698
|
+
[200, { 'Content-Type' => 'application/json; charset=UTF-8' }, JSON.dump({})]
|
693
699
|
end
|
694
700
|
end
|
695
701
|
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Ellithorpe
|
@@ -9,64 +9,64 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: jwt
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: '1.5'
|
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: 1.
|
27
|
+
version: '1.5'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: omniauth
|
29
|
+
name: omniauth
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.1.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: 1.1.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: omniauth-oauth2
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '1.5'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '1.5'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
63
|
-
type: :
|
62
|
+
version: '12.0'
|
63
|
+
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '12.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,20 +81,6 @@ dependencies:
|
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '3.6'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - "~>"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '12.0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '12.0'
|
98
84
|
- !ruby/object:Gem::Dependency
|
99
85
|
name: rubocop
|
100
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
133
|
requirements:
|
148
134
|
- - ">="
|
149
135
|
- !ruby/object:Gem::Version
|
150
|
-
version: '2.
|
136
|
+
version: '2.1'
|
151
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
138
|
requirements:
|
153
139
|
- - ">="
|