googleauth 1.0.0 → 1.1.2

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: f46ec9043835b66f2412c2bee7b285dfa5cbcdace1fab63e21ffb58cf7d0fb62
4
- data.tar.gz: 03fc18bca3d16f8aefdd8a52a73f6924439a6d1da14a888de46a628f174f943f
3
+ metadata.gz: 93cce260fe46995cee6a0db84a12f3c6a9a258df1ab6c0d960df32086edf0dd5
4
+ data.tar.gz: 879f77f346d359eaaa62da3469b164f2fd72be1c519fb7aa312b790b85c5a40c
5
5
  SHA512:
6
- metadata.gz: 54c04e72d1423b24fc7252a72c0e1efcdf15c3911479129ffe33c989471bf6eb0d222f348142911ca6938273df0d571dccd65ec38059ff599ce0de36301b53f1
7
- data.tar.gz: 538c2287ddaf524cb37f00d21069a2a87668a89da09c1939111c587aca87af328a9eee75ce9adacd66ac29e59bfbe387a442d01e400c9eca5e6e5f1fc30e8fe2
6
+ metadata.gz: 11aed69e62abd148b0fdb63e8187a15495be58e7b868c95f8e9f5fb6e4e81ee986114b0d5f60051b7bf28d5c0ba917d00b88003f7b7b82ee0758a1fe981ac28b
7
+ data.tar.gz: 87054824ae0e4264405b3155612370885f830dca1093ea957e10cc16dd59a56046af1fdcc61831e2aebd874bebb35d0507b056a6c874968398990f2a457dfd32
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Release History
2
2
 
3
+ ### [1.1.2](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v1.1.1...googleauth/v1.1.2) (2022-02-22)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Support Faraday 2 ([#365](https://www.github.com/googleapis/google-auth-library-ruby/issues/365)) ([9bbb88f](https://www.github.com/googleapis/google-auth-library-ruby/commit/9bbb88f825fe185f69d314ff6808524ce036acb6))
9
+
10
+ ### [1.1.1](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v1.1.0...googleauth/v1.1.1) (2022-02-14)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * add quota_project to user refresh credentials ([#361](https://www.github.com/googleapis/google-auth-library-ruby/issues/361)) ([0eb3c28](https://www.github.com/googleapis/google-auth-library-ruby/commit/0eb3c2850813c99c1100df6371c94ddef6e00b00))
16
+
17
+ ## [1.1.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v1.0.0...googleauth/v1.1.0) (2021-10-24)
18
+
19
+
20
+ ### Features
21
+
22
+ * Support short-lived tokens in Credentials ([9d7051c](https://www.github.com/googleapis/google-auth-library-ruby/commit/9d7051cff4d5e191a5d6756a068e8be539934f0d))
23
+
3
24
  ## [1.0.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v0.17.1...googleauth/v1.0.0) (2021-09-27)
4
25
 
5
26
  Bumped version to 1.0.0. Releases from this point will follow semver.
data/README.md CHANGED
@@ -116,6 +116,7 @@ token_store = Google::Auth::Stores::FileTokenStore.new(
116
116
  :file => '/path/to/tokens.yaml')
117
117
  authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)
118
118
 
119
+ user_id = ENV['USER']
119
120
  credentials = authorizer.get_credentials(user_id)
120
121
  if credentials.nil?
121
122
  url = authorizer.get_authorization_url(base_url: OOB_URI )
@@ -230,5 +231,5 @@ hesitate to
230
231
  about the client or APIs on [StackOverflow](http://stackoverflow.com).
231
232
 
232
233
  [application default credentials]: https://developers.google.com/accounts/docs/application-default-credentials
233
- [contributing]: https://github.com/googleapis/google-auth-library-ruby/tree/master/.github/CONTRIBUTING.md
234
- [license]: https://github.com/googleapis/google-auth-library-ruby/tree/master/LICENSE
234
+ [contributing]: https://github.com/googleapis/google-auth-library-ruby/tree/main/.github/CONTRIBUTING.md
235
+ [license]: https://github.com/googleapis/google-auth-library-ruby/tree/main/LICENSE
@@ -364,7 +364,7 @@ module Google
364
364
  end
365
365
  CredentialsLoader.warn_if_cloud_sdk_credentials @client.client_id
366
366
  @project_id ||= CredentialsLoader.load_gcloud_project_id
367
- @client.fetch_access_token!
367
+ @client.fetch_access_token! if @client.needs_access_token?
368
368
  @env_vars = nil
369
369
  @paths = nil
370
370
  @scope = nil
@@ -29,12 +29,21 @@ module Signet
29
29
  self
30
30
  end
31
31
 
32
+ # The token type as symbol, either :id_token or :access_token
33
+ def token_type
34
+ target_audience ? :id_token : :access_token
35
+ end
36
+
37
+ # Whether the id_token or access_token is missing or about to expire.
38
+ def needs_access_token?
39
+ send(token_type).nil? || expires_within?(60)
40
+ end
41
+
32
42
  # Updates a_hash updated with the authentication token
33
43
  def apply! a_hash, opts = {}
34
44
  # fetch the access token there is currently not one, or if the client
35
45
  # has expired
36
- token_type = target_audience ? :id_token : :access_token
37
- fetch_access_token! opts if send(token_type).nil? || expires_within?(60)
46
+ fetch_access_token! opts if needs_access_token?
38
47
  a_hash[AUTH_METADATA_KEY] = "Bearer #{send token_type}"
39
48
  end
40
49
 
@@ -36,6 +36,7 @@ module Google
36
36
  REVOKE_TOKEN_URI = "https://oauth2.googleapis.com/revoke".freeze
37
37
  extend CredentialsLoader
38
38
  attr_reader :project_id
39
+ attr_reader :quota_project_id
39
40
 
40
41
  # Create a UserRefreshCredentials.
41
42
  #
@@ -48,14 +49,15 @@ module Google
48
49
  "client_id" => ENV[CredentialsLoader::CLIENT_ID_VAR],
49
50
  "client_secret" => ENV[CredentialsLoader::CLIENT_SECRET_VAR],
50
51
  "refresh_token" => ENV[CredentialsLoader::REFRESH_TOKEN_VAR],
51
- "project_id" => ENV[CredentialsLoader::PROJECT_ID_VAR]
52
+ "project_id" => ENV[CredentialsLoader::PROJECT_ID_VAR],
53
+ "quota_project_id" => nil
52
54
  }
53
-
54
55
  new(token_credential_uri: TOKEN_CRED_URI,
55
56
  client_id: user_creds["client_id"],
56
57
  client_secret: user_creds["client_secret"],
57
58
  refresh_token: user_creds["refresh_token"],
58
59
  project_id: user_creds["project_id"],
60
+ quota_project_id: user_creds["quota_project_id"],
59
61
  scope: scope)
60
62
  .configure_connection(options)
61
63
  end
@@ -77,6 +79,7 @@ module Google
77
79
  options[:authorization_uri] ||= AUTHORIZATION_URI
78
80
  @project_id = options[:project_id]
79
81
  @project_id ||= CredentialsLoader.load_gcloud_project_id
82
+ @quota_project_id = options[:quota_project_id]
80
83
  super options
81
84
  end
82
85
 
@@ -16,6 +16,6 @@ module Google
16
16
  # Module Auth provides classes that provide Google-specific authorization
17
17
  # used to access Google APIs.
18
18
  module Auth
19
- VERSION = "1.0.0".freeze
19
+ VERSION = "1.1.2".freeze
20
20
  end
21
21
  end
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: 1.0.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Emiola
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2022-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.17.3
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.0'
22
+ version: 3.a
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.17.3
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
32
+ version: 3.a
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: jwt
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -159,7 +159,7 @@ homepage: https://github.com/googleapis/google-auth-library-ruby
159
159
  licenses:
160
160
  - Apache-2.0
161
161
  metadata:
162
- changelog_uri: https://github.com/googleapis/google-auth-library-ruby/blob/master/CHANGELOG.md
162
+ changelog_uri: https://github.com/googleapis/google-auth-library-ruby/blob/main/CHANGELOG.md
163
163
  source_code_uri: https://github.com/googleapis/google-auth-library-ruby
164
164
  bug_tracker_uri: https://github.com/googleapis/google-auth-library-ruby/issues
165
165
  post_install_message:
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.2.17
180
+ rubygems_version: 3.3.5
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Google Auth Library for Ruby