googleauth 1.1.0 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 286a365510084cc4410a7fb76cc6ee21be59372e57c1ef475f14c232cd883c54
4
- data.tar.gz: 413babe33567dfc2d5f2f12df1b3c344c497bea78e32b311ba025e26ebce9314
3
+ metadata.gz: 967a6321e1ec2dafec23915f77028196ca588d1b0cd7d40c0824d918d4001298
4
+ data.tar.gz: b85411d05c86ccc52727047c74d82dc30e16df41f374ac6f64d760776be923fc
5
5
  SHA512:
6
- metadata.gz: 9d478df9ef5cdf0ff86a281b9410c2b33756be34734c06ce858fda704297ae97607b7d254803bcd8f18290a7d6e32cc26b78ea3e7bb1dc0308fcc1faabd35fdf
7
- data.tar.gz: d153a275309125418cafdfd3f222f3c09c5f0b873056c4eb95e676f492cb59b214b28a680b375b76cf4b2bf3560263311cea700c37df14632f9418c774ca9372
6
+ metadata.gz: d858caa697993c8c8336e2b15a5a8e1bf21d939678513874426207e7002a052d82f0ed2020ed7cef54ec14e97aca0e2ce23ff8442cd346d72ea45d4975d4373d
7
+ data.tar.gz: fda398a2576f28e0dff7196e46ce0d51e4e73b4db4f4f59d10e3e2fd124913cc0af2533428bd0a8a8b83f7b6b334757540b556b1160c9adf8dbc6dd9dab827c6
data/CHANGELOG.md CHANGED
@@ -1,76 +1,92 @@
1
1
  # Release History
2
2
 
3
- ## [1.1.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v1.0.0...googleauth/v1.1.0) (2021-10-24)
3
+ ### 1.1.3 (2022-04-20)
4
4
 
5
+ #### Documentation
5
6
 
6
- ### Features
7
+ * Add README instructions for 3-Legged OAuth with a service account
7
8
 
8
- * Support short-lived tokens in Credentials ([9d7051c](https://www.github.com/googleapis/google-auth-library-ruby/commit/9d7051cff4d5e191a5d6756a068e8be539934f0d))
9
+ ### 1.1.2 (2022-02-22)
9
10
 
10
- ## [1.0.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v0.17.1...googleauth/v1.0.0) (2021-09-27)
11
+ #### Bug Fixes
11
12
 
12
- Bumped version to 1.0.0. Releases from this point will follow semver.
13
+ * Support Faraday 2
14
+
15
+ ### 1.1.1 (2022-02-14)
16
+
17
+ #### Bug Fixes
18
+
19
+ * add quota_project to user refresh credentials
13
20
 
14
- * Allow dependency on future 1.x versions of signet ([9e17a24](https://www.github.com/googleapis/google-auth-library-ruby/commit/9e17a24bf97cb52f09756c624b4dc6e18dc79493))
15
- * Prevented gcloud from authenticating on the console when getting the gcloud project ([9902503](https://www.github.com/googleapis/google-auth-library-ruby/commit/990250345d6af31de1066c08c0b3b42692ae263c))
21
+ ### 1.1.0 (2021-10-24)
16
22
 
17
- ## [0.17.1](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v0.15.0...googleauth/v0.17.1) (2021-09-01)
23
+ #### Features
18
24
 
19
- * Updates to gem metadata ([fb5e56d](https://www.github.com/googleapis/google-auth-library-ruby/commit/fb5e56dad1e6ed6afd4f9b5c626e5e1495e48343))
25
+ * Support short-lived tokens in Credentials
26
+
27
+ ### 1.0.0 (2021-09-27)
28
+
29
+ Bumped version to 1.0.0. Releases from this point will follow semver.
20
30
 
21
- ## [0.17.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/google-auth-library-ruby/v0.16.2...google-auth-library-ruby/v0.17.0) (2021-07-30)
31
+ * Allow dependency on future 1.x versions of signet
32
+ * Prevented gcloud from authenticating on the console when getting the gcloud project
22
33
 
23
- * Allow scopes to be self-signed into jwts ([e67ce40](https://www.github.com/googleapis/google-auth-library-ruby/commit/e67ce40f919b7eb3723c2ec95f5b8d58315ab1ee))
34
+ ### 0.17.1 (2021-09-01)
24
35
 
25
- ## [0.16.2](https://www.github.com/googleapis/google-auth-library-ruby/compare/google-auth-library-ruby/v0.16.1...google-auth-library-ruby/v0.16.2) (2021-04-28)
36
+ * Updates to gem metadata
26
37
 
27
- * Stop attempting to get the project from gcloud when applying self-signed JWTs ([#317](https://www.github.com/googleapis/google-auth-library-ruby/issues/317)) ([39258ca](https://www.github.com/googleapis/google-auth-library-ruby/commit/39258cacafa5c770fb40d99075a97b8e6427adba))
38
+ ### 0.17.0 (2021-07-30)
28
39
 
29
- ## [0.16.1](https://www.github.com/googleapis/google-auth-library-ruby/compare/google-auth-library-ruby/v0.16.0...google-auth-library-ruby/v0.16.1) (2021-04-01)
40
+ * Allow scopes to be self-signed into jwts
30
41
 
31
- * Accept application/text content-type for plain idtoken response ([4948ebb](https://www.github.com/googleapis/google-auth-library-ruby/commit/4948ebb3ca151e9f0433585a41bad6f415416b2d))
42
+ ### 0.16.2 (2021-04-28)
32
43
 
33
- ## [0.16.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/v0.15.1...v0.16.0) (2021-03-04)
44
+ * Stop attempting to get the project from gcloud when applying self-signed JWTs
34
45
 
35
- * Drop support for Ruby 2.4 and add support for Ruby 3.0 ([6644806](https://www.github.com/googleapis/google-auth-library-ruby/commit/6644806ab47cea6d08e1901c2ed808e53a579bc3))
46
+ ### 0.16.1 (2021-04-01)
36
47
 
37
- ## [0.15.1](https://www.github.com/googleapis/google-auth-library-ruby/compare/v0.15.0...v0.15.1) (2021-02-08)
48
+ * Accept application/text content-type for plain idtoken response
38
49
 
39
- * Fix crash when using a client credential without any paths or env_vars set ([#296](https://www.github.com/googleapis/google-auth-library-ruby/issues/296)) ([c971c1a](https://www.github.com/googleapis/google-auth-library-ruby/commit/c971c1ad2d7730c0f5b389d533a972be32fbaf49))
50
+ ### 0.16.0 (2021-03-04)
40
51
 
41
- ## [0.15.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/v0.14.0...v0.15.0) (2021-01-26)
52
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
42
53
 
43
- * Credential parameters inherit from superclasses ([4fa4720](https://www.github.com/googleapis/google-auth-library-ruby/commit/4fa47206dbd62f8bbdd1b9d3721f6baee9fd1d62))
44
- * Service accounts apply a self-signed JWT if scopes are marked as default ([d22acb8](https://www.github.com/googleapis/google-auth-library-ruby/commit/d22acb8a510e6711b5674545c31a4816e5a9168f))
54
+ ### 0.15.1 (2021-02-08)
45
55
 
46
- * Retry fetch_access_token when GCE metadata server returns unexpected errors ([cd9b012](https://www.github.com/googleapis/google-auth-library-ruby/commit/cd9b0126d3419b9953982f71edc9e6ba3f640e3c))
47
- * Support correct service account and user refresh behavior for custom credential env variables ([d2dffe5](https://www.github.com/googleapis/google-auth-library-ruby/commit/d2dffe592112b45006291ad9a57f56e00fb208c3))
56
+ * Fix crash when using a client credential without any paths or env_vars set
48
57
 
49
- ## 0.14.0 / 2020-10-09
58
+ ### 0.15.0 (2021-01-26)
59
+
60
+ * Credential parameters inherit from superclasses
61
+ * Service accounts apply a self-signed JWT if scopes are marked as default
62
+ * Retry fetch_access_token when GCE metadata server returns unexpected errors
63
+ * Support correct service account and user refresh behavior for custom credential env variables
64
+
65
+ ### 0.14.0 / 2020-10-09
50
66
 
51
67
  * Honor GCE_METADATA_HOST environment variable
52
68
  * Fix errors in some environments when requesting an access token for multiple scopes
53
69
 
54
- ## 0.13.1 / 2020-07-30
70
+ ### 0.13.1 / 2020-07-30
55
71
 
56
72
  * Support scopes when using GCE Metadata Server authentication ([@ball-hayden][])
57
73
 
58
- ## 0.13.0 / 2020-06-17
74
+ ### 0.13.0 / 2020-06-17
59
75
 
60
76
  * Support for validating ID tokens.
61
77
  * Fixed header application of ID tokens from service accounts.
62
78
 
63
- ## 0.12.0 / 2020-04-08
79
+ ### 0.12.0 / 2020-04-08
64
80
 
65
81
  * Support for ID token credentials.
66
82
  * Support reading quota_id_project from service account credentials.
67
83
 
68
- ## 0.11.0 / 2020-02-24
84
+ ### 0.11.0 / 2020-02-24
69
85
 
70
86
  * Support Faraday 1.x.
71
87
  * Allow special "postmessage" value for redirect_uri.
72
88
 
73
- ## 0.10.0 / 2019-10-09
89
+ ### 0.10.0 / 2019-10-09
74
90
 
75
91
  Note: This release now requires Ruby 2.4 or later
76
92
 
@@ -80,7 +96,7 @@ Note: This release now requires Ruby 2.4 or later
80
96
  * Set instance variables at initialization to avoid spamming warnings
81
97
  * Pass "Metadata-Flavor" header to metadata server when checking for GCE
82
98
 
83
- ## 0.9.0 / 2019-08-05
99
+ ### 0.9.0 / 2019-08-05
84
100
 
85
101
  * Restore compatibility with Ruby 2.0. This is the last release that will work on end-of-lifed versions of Ruby. The 0.10 release will require Ruby 2.4 or later.
86
102
  * Update Credentials to use methods for values that are intended to be changed by users, replacing constants.
@@ -89,105 +105,95 @@ Note: This release now requires Ruby 2.4 or later
89
105
  * Add verbosity none to gcloud command
90
106
  * Make arity of WebUserAuthorizer#get_credentials compatible with the base class
91
107
 
92
- ## 0.8.1 / 2019-03-27
108
+ ### 0.8.1 / 2019-03-27
93
109
 
94
110
  * Silence unnecessary gcloud warning
95
111
  * Treat empty credentials environment variables as unset
96
112
 
97
- ## 0.8.0 / 2019-01-02
113
+ ### 0.8.0 / 2019-01-02
98
114
 
99
115
  * Support connection options :default_connection and :connection_builder when creating credentials that need to refresh OAuth tokens. This lets clients provide connection objects with custom settings, such as proxies, needed for the client environment.
100
116
  * Removed an unnecessary warning about project IDs.
101
117
 
102
- ## 0.7.1 / 2018-10-25
118
+ ### 0.7.1 / 2018-10-25
103
119
 
104
120
  * Make load_gcloud_project_id module function.
105
121
 
106
- ## 0.7.0 / 2018-10-24
122
+ ### 0.7.0 / 2018-10-24
107
123
 
108
124
  * Add project_id instance variable to UserRefreshCredentials, ServiceAccountCredentials, and Credentials.
109
125
 
110
- ## 0.6.7 / 2018-10-16
126
+ ### 0.6.7 / 2018-10-16
111
127
 
112
128
  * Update memoist dependency to ~> 0.16.
113
129
 
114
- ## 0.6.6 / 2018-08-22
130
+ ### 0.6.6 / 2018-08-22
115
131
 
116
132
  * Remove ruby version warnings.
117
133
 
118
- ## 0.6.5 / 2018-08-16
134
+ ### 0.6.5 / 2018-08-16
119
135
 
120
136
  * Fix incorrect http verb when revoking credentials.
121
137
  * Warn on EOL ruby versions.
122
138
 
123
- ## 0.6.4 / 2018-08-03
139
+ ### 0.6.4 / 2018-08-03
124
140
 
125
141
  * Resolve issue where DefaultCredentials constant was undefined.
126
142
 
127
- ## 0.6.3 / 2018-08-02
143
+ ### 0.6.3 / 2018-08-02
128
144
 
129
145
  * Resolve issue where token_store was being written to twice
130
146
 
131
- ## 0.6.2 / 2018-08-01
147
+ ### 0.6.2 / 2018-08-01
132
148
 
133
149
  * Add warning when using cloud sdk credentials
134
150
 
135
- ## 0.6.1 / 2017-10-18
151
+ ### 0.6.1 / 2017-10-18
136
152
 
137
153
  * Fix file permissions
138
154
 
139
- ## 0.6.0 / 2017-10-17
155
+ ### 0.6.0 / 2017-10-17
140
156
 
141
157
  * Support ruby-jwt 2.0
142
158
  * Add simple credentials class
143
159
 
144
- ## 0.5.3 / 2017-07-21
160
+ ### 0.5.3 / 2017-07-21
145
161
 
146
162
  * Fix file permissions on the gem's `.rb` files.
147
163
 
148
- ## 0.5.2 / 2017-07-19
164
+ ### 0.5.2 / 2017-07-19
149
165
 
150
166
  * Add retry mechanism when fetching access tokens in `GCECredentials` and `UserRefreshCredentials` classes.
151
167
  * Update Google API OAuth2 token credential URI to v4.
152
168
 
153
- ## 0.5.1 / 2016-01-06
169
+ ### 0.5.1 / 2016-01-06
154
170
 
155
171
  * Change header name emitted by `Client#apply` from "Authorization" to "authorization" ([@murgatroid99][])
156
172
  * Fix ADC not working on some windows machines ([@vsubramani][])
157
- [#55](https://github.com/google/google-auth-library-ruby/issues/55)
158
173
 
159
- ## 0.5.0 / 2015-10-12
174
+ ### 0.5.0 / 2015-10-12
160
175
 
161
176
  * Initial support for user credentials ([@sqrrrl][])
162
177
  * Update Signet to 0.7
163
178
 
164
- ## 0.4.2 / 2015-08-05
179
+ ### 0.4.2 / 2015-08-05
165
180
 
166
181
  * Updated UserRefreshCredentials hash to use string keys ([@haabaato][])
167
- [#36](https://github.com/google/google-auth-library-ruby/issues/36)
168
-
169
182
  * Add support for a system default credentials file. ([@mr-salty][])
170
- [#33](https://github.com/google/google-auth-library-ruby/issues/33)
171
-
172
183
  * Fix bug when loading credentials from ENV ([@dwilkie][])
173
- [#31](https://github.com/google/google-auth-library-ruby/issues/31)
174
-
175
184
  * Relax the constraint of dependent version of multi_json ([@igrep][])
176
- [#30](https://github.com/google/google-auth-library-ruby/issues/30)
177
-
178
185
  * Enables passing credentials via environment variables. ([@haabaato][])
179
- [#27](https://github.com/google/google-auth-library-ruby/issues/27)
180
186
 
181
- ## 0.4.1 / 2015-04-25
187
+ ### 0.4.1 / 2015-04-25
182
188
 
183
189
  * Improves handling of --no-scopes GCE authorization ([@tbetbetbe][])
184
190
  * Refactoring and cleanup ([@joneslee85][])
185
191
 
186
- ## 0.4.0 / 2015-03-25
192
+ ### 0.4.0 / 2015-03-25
187
193
 
188
194
  * Adds an implementation of JWT header auth ([@tbetbetbe][])
189
195
 
190
- ## 0.3.0 / 2015-03-23
196
+ ### 0.3.0 / 2015-03-23
191
197
 
192
198
  * makes the scope parameter's optional in all APIs. ([@tbetbetbe][])
193
199
  * changes the scope parameter's position in various constructors. ([@tbetbetbe][])
data/README.md CHANGED
@@ -14,11 +14,6 @@
14
14
  This is Google's officially supported ruby client library for using OAuth 2.0
15
15
  authorization and authentication with Google APIs.
16
16
 
17
- ## Alpha
18
-
19
- This library is in Alpha. We will make an effort to support the library, but
20
- we reserve the right to make incompatible changes when necessary.
21
-
22
17
  ## Install
23
18
 
24
19
  Be sure `https://rubygems.org/` is in your gem sources.
@@ -116,6 +111,7 @@ token_store = Google::Auth::Stores::FileTokenStore.new(
116
111
  :file => '/path/to/tokens.yaml')
117
112
  authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)
118
113
 
114
+ user_id = ENV['USER']
119
115
  credentials = authorizer.get_credentials(user_id)
120
116
  if credentials.nil?
121
117
  url = authorizer.get_authorization_url(base_url: OOB_URI )
@@ -161,6 +157,22 @@ drive.authorization = authorizer
161
157
  list_files = drive.list_files()
162
158
  ```
163
159
 
160
+ ### 3-Legged OAuth with a Service Account
161
+
162
+ This is similar to regular service account authorization (see [this answer](https://support.google.com/a/answer/2538798?hl=en) for more details on the differences), but you'll need to indicate which user your service account is impersonating by manually updating the `sub` field.
163
+
164
+ ```ruby
165
+ scope = 'https://www.googleapis.com/auth/androidpublisher'
166
+
167
+ authorizer = Google::Auth::ServiceAccountCredentials.make_creds(
168
+ json_key_io: File.open('/path/to/service_account_json_key.json'),
169
+ scope: scope
170
+ )
171
+ authorizer.update!(sub: "email-to-impersonate@your-domain.com")
172
+
173
+ authorizer.fetch_access_token!
174
+ ```
175
+
164
176
  ### Example (Environment Variables)
165
177
 
166
178
  ```bash
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require "memoist"
16
15
  require "os"
17
16
  require "rbconfig"
18
17
 
@@ -23,7 +22,6 @@ module Google
23
22
  # CredentialsLoader contains the behaviour used to locate and find default
24
23
  # credentials files on the file system.
25
24
  module CredentialsLoader
26
- extend Memoist
27
25
  ENV_VAR = "GOOGLE_APPLICATION_CREDENTIALS".freeze
28
26
  PRIVATE_KEY_VAR = "GOOGLE_PRIVATE_KEY".freeze
29
27
  CLIENT_EMAIL_VAR = "GOOGLE_CLIENT_EMAIL".freeze
@@ -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.1.0".freeze
19
+ VERSION = "1.1.3".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.1.0
4
+ version: 1.1.3
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-10-25 00:00:00.000000000 Z
11
+ date: 2022-04-20 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
@@ -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