googleauth 0.13.1 → 0.16.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +7 -0
  3. data/.github/workflows/ci.yml +55 -0
  4. data/.github/workflows/release-please.yml +39 -0
  5. data/.gitignore +3 -0
  6. data/.kokoro/populate-secrets.sh +76 -0
  7. data/.kokoro/release.cfg +7 -49
  8. data/.kokoro/release.sh +18 -0
  9. data/.kokoro/trampoline_v2.sh +489 -0
  10. data/.rubocop.yml +0 -2
  11. data/.toys/.toys.rb +45 -0
  12. data/.toys/ci.rb +43 -0
  13. data/.toys/kokoro/.toys.rb +66 -0
  14. data/.toys/kokoro/publish-docs.rb +67 -0
  15. data/.toys/kokoro/publish-gem.rb +53 -0
  16. data/.toys/linkinator.rb +43 -0
  17. data/.trampolinerc +48 -0
  18. data/CHANGELOG.md +66 -26
  19. data/Gemfile +2 -7
  20. data/{COPYING → LICENSE} +0 -0
  21. data/README.md +9 -7
  22. data/googleauth.gemspec +2 -1
  23. data/lib/googleauth/compute_engine.rb +30 -8
  24. data/lib/googleauth/credentials.rb +167 -48
  25. data/lib/googleauth/credentials_loader.rb +1 -1
  26. data/lib/googleauth/iam.rb +1 -1
  27. data/lib/googleauth/id_tokens/key_sources.rb +7 -5
  28. data/lib/googleauth/id_tokens/verifier.rb +7 -9
  29. data/lib/googleauth/scope_util.rb +1 -1
  30. data/lib/googleauth/service_account.rb +31 -21
  31. data/lib/googleauth/signet.rb +1 -1
  32. data/lib/googleauth/stores/file_token_store.rb +1 -0
  33. data/lib/googleauth/stores/redis_token_store.rb +1 -0
  34. data/lib/googleauth/version.rb +1 -1
  35. data/lib/googleauth/web_user_authorizer.rb +4 -7
  36. data/spec/googleauth/compute_engine_spec.rb +36 -4
  37. data/spec/googleauth/credentials_spec.rb +228 -106
  38. data/spec/googleauth/service_account_spec.rb +8 -0
  39. metadata +18 -23
  40. data/.kokoro/build.bat +0 -16
  41. data/.kokoro/build.sh +0 -4
  42. data/.kokoro/continuous/common.cfg +0 -24
  43. data/.kokoro/continuous/linux.cfg +0 -25
  44. data/.kokoro/continuous/osx.cfg +0 -8
  45. data/.kokoro/continuous/post.cfg +0 -30
  46. data/.kokoro/continuous/windows.cfg +0 -29
  47. data/.kokoro/osx.sh +0 -4
  48. data/.kokoro/presubmit/common.cfg +0 -24
  49. data/.kokoro/presubmit/linux.cfg +0 -24
  50. data/.kokoro/presubmit/osx.cfg +0 -8
  51. data/.kokoro/presubmit/windows.cfg +0 -29
  52. data/.kokoro/trampoline.bat +0 -10
  53. data/.kokoro/trampoline.sh +0 -4
  54. data/Rakefile +0 -132
  55. data/rakelib/devsite_builder.rb +0 -45
  56. data/rakelib/link_checker.rb +0 -64
  57. data/rakelib/repo_metadata.rb +0 -59
@@ -169,6 +169,14 @@ describe Google::Auth::ServiceAccountCredentials do
169
169
  it_behaves_like "jwt header auth"
170
170
  end
171
171
 
172
+ context "when enable_self_signed_jwt is set" do
173
+ before :example do
174
+ @client.instance_variable_set(:@enable_self_signed_jwt, true)
175
+ end
176
+
177
+ it_behaves_like "jwt header auth"
178
+ end
179
+
172
180
  describe "#from_env" do
173
181
  before :example do
174
182
  @var_name = ENV_VAR
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.13.1
4
+ version: 0.16.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: 2020-07-30 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -135,35 +135,33 @@ executables: []
135
135
  extensions: []
136
136
  extra_rdoc_files: []
137
137
  files:
138
+ - ".github/CODEOWNERS"
138
139
  - ".github/CONTRIBUTING.md"
139
140
  - ".github/ISSUE_TEMPLATE/bug_report.md"
140
141
  - ".github/ISSUE_TEMPLATE/feature_request.md"
141
142
  - ".github/ISSUE_TEMPLATE/support_request.md"
143
+ - ".github/workflows/ci.yml"
144
+ - ".github/workflows/release-please.yml"
142
145
  - ".gitignore"
143
- - ".kokoro/build.bat"
144
- - ".kokoro/build.sh"
145
- - ".kokoro/continuous/common.cfg"
146
- - ".kokoro/continuous/linux.cfg"
147
- - ".kokoro/continuous/osx.cfg"
148
- - ".kokoro/continuous/post.cfg"
149
- - ".kokoro/continuous/windows.cfg"
150
- - ".kokoro/osx.sh"
151
- - ".kokoro/presubmit/common.cfg"
152
- - ".kokoro/presubmit/linux.cfg"
153
- - ".kokoro/presubmit/osx.cfg"
154
- - ".kokoro/presubmit/windows.cfg"
146
+ - ".kokoro/populate-secrets.sh"
155
147
  - ".kokoro/release.cfg"
156
- - ".kokoro/trampoline.bat"
157
- - ".kokoro/trampoline.sh"
148
+ - ".kokoro/release.sh"
149
+ - ".kokoro/trampoline_v2.sh"
158
150
  - ".repo-metadata.json"
159
151
  - ".rspec"
160
152
  - ".rubocop.yml"
153
+ - ".toys/.toys.rb"
154
+ - ".toys/ci.rb"
155
+ - ".toys/kokoro/.toys.rb"
156
+ - ".toys/kokoro/publish-docs.rb"
157
+ - ".toys/kokoro/publish-gem.rb"
158
+ - ".toys/linkinator.rb"
159
+ - ".trampolinerc"
161
160
  - CHANGELOG.md
162
161
  - CODE_OF_CONDUCT.md
163
- - COPYING
164
162
  - Gemfile
163
+ - LICENSE
165
164
  - README.md
166
- - Rakefile
167
165
  - googleauth.gemspec
168
166
  - integration/helper.rb
169
167
  - integration/id_tokens/key_source_test.rb
@@ -190,9 +188,6 @@ files:
190
188
  - lib/googleauth/user_refresh.rb
191
189
  - lib/googleauth/version.rb
192
190
  - lib/googleauth/web_user_authorizer.rb
193
- - rakelib/devsite_builder.rb
194
- - rakelib/link_checker.rb
195
- - rakelib/repo_metadata.rb
196
191
  - spec/googleauth/apply_auth_examples.rb
197
192
  - spec/googleauth/client_id_spec.rb
198
193
  - spec/googleauth/compute_engine_spec.rb
@@ -224,14 +219,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
219
  requirements:
225
220
  - - ">="
226
221
  - !ruby/object:Gem::Version
227
- version: 2.4.0
222
+ version: '2.5'
228
223
  required_rubygems_version: !ruby/object:Gem::Requirement
229
224
  requirements:
230
225
  - - ">="
231
226
  - !ruby/object:Gem::Version
232
227
  version: '0'
233
228
  requirements: []
234
- rubygems_version: 3.1.3
229
+ rubygems_version: 3.2.13
235
230
  signing_key:
236
231
  specification_version: 4
237
232
  summary: Google Auth Library for Ruby
data/.kokoro/build.bat DELETED
@@ -1,16 +0,0 @@
1
- REM This file runs tests for merges, PRs, and nightlies.
2
- REM There are a few rules for what tests are run:
3
- REM * PRs run all non-acceptance tests for every library.
4
- REM * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries.
5
- REM * Nightlies run all acceptance tests for every library.
6
- REM Currently only runs tests on 2.5.1
7
-
8
- SET url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/build.bat"
9
-
10
- SET "download=powershell -C Invoke-WebRequest -Uri %url% -OutFile master-build.bat"
11
-
12
- SET EXIT_STATUS=1
13
-
14
- %download% && master-build.bat && SET EXIT_STATUS=0
15
-
16
- EXIT %EXIT_STATUS%
data/.kokoro/build.sh DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/build.sh"
4
- curl -o master-build.sh $script_url && source master-build.sh
@@ -1,24 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- # Build logs will be here
4
- action {
5
- define_artifacts {
6
- regex: "**/*sponge_log.xml"
7
- }
8
- }
9
-
10
- # Download trampoline resources.
11
- gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12
-
13
- # Download resources for system tests (service account key, etc.)
14
- gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby"
15
-
16
- env_vars: {
17
- key: "JOB_TYPE"
18
- value: "continuous"
19
- }
20
-
21
- env_vars: {
22
- key: "REPO_DIR"
23
- value: "github/google-auth-library-ruby"
24
- }
@@ -1,25 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
4
-
5
- # Configure the docker image for kokoro-trampoline.
6
- # Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/multi
7
- env_vars: {
8
- key: "TRAMPOLINE_IMAGE"
9
- value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/multi"
10
- }
11
-
12
- env_vars: {
13
- key: "TRAMPOLINE_BUILD_FILE"
14
- value: "github/google-auth-library-ruby/.kokoro/build.sh"
15
- }
16
-
17
- env_vars: {
18
- key: "TRAMPOLINE_SCRIPT"
19
- value: "trampoline_v1.py"
20
- }
21
-
22
- env_vars: {
23
- key: "OS"
24
- value: "linux"
25
- }
@@ -1,8 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/osx.sh"
4
-
5
- env_vars: {
6
- key: "OS"
7
- value: "osx"
8
- }
@@ -1,30 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
4
-
5
- # Configure the docker image for kokoro-trampoline.
6
- # Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/multi-node
7
- env_vars: {
8
- key: "TRAMPOLINE_IMAGE"
9
- value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/multi-node"
10
- }
11
-
12
- env_vars: {
13
- key: "TRAMPOLINE_BUILD_FILE"
14
- value: "github/google-auth-library-ruby/.kokoro/build.sh"
15
- }
16
-
17
- env_vars: {
18
- key: "TRAMPOLINE_SCRIPT"
19
- value: "trampoline_v1.py"
20
- }
21
-
22
- env_vars: {
23
- key: "OS"
24
- value: "linux"
25
- }
26
-
27
- env_vars: {
28
- key: "JOB_TYPE"
29
- value: "post"
30
- }
@@ -1,29 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/trampoline.bat"
4
-
5
- # Configure the docker image for kokoro-trampoline.
6
- env_vars: {
7
- key: "TRAMPOLINE_IMAGE"
8
- value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/windows"
9
- }
10
-
11
- env_vars: {
12
- key: "TRAMPOLINE_BUILD_FILE"
13
- value: "github/google-auth-library-ruby/.kokoro/build.bat"
14
- }
15
-
16
- env_vars: {
17
- key: "TRAMPOLINE_SCRIPT"
18
- value: "trampoline_windows.py"
19
- }
20
-
21
- env_vars: {
22
- key: "REPO_DIR"
23
- value: "google-auth-library-ruby"
24
- }
25
-
26
- env_vars: {
27
- key: "OS"
28
- value: "windows"
29
- }
data/.kokoro/osx.sh DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/osx.sh"
4
- curl -o master-osx.sh $script_url && source master-osx.sh
@@ -1,24 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- # Build logs will be here
4
- action {
5
- define_artifacts {
6
- regex: "**/*sponge_log.xml"
7
- }
8
- }
9
-
10
- # Download trampoline resources.
11
- gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12
-
13
- # Download resources for system tests (service account key, etc.)
14
- gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby"
15
-
16
- env_vars: {
17
- key: "JOB_TYPE"
18
- value: "presubmit"
19
- }
20
-
21
- env_vars: {
22
- key: "REPO_DIR"
23
- value: "github/google-auth-library-ruby"
24
- }
@@ -1,24 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
4
-
5
- # Configure the docker image for kokoro-trampoline.
6
- env_vars: {
7
- key: "TRAMPOLINE_IMAGE"
8
- value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/multi"
9
- }
10
-
11
- env_vars: {
12
- key: "TRAMPOLINE_BUILD_FILE"
13
- value: "github/google-auth-library-ruby/.kokoro/build.sh"
14
- }
15
-
16
- env_vars: {
17
- key: "TRAMPOLINE_SCRIPT"
18
- value: "trampoline_v1.py"
19
- }
20
-
21
- env_vars: {
22
- key: "OS"
23
- value: "linux"
24
- }
@@ -1,8 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/osx.sh"
4
-
5
- env_vars: {
6
- key: "OS"
7
- value: "osx"
8
- }
@@ -1,29 +0,0 @@
1
- # Format: //devtools/kokoro/config/proto/build.proto
2
-
3
- build_file: "google-auth-library-ruby/.kokoro/trampoline.bat"
4
-
5
- # Configure the docker image for kokoro-trampoline.
6
- env_vars: {
7
- key: "TRAMPOLINE_IMAGE"
8
- value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/windows"
9
- }
10
-
11
- env_vars: {
12
- key: "TRAMPOLINE_BUILD_FILE"
13
- value: "github/google-auth-library-ruby/.kokoro/build.bat"
14
- }
15
-
16
- env_vars: {
17
- key: "TRAMPOLINE_SCRIPT"
18
- value: "trampoline_windows.py"
19
- }
20
-
21
- env_vars: {
22
- key: "REPO_DIR"
23
- value: "google-auth-library-ruby"
24
- }
25
-
26
- env_vars: {
27
- key: "OS"
28
- value: "windows"
29
- }
@@ -1,10 +0,0 @@
1
-
2
- SET url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/trampoline.bat"
3
-
4
- SET "download=powershell -C Invoke-WebRequest -Uri %url% -OutFile master-trampoline.bat"
5
-
6
- SET EXIT_STATUS=1
7
-
8
- %download% && master-trampoline.bat && SET EXIT_STATUS=0
9
-
10
- EXIT %EXIT_STATUS%
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/trampoline.sh"
4
- curl -o master-trampoline.sh $script_url && source master-trampoline.sh
data/Rakefile DELETED
@@ -1,132 +0,0 @@
1
- # -*- ruby -*-
2
- require "json"
3
- require "bundler/gem_tasks"
4
-
5
- require "rubocop/rake_task"
6
- RuboCop::RakeTask.new
7
-
8
- require "rake/testtask"
9
-
10
- desc "Run tests."
11
- Rake::TestTask.new do |t|
12
- t.libs << "test"
13
- t.test_files = FileList["test/**/*_test.rb"]
14
- t.warning = false
15
- end
16
-
17
- desc "Run integration tests."
18
- Rake::TestTask.new("integration") do |t|
19
- t.libs << "integration"
20
- t.test_files = FileList["integration/**/*_test.rb"]
21
- t.warning = false
22
- end
23
-
24
- task :ci do
25
- header "Using Ruby - #{RUBY_VERSION}"
26
- sh "bundle exec rubocop"
27
- Rake::Task["test"].invoke
28
- Rake::Task["integration"].invoke
29
- sh "bundle exec rspec"
30
- end
31
-
32
- task :release_gem, :tag do |_t, args|
33
- tag = args[:tag]
34
- raise "You must provide a tag to release." if tag.nil?
35
-
36
- # Verify the tag format "vVERSION"
37
- m = tag.match /v(?<version>\S*)/
38
- raise "Tag #{tag} does not match the expected format." if m.nil?
39
-
40
- version = m[:version]
41
- raise "You must provide a version." if version.nil?
42
-
43
- api_token = ENV["RUBYGEMS_API_TOKEN"]
44
-
45
- require "gems"
46
- if api_token
47
- ::Gems.configure do |config|
48
- config.key = api_token
49
- end
50
- end
51
-
52
- Bundler.with_clean_env do
53
- sh "rm -rf pkg"
54
- sh "bundle update"
55
- sh "bundle exec rake build"
56
- end
57
-
58
- path_to_be_pushed = "pkg/googleauth-#{version}.gem"
59
- gem_was_published = nil
60
- if File.file? path_to_be_pushed
61
- begin
62
- response = ::Gems.push File.new(path_to_be_pushed)
63
- puts response
64
- raise unless response.include? "Successfully registered gem:"
65
- gem_was_published = true
66
- puts "Successfully built and pushed googleauth for version #{version}"
67
- rescue StandardError => e
68
- gem_was_published = false
69
- puts "Error while releasing googleauth version #{version}: #{e.message}"
70
- end
71
- else
72
- raise "Cannot build googleauth for version #{version}"
73
- end
74
-
75
- Rake::Task["kokoro:publish_docs"].invoke if gem_was_published
76
- end
77
-
78
- namespace :kokoro do
79
- task :load_env_vars do
80
- service_account = "#{ENV['KOKORO_GFILE_DIR']}/service-account.json"
81
- ENV["GOOGLE_APPLICATION_CREDENTIALS"] = service_account
82
- filename = "#{ENV['KOKORO_GFILE_DIR']}/env_vars.json"
83
- env_vars = JSON.parse File.read(filename)
84
- env_vars.each { |k, v| ENV[k] = v }
85
- end
86
-
87
- task :presubmit do
88
- Rake::Task["ci"].invoke
89
- end
90
-
91
- task :continuous do
92
- Rake::Task["ci"].invoke
93
- end
94
-
95
- task :post do
96
- require_relative "rakelib/link_checker.rb"
97
-
98
- link_checker = LinkChecker.new
99
- link_checker.run
100
- exit link_checker.exit_status
101
- end
102
-
103
- task :nightly do
104
- Rake::Task["ci"].invoke
105
- end
106
-
107
- task :release do
108
- version = "0.1.0"
109
- Bundler.with_clean_env do
110
- version = `bundle exec gem list`
111
- .split("\n").select { |line| line.include? "googleauth" }
112
- .first.split("(").last.split(")").first || "0.1.0"
113
- end
114
- Rake::Task["kokoro:load_env_vars"].invoke
115
- Rake::Task["release_gem"].invoke "v#{version}"
116
- end
117
-
118
- task :publish_docs do
119
- require_relative "rakelib/devsite_builder.rb"
120
-
121
- DevsiteBuilder.new(__dir__).publish
122
- end
123
- end
124
-
125
- def header str, token = "#"
126
- line_length = str.length + 8
127
- puts ""
128
- puts token * line_length
129
- puts "#{token * 3} #{str} #{token * 3}"
130
- puts token * line_length
131
- puts ""
132
- end