omniauth-google-oauth2 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e6a13824c53382f0ba9ef0738e26744d1881dc83726c57cf576ff208423a3a3
4
- data.tar.gz: 5c0c037b8c85418901d4ce360d5f4efb125f5c825ffec83ab71e50cf1b413e81
3
+ metadata.gz: a035e3c9635a9e588b756e9b2dfe2004ea1b83c49f9860d68e8250e7d93e4459
4
+ data.tar.gz: 20e8ba4d7f4b9fb20b139c8d4b9c51d8d1d598de1cada5d989640f01eee0df3a
5
5
  SHA512:
6
- metadata.gz: a62de5fa4553b5ae6c89811458cf8887017834a1790f4df4348ffae9c09a8172b407c04ea86f8c5030273b5586286580b0d2eae7d6857f62aee6729abf1549ff
7
- data.tar.gz: d74ef22fa65b892268a779e3e426610bea245db91519964bf03eadc5a5b5951bc42b29dcc2ab2a11c228610ea7dcf5173a2cc07d83569dcce6178e21dc6a160d
6
+ metadata.gz: 5b06e6a3ffd03ff81fe6e04bbc94c9154e26c59dc17a7c834361bf2fdd80197661434679e8174196f4dd8ed13e4b2b81ff4b223fb366238f48648ea452fcf1ce
7
+ data.tar.gz: 4734f0d6f92b57cebfccbbd0b833a7da9674d04e9058b76ef43d96cd94520a48bd540f57c9f804f6b16f2bad76483aefb3ef7357a99186acfc4dcb1603fa3a28
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '2.1.10'
4
3
  - '2.2.7'
5
4
  - '2.3.4'
6
5
  - '2.4.1'
@@ -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.8.0 - 2019-08-21
5
+
6
+ ### Added
7
+ - Updated omniauth-oauth2 to v1.6.0 for security fixes.
8
+
9
+ ### Deprecated
10
+ - Nothing.
11
+
12
+ ### Removed
13
+ - Ruby 2.1 support.
14
+
15
+ ### Fixed
16
+ - Nothing.
17
+
4
18
  ## 0.7.0 - 2019-06-03
5
19
 
6
20
  ### Added
data/README.md CHANGED
@@ -73,7 +73,7 @@ You can configure several options, which you pass in to the `provider` method vi
73
73
 
74
74
  * `hd`: (Optional) Limit sign-in to a particular Google Apps hosted domain. This can be simply string `'domain.com'` or an array `%w(domain.com domain.co)`. More information at: https://developers.google.com/accounts/docs/OpenIDConnect#hd-param
75
75
 
76
- * `jwt_leeway`: Number of seconds passed to the JWT library as leeway. Defaults to 60 seconds.
76
+ * `jwt_leeway`: Number of seconds passed to the JWT library as leeway. Defaults to 60 seconds. Note this only works if you use jwt 2.1, as the leeway option was removed in later versions.
77
77
 
78
78
  * `skip_jwt`: Skip JWT processing. This is for users who are seeing JWT decoding errors with the `iat` field. Always try adjusting the leeway before disabling JWT processing.
79
79
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'omniauth-google-oauth2', '~> 0.6.1'
5
+ gem 'omniauth-google-oauth2', '~> 0.8.0'
6
6
  gem 'rubocop'
7
7
  gem 'sinatra', '~> 1.4'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module GoogleOauth2
5
- VERSION = '0.7.0'
5
+ VERSION = '0.8.0'
6
6
  end
7
7
  end
@@ -94,6 +94,7 @@ module OmniAuth
94
94
  verify_hd(access_token)
95
95
  access_token
96
96
  end
97
+
97
98
  alias build_access_token custom_build_access_token
98
99
 
99
100
  private
@@ -103,14 +104,12 @@ module OmniAuth
103
104
  end
104
105
 
105
106
  def get_access_token(request)
106
- if request.xhr? && request.params['code']
107
- verifier = request.params['code']
108
- redirect_uri = request.params['redirect_uri'] || 'postmessage'
109
- client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
110
- elsif request.params['code'] && request.params['redirect_uri']
111
- verifier = request.params['code']
112
- redirect_uri = request.params['redirect_uri']
113
- client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
107
+ verifier = request.params['code']
108
+ redirect_uri = request.params['redirect_uri']
109
+ if verifier && request.xhr?
110
+ client_get_token(verifier, redirect_uri || 'postmessage')
111
+ elsif verifier
112
+ client_get_token(verifier, redirect_uri || callback_url)
114
113
  elsif verify_token(request.params['access_token'])
115
114
  ::OAuth2::AccessToken.from_hash(client, request.params.dup)
116
115
  elsif request.content_type =~ /json/i
@@ -118,19 +117,21 @@ module OmniAuth
118
117
  body = JSON.parse(request.body.read)
119
118
  request.body.rewind # rewind request body for downstream middlewares
120
119
  verifier = body && body['code']
121
- if verifier
122
- redirect_uri = 'postmessage'
123
- client.auth_code.get_token(verifier, get_token_options(redirect_uri), deep_symbolize(options.auth_token_params || {}))
124
- end
120
+ client_get_token(verifier, 'postmessage') if verifier
125
121
  rescue JSON::ParserError => e
126
122
  warn "[omniauth google-oauth2] JSON parse error=#{e}"
127
123
  end
128
- else
129
- verifier = request.params['code']
130
- client.auth_code.get_token(verifier, get_token_options(callback_url), deep_symbolize(options.auth_token_params))
131
124
  end
132
125
  end
133
126
 
127
+ def client_get_token(verifier, redirect_uri)
128
+ client.auth_code.get_token(verifier, get_token_options(redirect_uri), get_token_params)
129
+ end
130
+
131
+ def get_token_params
132
+ deep_symbolize(options.auth_token_params || {})
133
+ end
134
+
134
135
  def get_scope(params)
135
136
  raw_scope = params[:scope] || DEFAULT_SCOPE
136
137
  scope_list = raw_scope.split(' ').map { |item| item.split(',') }.flatten
@@ -142,7 +143,7 @@ module OmniAuth
142
143
  raw_info['email_verified'] ? raw_info['email'] : nil
143
144
  end
144
145
 
145
- def get_token_options(redirect_uri)
146
+ def get_token_options(redirect_uri = '')
146
147
  { redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true))
147
148
  end
148
149
 
@@ -18,11 +18,11 @@ 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.1'
21
+ gem.required_ruby_version = '>= 2.2'
22
22
 
23
23
  gem.add_runtime_dependency 'jwt', '>= 2.0'
24
24
  gem.add_runtime_dependency 'omniauth', '>= 1.1.1'
25
- gem.add_runtime_dependency 'omniauth-oauth2', '>= 1.5'
25
+ gem.add_runtime_dependency 'omniauth-oauth2', '>= 1.6'
26
26
 
27
27
  gem.add_development_dependency 'rake', '~> 12.0'
28
28
  gem.add_development_dependency 'rspec', '~> 3.6'
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.7.0
4
+ version: 0.8.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: 2019-06-03 00:00:00.000000000 Z
12
+ date: 2019-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jwt
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '1.5'
48
+ version: '1.6'
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
- version: '1.5'
55
+ version: '1.6'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -133,14 +133,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: '2.1'
136
+ version: '2.2'
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
139
  - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.0.3
143
+ rubyforge_project:
144
+ rubygems_version: 2.7.9
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: A Google OAuth2 strategy for OmniAuth 1.x