googleauth 0.14.0 → 0.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/renovate.json +6 -0
  3. data/.github/sync-repo-settings.yaml +18 -0
  4. data/.github/workflows/ci.yml +55 -0
  5. data/.github/workflows/release-please.yml +39 -0
  6. data/.gitignore +3 -0
  7. data/.kokoro/populate-secrets.sh +76 -0
  8. data/.kokoro/release.cfg +7 -49
  9. data/.kokoro/release.sh +18 -0
  10. data/.kokoro/trampoline_v2.sh +489 -0
  11. data/.rubocop.yml +0 -2
  12. data/.toys/.toys.rb +45 -0
  13. data/.toys/ci.rb +43 -0
  14. data/.toys/kokoro/.toys.rb +66 -0
  15. data/.toys/kokoro/publish-docs.rb +67 -0
  16. data/.toys/kokoro/publish-gem.rb +53 -0
  17. data/.toys/linkinator.rb +43 -0
  18. data/.trampolinerc +48 -0
  19. data/CHANGELOG.md +69 -27
  20. data/Gemfile +2 -7
  21. data/README.md +9 -7
  22. data/googleauth.gemspec +2 -1
  23. data/lib/googleauth/compute_engine.rb +6 -5
  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 +35 -23
  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 +18 -0
  37. data/spec/googleauth/credentials_spec.rb +228 -106
  38. data/spec/googleauth/service_account_spec.rb +8 -0
  39. metadata +18 -22
  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.14.0
4
+ version: 0.16.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: 2020-10-09 00:00:00.000000000 Z
11
+ date: 2021-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -140,31 +140,30 @@ files:
140
140
  - ".github/ISSUE_TEMPLATE/bug_report.md"
141
141
  - ".github/ISSUE_TEMPLATE/feature_request.md"
142
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"
143
147
  - ".gitignore"
144
- - ".kokoro/build.bat"
145
- - ".kokoro/build.sh"
146
- - ".kokoro/continuous/common.cfg"
147
- - ".kokoro/continuous/linux.cfg"
148
- - ".kokoro/continuous/osx.cfg"
149
- - ".kokoro/continuous/post.cfg"
150
- - ".kokoro/continuous/windows.cfg"
151
- - ".kokoro/osx.sh"
152
- - ".kokoro/presubmit/common.cfg"
153
- - ".kokoro/presubmit/linux.cfg"
154
- - ".kokoro/presubmit/osx.cfg"
155
- - ".kokoro/presubmit/windows.cfg"
148
+ - ".kokoro/populate-secrets.sh"
156
149
  - ".kokoro/release.cfg"
157
- - ".kokoro/trampoline.bat"
158
- - ".kokoro/trampoline.sh"
150
+ - ".kokoro/release.sh"
151
+ - ".kokoro/trampoline_v2.sh"
159
152
  - ".repo-metadata.json"
160
153
  - ".rspec"
161
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"
162
162
  - CHANGELOG.md
163
163
  - CODE_OF_CONDUCT.md
164
164
  - Gemfile
165
165
  - LICENSE
166
166
  - README.md
167
- - Rakefile
168
167
  - googleauth.gemspec
169
168
  - integration/helper.rb
170
169
  - integration/id_tokens/key_source_test.rb
@@ -191,9 +190,6 @@ files:
191
190
  - lib/googleauth/user_refresh.rb
192
191
  - lib/googleauth/version.rb
193
192
  - lib/googleauth/web_user_authorizer.rb
194
- - rakelib/devsite_builder.rb
195
- - rakelib/link_checker.rb
196
- - rakelib/repo_metadata.rb
197
193
  - spec/googleauth/apply_auth_examples.rb
198
194
  - spec/googleauth/client_id_spec.rb
199
195
  - spec/googleauth/compute_engine_spec.rb
@@ -225,14 +221,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
221
  requirements:
226
222
  - - ">="
227
223
  - !ruby/object:Gem::Version
228
- version: 2.4.0
224
+ version: '2.5'
229
225
  required_rubygems_version: !ruby/object:Gem::Requirement
230
226
  requirements:
231
227
  - - ">="
232
228
  - !ruby/object:Gem::Version
233
229
  version: '0'
234
230
  requirements: []
235
- rubygems_version: 3.1.4
231
+ rubygems_version: 3.2.16
236
232
  signing_key:
237
233
  specification_version: 4
238
234
  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