googleauth 0.6.4 → 0.6.5

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: fc8d4e98f777414cf7bbe922d89f8c7965aa47c2451bb257553293525d194f9c
4
- data.tar.gz: 740529bdc238f8e43ae4375930f5945ab1b0e48670a58849506da63076255cfa
3
+ metadata.gz: 42b70d4d7a7f9a7f6260501866ff9568c0617c96930ecc5476af975c65b2927b
4
+ data.tar.gz: 8a4abb1767b3f2fb1257cc9dbbcf2bd47e0337c580ee01ddcbeb9cda9830b729
5
5
  SHA512:
6
- metadata.gz: 6d197b21416e10d28db7c20b1a92455e810c78d566297e1fdda6c836edeab9ea4fb5d7b918ed9e06969e4335d620ae9a1dae569da6a9beb20366ab4715aed57c
7
- data.tar.gz: 9f104ab9b08cf3568d668018173551142bd081fdfdc0b20f86490e4c60d41c01cf06ee85ea9478a924dc11e73f87dfeaf9668b1c230252465d72336c0dfc12e7
6
+ metadata.gz: 791422083e1cb0b97785d9dff1c7bff9d26d6d36154c29717e48a999611c7c6920b771f1e3febe8b4ce0479122aa3f6bdd22a421f3d19622ff21dec66971e725
7
+ data.tar.gz: f3da1e7b835fa67c9bc346ac69fbfdcf448ea756dae0a142be16a195e05b0c3884bbf947fa847bcb5f8d4d754db3a12b240f019288d79affa9654f272aa0e3ac
@@ -1,11 +1,12 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4
5
- - 2.3
6
- - 2.2
4
+ - 2.5.1
5
+ - 2.4.4
6
+ - 2.3.7
7
+ - 2.2.10
8
+ - 2.1.10
7
9
  - 2.0.0
8
- - 2.1
9
10
  - 1.9.3
10
11
  - rbx-2
11
12
  - jruby-9.1.9.0
@@ -1,3 +1,8 @@
1
+ ## 0.6.5 (2018/08/16)
2
+
3
+ * Fix incorrect http verb when revoking credentials.
4
+ * Warn on EOL ruby versions.
5
+
1
6
  ## 0.6.4 (2018/08/03)
2
7
 
3
8
  * Resolve issue where DefaultCredentials constant was undefined.
data/README.md CHANGED
@@ -10,7 +10,6 @@
10
10
  [![Gem Version](https://badge.fury.io/rb/googleauth.svg)](http://badge.fury.io/rb/googleauth)
11
11
  [![Build Status](https://secure.travis-ci.org/google/google-auth-library-ruby.svg)](http://travis-ci.org/google/google-auth-library-ruby)
12
12
  [![Coverage Status](https://coveralls.io/repos/google/google-auth-library-ruby/badge.svg)](https://coveralls.io/r/google/google-auth-library-ruby)
13
- [![Dependency Status](https://gemnasium.com/google/google-auth-library-ruby.svg)](https://gemnasium.com/google/google-auth-library-ruby)
14
13
 
15
14
  ## Description
16
15
 
@@ -163,6 +162,17 @@ access and refresh tokens. Two storage implementations are included:
163
162
  Custom storage implementations can also be used. See
164
163
  [token_store.rb](lib/googleauth/token_store.rb) for additional details.
165
164
 
165
+ ## Supported Ruby Versions
166
+
167
+ This library is currently supported on Ruby 1.9+.
168
+
169
+ However, Ruby 2.4 or later is strongly recommended, as earlier releases have
170
+ reached or are nearing end-of-life. After March 31, 2019, Google will provide
171
+ official support only for Ruby versions that are considered current and
172
+ supported by Ruby Core (that is, Ruby versions that are either in normal
173
+ maintenance or in security maintenance).
174
+ See https://www.ruby-lang.org/en/downloads/branches/ for further details.
175
+
166
176
  ## License
167
177
 
168
178
  This library is licensed under Apache 2.0. Full license text is
@@ -33,3 +33,75 @@ require 'googleauth/credentials'
33
33
  require 'googleauth/default_credentials'
34
34
  require 'googleauth/user_authorizer'
35
35
  require 'googleauth/web_user_authorizer'
36
+
37
+ module Google
38
+ # Module Auth provides classes that provide Google-specific authorization
39
+ # used to access Google APIs.
40
+ module Auth
41
+ # rubocop:disable MethodDefParentheses
42
+
43
+ # On March 31, 2019, set supported version to 2.4 and recommended to 2.6.
44
+ # Thereafter, follow the MRI support schedule: supported means non-EOL,
45
+ # and recommended means in normal (rather than security) maintenance.
46
+ # See https://www.ruby-lang.org/en/downloads/branches/
47
+ ##
48
+ # Minimum "supported" Ruby version (non-EOL)
49
+ # @private
50
+ #
51
+ SUPPORTED_VERSION_THRESHOLD = '1.9'.freeze
52
+ ##
53
+ # Minimum "recommended" Ruby version (normal maintenance)
54
+ # @private
55
+ #
56
+ RECOMMENDED_VERSION_THRESHOLD = '2.4'.freeze
57
+ ##
58
+ # Check Ruby version and emit a warning if it is old
59
+ # @private
60
+ #
61
+ def self.warn_on_old_ruby_version
62
+ return if ENV['GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS']
63
+ cur_version = Gem::Version.new RUBY_VERSION
64
+ if cur_version < Gem::Version.new(SUPPORTED_VERSION_THRESHOLD)
65
+ warn_unsupported_ruby cur_version, RECOMMENDED_VERSION_THRESHOLD
66
+ elsif cur_version < Gem::Version.new(RECOMMENDED_VERSION_THRESHOLD)
67
+ warn_nonrecommended_ruby cur_version, RECOMMENDED_VERSION_THRESHOLD
68
+ end
69
+ rescue ArgumentError
70
+ warn 'Unable to determine current Ruby version.'
71
+ end
72
+
73
+ ##
74
+ # Print a warning for an EOL version of Ruby
75
+ # @private
76
+ #
77
+ def self.warn_unsupported_ruby cur_version, recommended_version
78
+ warn "WARNING: You are running Ruby #{cur_version}, which has reached" \
79
+ ' end-of-life and is no longer supported by Ruby Core.'
80
+ warn 'The Google Cloud API clients work best on supported versions of' \
81
+ ' Ruby. It is strongly recommended that you upgrade to Ruby' \
82
+ " #{recommended_version} or later."
83
+ warn 'See https://www.ruby-lang.org/en/downloads/branches/ for more' \
84
+ ' info on the Ruby maintenance schedule.'
85
+ warn 'To suppress this message, set the' \
86
+ ' GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.'
87
+ end
88
+
89
+ ##
90
+ # Print a warning for a supported but nearing EOL version of Ruby
91
+ # @private
92
+ #
93
+ def self.warn_nonrecommended_ruby cur_version, recommended_version
94
+ warn "WARNING: You are running Ruby #{cur_version}, which is nearing" \
95
+ ' end-of-life.'
96
+ warn 'The Google Cloud API clients work best on supported versions of' \
97
+ " Ruby. Consider upgrading to Ruby #{recommended_version} or later."
98
+ warn 'See https://www.ruby-lang.org/en/downloads/branches/ for more' \
99
+ ' info on the Ruby maintenance schedule.'
100
+ warn 'To suppress this message, set the' \
101
+ ' GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.'
102
+ end
103
+ # rubocop:enable MethodDefParentheses
104
+ end
105
+ end
106
+
107
+ Google::Auth.warn_on_old_ruby_version
@@ -94,7 +94,7 @@ module Google
94
94
  c = options[:connection] || Faraday.default_connection
95
95
 
96
96
  retry_with_error do
97
- resp = c.get(REVOKE_TOKEN_URI, token: refresh_token || access_token)
97
+ resp = c.post(REVOKE_TOKEN_URI, token: refresh_token || access_token)
98
98
  case resp.status
99
99
  when 200
100
100
  self.access_token = nil
@@ -31,6 +31,6 @@ module Google
31
31
  # Module Auth provides classes that provide Google-specific authorization
32
32
  # used to access Google APIs.
33
33
  module Auth
34
- VERSION = '0.6.4'.freeze
34
+ VERSION = '0.6.5'.freeze
35
35
  end
36
36
  end
@@ -299,17 +299,17 @@ describe Google::Auth::UserAuthorizer do
299
299
 
300
300
  before(:example) do
301
301
  token_store.store('user1', token_json)
302
- stub_request(
303
- :get, 'https://oauth2.googleapis.com/revoke?token=refreshtoken'
304
- )
302
+ stub_request(:post, 'https://oauth2.googleapis.com/revoke')
303
+ .with(body: hash_including('token' => 'refreshtoken'))
305
304
  .to_return(status: 200)
306
305
  end
307
306
 
308
307
  it 'should revoke the grant' do
309
308
  authorizer.revoke_authorization('user1')
310
309
  expect(a_request(
311
- :get, 'https://oauth2.googleapis.com/revoke?token=refreshtoken'
312
- ))
310
+ :post, 'https://oauth2.googleapis.com/revoke'
311
+ ).with(body: hash_including('token' => 'refreshtoken'))
312
+ )
313
313
  .to have_been_made
314
314
  end
315
315
 
@@ -246,8 +246,8 @@ describe Google::Auth::UserRefreshCredentials do
246
246
 
247
247
  describe 'when revoking a refresh token' do
248
248
  let(:stub) do
249
- stub_request(:get, 'https://oauth2.googleapis.com/revoke' \
250
- '?token=refreshtoken')
249
+ stub_request(:post, 'https://oauth2.googleapis.com/revoke')
250
+ .with(body: hash_including('token' => 'refreshtoken'))
251
251
  .to_return(status: 200,
252
252
  headers: { 'Content-Type' => 'application/json' })
253
253
  end
@@ -262,8 +262,8 @@ describe Google::Auth::UserRefreshCredentials do
262
262
 
263
263
  describe 'when revoking an access token' do
264
264
  let(:stub) do
265
- stub_request(:get, 'https://oauth2.googleapis.com/revoke' \
266
- '?token=accesstoken')
265
+ stub_request(:post, 'https://oauth2.googleapis.com/revoke')
266
+ .with(body: hash_including('token' => 'accesstoken'))
267
267
  .to_return(status: 200,
268
268
  headers: { 'Content-Type' => 'application/json' })
269
269
  end
@@ -280,8 +280,8 @@ describe Google::Auth::UserRefreshCredentials do
280
280
 
281
281
  describe 'when revoking an invalid token' do
282
282
  let(:stub) do
283
- stub_request(:get, 'https://oauth2.googleapis.com/revoke' \
284
- '?token=refreshtoken')
283
+ stub_request(:post, 'https://oauth2.googleapis.com/revoke')
284
+ .with(body: hash_including('token' => 'refreshtoken'))
285
285
  .to_return(status: 400,
286
286
  headers: { 'Content-Type' => 'application/json' })
287
287
  end
@@ -296,14 +296,14 @@ describe Google::Auth::UserRefreshCredentials do
296
296
 
297
297
  describe 'when errors occurred with request' do
298
298
  it 'should fail with Signet::AuthorizationError if request times out' do
299
- allow_any_instance_of(Faraday::Connection).to receive(:get)
299
+ allow_any_instance_of(Faraday::Connection).to receive(:post)
300
300
  .and_raise(Faraday::TimeoutError)
301
301
  expect { @client.revoke! }
302
302
  .to raise_error Signet::AuthorizationError
303
303
  end
304
304
 
305
305
  it 'should fail with Signet::AuthorizationError if request fails' do
306
- allow_any_instance_of(Faraday::Connection).to receive(:get)
306
+ allow_any_instance_of(Faraday::Connection).to receive(:post)
307
307
  .and_raise(Faraday::ConnectionFailed, nil)
308
308
  expect { @client.revoke! }
309
309
  .to raise_error Signet::AuthorizationError
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googleauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Emiola
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-06 00:00:00.000000000 Z
11
+ date: 2018-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday