googleauth 0.16.2 → 0.17.1

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +11 -0
  3. data/CHANGELOG.md +13 -0
  4. data/SECURITY.md +7 -0
  5. data/lib/googleauth/service_account.rb +16 -12
  6. data/lib/googleauth/version.rb +1 -1
  7. metadata +16 -89
  8. data/.github/CODEOWNERS +0 -7
  9. data/.github/CONTRIBUTING.md +0 -74
  10. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -36
  11. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -21
  12. data/.github/ISSUE_TEMPLATE/support_request.md +0 -7
  13. data/.github/renovate.json +0 -6
  14. data/.github/sync-repo-settings.yaml +0 -18
  15. data/.github/workflows/ci.yml +0 -55
  16. data/.github/workflows/release-please.yml +0 -39
  17. data/.gitignore +0 -39
  18. data/.kokoro/populate-secrets.sh +0 -76
  19. data/.kokoro/release.cfg +0 -52
  20. data/.kokoro/release.sh +0 -18
  21. data/.kokoro/trampoline_v2.sh +0 -489
  22. data/.repo-metadata.json +0 -5
  23. data/.rspec +0 -2
  24. data/.rubocop.yml +0 -17
  25. data/.toys/.toys.rb +0 -45
  26. data/.toys/ci.rb +0 -43
  27. data/.toys/kokoro/.toys.rb +0 -66
  28. data/.toys/kokoro/publish-docs.rb +0 -67
  29. data/.toys/kokoro/publish-gem.rb +0 -53
  30. data/.toys/linkinator.rb +0 -43
  31. data/.trampolinerc +0 -48
  32. data/Gemfile +0 -25
  33. data/googleauth.gemspec +0 -39
  34. data/integration/helper.rb +0 -31
  35. data/integration/id_tokens/key_source_test.rb +0 -74
  36. data/spec/googleauth/apply_auth_examples.rb +0 -171
  37. data/spec/googleauth/client_id_spec.rb +0 -160
  38. data/spec/googleauth/compute_engine_spec.rb +0 -178
  39. data/spec/googleauth/credentials_spec.rb +0 -600
  40. data/spec/googleauth/get_application_default_spec.rb +0 -286
  41. data/spec/googleauth/iam_spec.rb +0 -80
  42. data/spec/googleauth/scope_util_spec.rb +0 -77
  43. data/spec/googleauth/service_account_spec.rb +0 -497
  44. data/spec/googleauth/signet_spec.rb +0 -142
  45. data/spec/googleauth/stores/file_token_store_spec.rb +0 -57
  46. data/spec/googleauth/stores/redis_token_store_spec.rb +0 -50
  47. data/spec/googleauth/stores/store_examples.rb +0 -58
  48. data/spec/googleauth/user_authorizer_spec.rb +0 -343
  49. data/spec/googleauth/user_refresh_spec.rb +0 -359
  50. data/spec/googleauth/web_user_authorizer_spec.rb +0 -172
  51. data/spec/spec_helper.rb +0 -92
  52. data/test/helper.rb +0 -33
  53. data/test/id_tokens/key_sources_test.rb +0 -240
  54. data/test/id_tokens/verifier_test.rb +0 -269
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1f96ad8fd7b2aae5671af839775b83db2c3f6b9c31e36622c2dc983d647e54d
4
- data.tar.gz: 58db2385909da01755365839451a6a8bbb79fceaabd76de313dab9496a7ea0dd
3
+ metadata.gz: 1cc321053063d0fcbe9b0ac9cece62227049fca62bb4377161cd0679342ceee9
4
+ data.tar.gz: 635e4992df0bfc21fe3df120dc86347619324e685ca136aa6770c23b4104153a
5
5
  SHA512:
6
- metadata.gz: 39f9a7e75bbb27ff0cd9bb50ebc077751f83ee22fec724d4de9ed54c3bde97a92e5a9f577859784d2c298405fa9cf57491bddf73043ff5a0cb6a567379fc2cbb
7
- data.tar.gz: 543d6c2e8175ea1262c4235e581124378ef932fe96b7c63e27b75654a2e7cdfc5e427c6f9668141de1b06d770dedfb97ca8b94b1df800d0bdf04c1860644dc2c
6
+ metadata.gz: 19b49461310e8b41a4062005255d51c15792481183c6fc161baf36a13e40ba1528d604ef8c17048de1661a41dfe7de6867fab3b721cd1be3b148b1c5a15f8a97
7
+ data.tar.gz: 2ae55a1ad27def042196075cb8c5e46db5295797edc568126903ccd7e345a2b7400d5a30f3d79d7001588a1c25ec9fcb12ea128dfc06234dd67077a3c1aae0af
data/.yardopts ADDED
@@ -0,0 +1,11 @@
1
+ --no-private
2
+ --title=Google Auth
3
+ --markup markdown
4
+ --markup-provider redcarpet
5
+
6
+ ./lib/**/*.rb
7
+ -
8
+ README.md
9
+ CHANGELOG.md
10
+ CODE_OF_CONDUCT.md
11
+ LICENSE
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release History
2
2
 
3
+ ### [0.17.1](https://www.github.com/googleapis/google-auth-library-ruby/compare/googleauth/v0.15.0...googleauth/v0.17.1) (2021-09-01)
4
+
5
+ ### Bug Fixes
6
+
7
+ * Updates to gem metadata ([fb5e56d](https://www.github.com/googleapis/google-auth-library-ruby/commit/fb5e56dad1e6ed6afd4f9b5c626e5e1495e48343))
8
+
9
+ ## [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)
10
+
11
+
12
+ ### Features
13
+
14
+ * Allow scopes to be self-signed into jwts ([e67ce40](https://www.github.com/googleapis/google-auth-library-ruby/commit/e67ce40f919b7eb3723c2ec95f5b8d58315ab1ee))
15
+
3
16
  ### [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)
4
17
 
5
18
 
data/SECURITY.md ADDED
@@ -0,0 +1,7 @@
1
+ # Security Policy
2
+
3
+ To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4
+
5
+ The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6
+
7
+ We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
@@ -129,7 +129,7 @@ module Google
129
129
  quota_project_id: @quota_project_id
130
130
  }
131
131
  key_io = StringIO.new MultiJson.dump(cred_json)
132
- alt = ServiceAccountJwtHeaderCredentials.make_creds json_key_io: key_io
132
+ alt = ServiceAccountJwtHeaderCredentials.make_creds json_key_io: key_io, scope: scope
133
133
  alt.apply! a_hash
134
134
  end
135
135
  end
@@ -154,15 +154,13 @@ module Google
154
154
  attr_reader :project_id
155
155
  attr_reader :quota_project_id
156
156
 
157
- # make_creds proxies the construction of a credentials instance
157
+ # Create a ServiceAccountJwtHeaderCredentials.
158
158
  #
159
- # make_creds is used by the methods in CredentialsLoader.
160
- #
161
- # By default, it calls #new with 2 args, the second one being an
162
- # optional scope. Here's the constructor only has one param, so
163
- # we modify make_creds to reflect this.
164
- def self.make_creds *args
165
- new json_key_io: args[0][:json_key_io]
159
+ # @param json_key_io [IO] an IO from which the JSON key can be read
160
+ # @param scope [string|array|nil] the scope(s) to access
161
+ def self.make_creds options = {}
162
+ json_key_io, scope = options.values_at :json_key_io, :scope
163
+ new json_key_io: json_key_io, scope: scope
166
164
  end
167
165
 
168
166
  # Initializes a ServiceAccountJwtHeaderCredentials.
@@ -181,6 +179,7 @@ module Google
181
179
  end
182
180
  @project_id ||= CredentialsLoader.load_gcloud_project_id
183
181
  @signing_key = OpenSSL::PKey::RSA.new @private_key
182
+ @scope = options[:scope]
184
183
  end
185
184
 
186
185
  # Construct a jwt token if the JWT_AUD_URI key is present in the input
@@ -189,7 +188,7 @@ module Google
189
188
  # The jwt token is used as the value of a 'Bearer '.
190
189
  def apply! a_hash, opts = {}
191
190
  jwt_aud_uri = a_hash.delete JWT_AUD_URI_KEY
192
- return a_hash if jwt_aud_uri.nil?
191
+ return a_hash if jwt_aud_uri.nil? && @scope.nil?
193
192
  jwt_token = new_jwt_token jwt_aud_uri, opts
194
193
  a_hash[AUTH_METADATA_KEY] = "Bearer #{jwt_token}"
195
194
  a_hash
@@ -211,16 +210,21 @@ module Google
211
210
  protected
212
211
 
213
212
  # Creates a jwt uri token.
214
- def new_jwt_token jwt_aud_uri, options = {}
213
+ def new_jwt_token jwt_aud_uri = nil, options = {}
215
214
  now = Time.new
216
215
  skew = options[:skew] || 60
217
216
  assertion = {
218
217
  "iss" => @issuer,
219
218
  "sub" => @issuer,
220
- "aud" => jwt_aud_uri,
221
219
  "exp" => (now + EXPIRY).to_i,
222
220
  "iat" => (now - skew).to_i
223
221
  }
222
+
223
+ jwt_aud_uri = nil if @scope
224
+
225
+ assertion["scope"] = Array(@scope).join " " if @scope
226
+ assertion["aud"] = jwt_aud_uri if jwt_aud_uri
227
+
224
228
  JWT.encode assertion, @signing_key, SIGNING_ALGORITHM
225
229
  end
226
230
  end
@@ -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.16.2".freeze
34
+ VERSION = "0.17.1".freeze
35
35
  end
36
36
  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: 0.16.2
4
+ version: 0.17.1
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-04-28 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -104,69 +104,28 @@ dependencies:
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '0.14'
107
+ version: '0.15'
108
108
  type: :runtime
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: '0.14'
115
- - !ruby/object:Gem::Dependency
116
- name: yard
117
- requirement: !ruby/object:Gem::Requirement
118
- requirements:
119
- - - "~>"
120
- - !ruby/object:Gem::Version
121
- version: '0.9'
122
- type: :development
123
- prerelease: false
124
- version_requirements: !ruby/object:Gem::Requirement
125
- requirements:
126
- - - "~>"
127
- - !ruby/object:Gem::Version
128
- version: '0.9'
129
- description: |2
130
- Allows simple authorization for accessing Google APIs.
131
- Provide support for Application Default Credentials, as described at
132
- https://developers.google.com/accounts/docs/application-default-credentials
133
- email: temiola@google.com
114
+ version: '0.15'
115
+ description: Implements simple authorization for accessing Google APIs, and provides
116
+ support for Application Default Credentials.
117
+ email:
118
+ - temiola@google.com
134
119
  executables: []
135
120
  extensions: []
136
121
  extra_rdoc_files: []
137
122
  files:
138
- - ".github/CODEOWNERS"
139
- - ".github/CONTRIBUTING.md"
140
- - ".github/ISSUE_TEMPLATE/bug_report.md"
141
- - ".github/ISSUE_TEMPLATE/feature_request.md"
142
- - ".github/ISSUE_TEMPLATE/support_request.md"
143
- - ".github/renovate.json"
144
- - ".github/sync-repo-settings.yaml"
145
- - ".github/workflows/ci.yml"
146
- - ".github/workflows/release-please.yml"
147
- - ".gitignore"
148
- - ".kokoro/populate-secrets.sh"
149
- - ".kokoro/release.cfg"
150
- - ".kokoro/release.sh"
151
- - ".kokoro/trampoline_v2.sh"
152
- - ".repo-metadata.json"
153
- - ".rspec"
154
- - ".rubocop.yml"
155
- - ".toys/.toys.rb"
156
- - ".toys/ci.rb"
157
- - ".toys/kokoro/.toys.rb"
158
- - ".toys/kokoro/publish-docs.rb"
159
- - ".toys/kokoro/publish-gem.rb"
160
- - ".toys/linkinator.rb"
161
- - ".trampolinerc"
123
+ - ".yardopts"
162
124
  - CHANGELOG.md
163
125
  - CODE_OF_CONDUCT.md
164
- - Gemfile
165
126
  - LICENSE
166
127
  - README.md
167
- - googleauth.gemspec
168
- - integration/helper.rb
169
- - integration/id_tokens/key_source_test.rb
128
+ - SECURITY.md
170
129
  - lib/googleauth.rb
171
130
  - lib/googleauth/application_default.rb
172
131
  - lib/googleauth/client_id.rb
@@ -190,29 +149,13 @@ files:
190
149
  - lib/googleauth/user_refresh.rb
191
150
  - lib/googleauth/version.rb
192
151
  - lib/googleauth/web_user_authorizer.rb
193
- - spec/googleauth/apply_auth_examples.rb
194
- - spec/googleauth/client_id_spec.rb
195
- - spec/googleauth/compute_engine_spec.rb
196
- - spec/googleauth/credentials_spec.rb
197
- - spec/googleauth/get_application_default_spec.rb
198
- - spec/googleauth/iam_spec.rb
199
- - spec/googleauth/scope_util_spec.rb
200
- - spec/googleauth/service_account_spec.rb
201
- - spec/googleauth/signet_spec.rb
202
- - spec/googleauth/stores/file_token_store_spec.rb
203
- - spec/googleauth/stores/redis_token_store_spec.rb
204
- - spec/googleauth/stores/store_examples.rb
205
- - spec/googleauth/user_authorizer_spec.rb
206
- - spec/googleauth/user_refresh_spec.rb
207
- - spec/googleauth/web_user_authorizer_spec.rb
208
- - spec/spec_helper.rb
209
- - test/helper.rb
210
- - test/id_tokens/key_sources_test.rb
211
- - test/id_tokens/verifier_test.rb
212
152
  homepage: https://github.com/googleapis/google-auth-library-ruby
213
153
  licenses:
214
154
  - Apache-2.0
215
- metadata: {}
155
+ metadata:
156
+ changelog_uri: https://github.com/googleapis/google-auth-library-ruby/blob/master/CHANGELOG.md
157
+ source_code_uri: https://github.com/googleapis/google-auth-library-ruby
158
+ bug_tracker_uri: https://github.com/googleapis/google-auth-library-ruby/issues
216
159
  post_install_message:
217
160
  rdoc_options: []
218
161
  require_paths:
@@ -228,24 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
171
  - !ruby/object:Gem::Version
229
172
  version: '0'
230
173
  requirements: []
231
- rubygems_version: 3.2.16
174
+ rubygems_version: 3.2.17
232
175
  signing_key:
233
176
  specification_version: 4
234
177
  summary: Google Auth Library for Ruby
235
- test_files:
236
- - spec/googleauth/apply_auth_examples.rb
237
- - spec/googleauth/client_id_spec.rb
238
- - spec/googleauth/compute_engine_spec.rb
239
- - spec/googleauth/credentials_spec.rb
240
- - spec/googleauth/get_application_default_spec.rb
241
- - spec/googleauth/iam_spec.rb
242
- - spec/googleauth/scope_util_spec.rb
243
- - spec/googleauth/service_account_spec.rb
244
- - spec/googleauth/signet_spec.rb
245
- - spec/googleauth/stores/file_token_store_spec.rb
246
- - spec/googleauth/stores/redis_token_store_spec.rb
247
- - spec/googleauth/stores/store_examples.rb
248
- - spec/googleauth/user_authorizer_spec.rb
249
- - spec/googleauth/user_refresh_spec.rb
250
- - spec/googleauth/web_user_authorizer_spec.rb
251
- - spec/spec_helper.rb
178
+ test_files: []
data/.github/CODEOWNERS DELETED
@@ -1,7 +0,0 @@
1
- # Code owners file.
2
- # This file controls who is tagged for review for any given pull request.
3
- #
4
- # For syntax help see:
5
- # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
6
-
7
- * @googleapis/yoshi-ruby
@@ -1,74 +0,0 @@
1
- # How to become a contributor and submit your own code
2
-
3
- ## Contributor License Agreements
4
-
5
- We'd love to accept your sample apps and patches! Before we can take them, we
6
- have to jump a couple of legal hurdles.
7
-
8
- Please fill out either the individual or corporate Contributor License Agreement
9
- (CLA).
10
-
11
- * If you are an individual writing original source code and you're sure you
12
- own the intellectual property, then you'll need to sign an [individual CLA].
13
- * If you work for a company that wants to allow you to contribute your work,
14
- then you'll need to sign a [corporate CLA].
15
-
16
- [individual CLA]: http://code.google.com/legal/individual-cla-v1.0.html
17
- [corporate CLA]: http://code.google.com/legal/corporate-cla-v1.0.html
18
-
19
- Follow either of the two links above to access the appropriate CLA and
20
- instructions for how to sign and return it. Once we receive it, we'll be able to
21
- accept your pull requests.
22
-
23
- ## Issue reporting
24
-
25
- * Check that the issue has not already been reported.
26
- * Check that the issue has not already been fixed in the latest code
27
- (a.k.a. `master`).
28
- * Be clear, concise and precise in your description of the problem.
29
- * Open an issue with a descriptive title and a summary in grammatically correct,
30
- complete sentences.
31
- * Include any relevant code to the issue summary.
32
-
33
- ## Pull requests
34
-
35
- * Read [how to properly contribute to open source projects on Github][2].
36
- * Fork the project.
37
- * Use a topic/feature branch to easily amend a pull request later, if necessary.
38
- * Write [good commit messages][3].
39
- * Use the same coding conventions as the rest of the project.
40
- * Commit and push until you are happy with your contribution.
41
- * Make sure to add tests for it. This is important so I don't break it
42
- in a future version unintentionally.
43
- * Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format).
44
- * Please try not to mess with the Rakefile, version, or history. If you want to
45
- have your own version, or is otherwise necessary, that is fine, but please
46
- isolate to its own commit so I can cherry-pick around it.
47
- * Make sure the test suite is passing and the code you wrote doesn't produce
48
- RuboCop offenses.
49
- * [Squash related commits together][5].
50
- * Open a [pull request][4] that relates to *only* one subject with a clear title
51
- and description in grammatically correct, complete sentences.
52
-
53
- ### Changelog entry format
54
-
55
- Here are a few examples:
56
-
57
- ```
58
- * makes the scope parameter's optional in all APIs. (@tbetbetbe[])
59
- * [#14](https://github.com/google/google-auth-library-ruby/issues/14): ADC Support for JWT Service Tokens. ([@tbetbetbe][])
60
- ```
61
-
62
- * Mark it up in [Markdown syntax][6].
63
- * The entry line should start with `* ` (an asterisk and a space).
64
- * If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/google/google-auth-library-ruby/issues/11): `.
65
- * Describe the brief of the change. The sentence should end with a punctuation.
66
- * At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
67
- * If this is your first contribution to google-auth-library-ruby project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.
68
-
69
- [1]: https://github.com/google/google-auth-ruby-library/issues
70
- [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
71
- [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
72
- [4]: https://help.github.com/articles/using-pull-requests
73
- [5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
74
- [6]: http://daringfireball.net/projects/markdown/syntax
@@ -1,36 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
-
5
- ---
6
-
7
- Thanks for stopping by to let us know something could be better!
8
-
9
- **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
10
-
11
- Please run down the following list and make sure you've tried the usual "quick fixes":
12
-
13
- - Search the issues already opened: https://github.com/googleapis/google-auth-library-ruby/issues
14
- - Search Stack Overflow: https://stackoverflow.com/questions/tagged/google-auth-library-ruby
15
-
16
- If you are still having issues, please be sure to include as much information as possible:
17
-
18
- #### Environment details
19
-
20
- - OS:
21
- - Ruby version:
22
- - Gem name and version:
23
-
24
- #### Steps to reproduce
25
-
26
- 1. ...
27
-
28
- #### Code example
29
-
30
- ```ruby
31
- # example
32
- ```
33
-
34
- Making sure to follow these steps will guarantee the quickest resolution possible.
35
-
36
- Thanks!
@@ -1,21 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this library
4
-
5
- ---
6
-
7
- Thanks for stopping by to let us know something could be better!
8
-
9
- **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
10
-
11
- **Is your feature request related to a problem? Please describe.**
12
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13
-
14
- **Describe the solution you'd like**
15
- A clear and concise description of what you want to happen.
16
-
17
- **Describe alternatives you've considered**
18
- A clear and concise description of any alternative solutions or features you've considered.
19
-
20
- **Additional context**
21
- Add any other context or screenshots about the feature request here.
@@ -1,7 +0,0 @@
1
- ---
2
- name: Support request
3
- about: If you have a support contract with Google, please create an issue in the Google Cloud Support console.
4
-
5
- ---
6
-
7
- **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
@@ -1,6 +0,0 @@
1
- {
2
- "extends": [
3
- "config:base"
4
- ],
5
- "rangeStrategy": "widen"
6
- }