googleauth 0.17.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +11 -0
  3. data/CHANGELOG.md +6 -0
  4. data/lib/googleauth/version.rb +1 -1
  5. metadata +14 -88
  6. data/.github/CODEOWNERS +0 -7
  7. data/.github/CONTRIBUTING.md +0 -74
  8. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -36
  9. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -21
  10. data/.github/ISSUE_TEMPLATE/support_request.md +0 -7
  11. data/.github/renovate.json +0 -6
  12. data/.github/sync-repo-settings.yaml +0 -18
  13. data/.github/workflows/ci.yml +0 -55
  14. data/.github/workflows/release-please.yml +0 -39
  15. data/.gitignore +0 -39
  16. data/.kokoro/populate-secrets.sh +0 -76
  17. data/.kokoro/release.cfg +0 -52
  18. data/.kokoro/release.sh +0 -18
  19. data/.kokoro/trampoline_v2.sh +0 -489
  20. data/.repo-metadata.json +0 -5
  21. data/.rspec +0 -2
  22. data/.rubocop.yml +0 -17
  23. data/.toys/.toys.rb +0 -45
  24. data/.toys/ci.rb +0 -43
  25. data/.toys/kokoro/.toys.rb +0 -66
  26. data/.toys/kokoro/publish-docs.rb +0 -67
  27. data/.toys/kokoro/publish-gem.rb +0 -53
  28. data/.toys/linkinator.rb +0 -43
  29. data/.trampolinerc +0 -48
  30. data/Gemfile +0 -25
  31. data/googleauth.gemspec +0 -39
  32. data/integration/helper.rb +0 -31
  33. data/integration/id_tokens/key_source_test.rb +0 -74
  34. data/spec/googleauth/apply_auth_examples.rb +0 -171
  35. data/spec/googleauth/client_id_spec.rb +0 -160
  36. data/spec/googleauth/compute_engine_spec.rb +0 -178
  37. data/spec/googleauth/credentials_spec.rb +0 -600
  38. data/spec/googleauth/get_application_default_spec.rb +0 -286
  39. data/spec/googleauth/iam_spec.rb +0 -80
  40. data/spec/googleauth/scope_util_spec.rb +0 -77
  41. data/spec/googleauth/service_account_spec.rb +0 -511
  42. data/spec/googleauth/signet_spec.rb +0 -142
  43. data/spec/googleauth/stores/file_token_store_spec.rb +0 -57
  44. data/spec/googleauth/stores/redis_token_store_spec.rb +0 -50
  45. data/spec/googleauth/stores/store_examples.rb +0 -58
  46. data/spec/googleauth/user_authorizer_spec.rb +0 -343
  47. data/spec/googleauth/user_refresh_spec.rb +0 -359
  48. data/spec/googleauth/web_user_authorizer_spec.rb +0 -172
  49. data/spec/spec_helper.rb +0 -92
  50. data/test/helper.rb +0 -33
  51. data/test/id_tokens/key_sources_test.rb +0 -240
  52. data/test/id_tokens/verifier_test.rb +0 -269
data/.repo-metadata.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "language": "ruby",
3
- "distribution-name": "googleauth",
4
- "library_type": "AUTH"
5
- }
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --format documentation
data/.rubocop.yml DELETED
@@ -1,17 +0,0 @@
1
- inherit_gem:
2
- google-style: google-style.yml
3
-
4
- AllCops:
5
- Exclude:
6
- - "Rakefile"
7
- - "integration/**/*"
8
- - "rakelib/**/*"
9
- - "spec/**/*"
10
- - "test/**/*"
11
- Metrics/ClassLength:
12
- Max: 200
13
- Metrics/ModuleLength:
14
- Max: 110
15
- Metrics/BlockLength:
16
- Exclude:
17
- - "googleauth.gemspec"
data/.toys/.toys.rb DELETED
@@ -1,45 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- expand :clean, paths: :gitignore
16
-
17
- expand :rspec do |t|
18
- t.libs = ["lib", "spec"]
19
- t.use_bundler
20
- end
21
-
22
- expand :minitest do |t|
23
- t.libs = ["lib", "test"]
24
- t.use_bundler
25
- t.files = "test/**/*_test.rb"
26
- end
27
-
28
- expand :minitest do |t|
29
- t.name = "integration"
30
- t.libs = ["lib", "integration"]
31
- t.use_bundler
32
- t.files = "integration/**/*_test.rb"
33
- end
34
-
35
- expand :rubocop, bundler: true
36
-
37
- expand :yardoc do |t|
38
- t.generate_output_flag = true
39
- # t.fail_on_warning = true
40
- t.use_bundler
41
- end
42
-
43
- expand :gem_build
44
-
45
- expand :gem_build, name: "install", install_gem: true
data/.toys/ci.rb DELETED
@@ -1,43 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- desc "Run CI checks"
16
-
17
- TESTS = ["test", "integration", "spec", "rubocop", "yardoc", "build", "linkinator"]
18
-
19
- flag :only
20
- TESTS.each do |name|
21
- flag "include_#{name}".to_sym, "--[no-]include-#{name}"
22
- end
23
-
24
- include :exec, result_callback: :handle_result
25
- include :terminal
26
-
27
- def handle_result result
28
- if result.success?
29
- puts "** #{result.name} passed\n\n", :green, :bold
30
- else
31
- puts "** CI terminated: #{result.name} failed!", :red, :bold
32
- exit 1
33
- end
34
- end
35
-
36
- def run
37
- ::Dir.chdir context_directory
38
- TESTS.each do |name|
39
- setting = get "include_#{name}".to_sym
40
- setting = !only if setting.nil?
41
- exec ["toys", name], name: name.capitalize if setting
42
- end
43
- end
@@ -1,66 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- mixin "kokoro-tools" do
16
- def load_env
17
- return if defined? @loaded_env
18
-
19
- service_account = "#{::ENV['KOKORO_GFILE_DIR']}/service-account.json"
20
- raise "#{service_account} is not a file" unless ::File.file? service_account
21
- ::ENV["GOOGLE_APPLICATION_CREDENTIALS"] = service_account
22
-
23
- filename = "#{::ENV['KOKORO_GFILE_DIR']}/ruby_env_vars.json"
24
- raise "#{filename} is not a file" unless ::File.file? filename
25
- env_vars = ::JSON.parse ::File.read filename
26
- env_vars.each { |k, v| ::ENV[k] = v }
27
-
28
- ::ENV["DOCS_CREDENTIALS"] ||= "#{::ENV['KOKORO_KEYSTORE_DIR']}/73713_docuploader_service_account"
29
- ::ENV["GITHUB_TOKEN"] ||= "#{::ENV['KOKORO_KEYSTORE_DIR']}/73713_yoshi-automation-github-key"
30
-
31
- @loaded_env = true
32
- end
33
-
34
- def package_name
35
- @package_name ||=
36
- ::ENV["RELEASE_PACKAGE"] || ::ENV["PACKAGE"] || begin
37
- files = ::Dir.glob("*.gemspec")
38
- raise "Unable to determine package" unless files.length == 1
39
- ::File.basename files.first, ".gemspec"
40
- end
41
- end
42
-
43
- def package_directory
44
- @package_directory ||= begin
45
- if ::File.file? "#{package_name}.gemspec"
46
- ::File.expand_path "."
47
- elsif ::File.file? "#{package_name}/#{package_name}.gemspec"
48
- ::File.expand_path package_name
49
- else
50
- raise "Unable to determine package directory"
51
- end
52
- end
53
- end
54
-
55
- def package_gemspec_path
56
- @package_gemspec_path ||= ::File.join package_directory, "#{package_name}.gemspec"
57
- end
58
-
59
- def package_gemspec
60
- @package_gemspec ||= eval ::File.read package_gemspec_path
61
- end
62
-
63
- def package_version
64
- @package_version ||= package_gemspec.version
65
- end
66
- end
@@ -1,67 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "json"
16
-
17
- include "kokoro-tools"
18
- include :exec, e: true
19
- include :fileutils
20
-
21
- flag :credentials, "--credentials=PATH"
22
- flag :bucket, "--bucket=NAME"
23
- flag :dry_run, default: ["true", "docs"].include?(::ENV["RELEASE_DRY_RUN"].to_s)
24
-
25
- def run
26
- ::Dir.chdir package_directory
27
- load_env
28
- build_docs
29
- write_metadata
30
- if dry_run
31
- puts "DRY RUN: Skipping doc uploading for #{package_name}"
32
- else
33
- upload_docs
34
- end
35
- end
36
-
37
- def build_docs
38
- rm_rf "doc"
39
- exec ["toys", "yardoc"]
40
- end
41
-
42
- def write_metadata
43
- allowed_fields = [
44
- "name", "version", "language", "distribution-name",
45
- "product-page", "github-repository", "issue-tracker"
46
- ]
47
- metadata = ::JSON.parse ::File.read ".repo-metadata.json"
48
- metadata.transform_keys! { |k| k.tr "_", "-" }
49
- metadata.keep_if { |k, _v| allowed_fields.include? k }
50
- metadata["version"] = package_version
51
- metadata["name"] = metadata["distribution-name"]
52
- args = metadata.transform_keys { |k| "--#{k}" }.to_a.flatten
53
- cmd = ["python3", "-m", "docuploader", "create-metadata"] + args
54
- exec cmd, chdir: "doc"
55
- end
56
-
57
- def upload_docs
58
- creds = credentials || "#{::ENV['KOKORO_KEYSTORE_DIR']}/73713_docuploader_service_account"
59
- buck = bucket || ::ENV["STAGING_BUCKET"] || "docs-staging"
60
- cmd = [
61
- "python3", "-m", "docuploader", "upload", ".",
62
- "--credentials=#{creds}",
63
- "--staging-bucket=#{buck}",
64
- "--metadata-file=./docs.metadata"
65
- ]
66
- exec cmd, chdir: "doc"
67
- end
@@ -1,53 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- include "kokoro-tools"
16
- include :exec, e: true
17
- include :fileutils
18
- include :gems
19
-
20
- flag :rubygems_token, "--rubygems-token=TOKEN"
21
- flag :dry_run, default: ["true", "gem"].include?(::ENV["RELEASE_DRY_RUN"].to_s)
22
-
23
- def run
24
- gem "gems", "~> 1.2"
25
- require "gems"
26
- ::Dir.chdir package_directory
27
- load_env
28
- configure_gems
29
- gem_path = build_gem
30
- if dry_run
31
- puts "DRY RUN: Skipping Rubygems push of #{gem_path}"
32
- else
33
- push_gem gem_path
34
- end
35
- end
36
-
37
- def configure_gems
38
- token = rubygems_token || ::ENV["RUBYGEMS_API_TOKEN"]
39
- ::Gems.configure { |config| config.key = token } if token
40
- end
41
-
42
- def build_gem
43
- gem_path = "pkg/#{package_name}-#{package_version}.gem"
44
- rm_rf gem_path
45
- exec ["toys", "build"]
46
- gem_path
47
- end
48
-
49
- def push_gem gem_path
50
- response = ::Gems.push ::File.new gem_path
51
- puts response
52
- raise "Gem push didn't report success" unless response.include? "Successfully registered gem:"
53
- end
data/.toys/linkinator.rb DELETED
@@ -1,43 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- desc "Run Link checks"
16
-
17
- flag :install, desc: "Install linkinator instead of running checks"
18
-
19
- include :exec, e: true
20
- include :terminal
21
-
22
- def run
23
- ::Dir.chdir context_directory
24
- if install
25
- Kernel.exec "npm install linkinator"
26
- else
27
- exec_tool ["yardoc"]
28
- check_links
29
- end
30
- end
31
-
32
- def check_links
33
- result = exec ["npx", "linkinator", "./doc"], out: :capture
34
- puts result.captured_out
35
- checked_links = result.captured_out.split "\n"
36
- checked_links.select! { |link| link =~ /^\[(\d+)\]/ && ::Regexp.last_match[1] != "200" }
37
- unless checked_links.empty?
38
- checked_links.each do |link|
39
- puts link, :yellow
40
- end
41
- exit 1
42
- end
43
- end
data/.trampolinerc DELETED
@@ -1,48 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- # Add required env vars here.
16
- required_envvars+=(
17
- )
18
-
19
- # Add env vars which are passed down into the container here.
20
- pass_down_envvars+=(
21
- "AUTORELEASE_PR" "RELEASE_DRY_RUN"
22
- )
23
-
24
- # Prevent unintentional override on the default image.
25
- if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
26
- echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image."
27
- exit 1
28
- fi
29
-
30
- # Define the default value if it makes sense.
31
- if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then
32
- TRAMPOLINE_IMAGE_UPLOAD=""
33
- fi
34
-
35
- if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
36
- TRAMPOLINE_IMAGE=""
37
- fi
38
-
39
- if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then
40
- TRAMPOLINE_DOCKERFILE=""
41
- fi
42
-
43
- if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then
44
- TRAMPOLINE_BUILD_FILE=""
45
- fi
46
-
47
- # Secret Manager secrets.
48
- source ${PROJECT_ROOT}/.kokoro/populate-secrets.sh
data/Gemfile DELETED
@@ -1,25 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in googleauth.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem "bundler", ">= 1.9"
8
- gem "coveralls", "~> 0.7"
9
- gem "fakefs", "~> 0.6"
10
- gem "fakeredis", "~> 0.5"
11
- gem "google-style", "~> 1.25.1"
12
- gem "logging", "~> 2.0"
13
- gem "minitest", "~> 5.14"
14
- gem "minitest-focus", "~> 1.1"
15
- gem "rack-test", "~> 0.6"
16
- gem "rake", "~> 13.0"
17
- gem "redis", "~> 3.2"
18
- gem "rspec", "~> 3.0"
19
- gem "simplecov", "~> 0.9"
20
- gem "sinatra"
21
- gem "webmock", "~> 3.8"
22
- end
23
-
24
- gem "faraday", ">= 0.17.3", "< 2.0"
25
- gem "gems", "~> 1.2"
data/googleauth.gemspec DELETED
@@ -1,39 +0,0 @@
1
- # -*- ruby -*-
2
- # encoding: utf-8
3
-
4
- $LOAD_PATH.push File.expand_path("lib", __dir__)
5
- require "googleauth/version"
6
-
7
- Gem::Specification.new do |gem|
8
- gem.name = "googleauth"
9
- gem.version = Google::Auth::VERSION
10
- gem.authors = ["Tim Emiola"]
11
- gem.email = "temiola@google.com"
12
- gem.homepage = "https://github.com/googleapis/google-auth-library-ruby"
13
- gem.summary = "Google Auth Library for Ruby"
14
- gem.license = "Apache-2.0"
15
- gem.description = <<-DESCRIPTION
16
- Allows simple authorization for accessing Google APIs.
17
- Provide support for Application Default Credentials, as described at
18
- https://developers.google.com/accounts/docs/application-default-credentials
19
- DESCRIPTION
20
-
21
- gem.files = `git ls-files`.split "\n"
22
- gem.test_files = `git ls-files -- spec/*`.split "\n"
23
- gem.executables = `git ls-files -- bin/*.rb`.split("\n").map do |f|
24
- File.basename f
25
- end
26
- gem.require_paths = ["lib"]
27
-
28
- gem.platform = Gem::Platform::RUBY
29
- gem.required_ruby_version = ">= 2.5"
30
-
31
- gem.add_dependency "faraday", ">= 0.17.3", "< 2.0"
32
- gem.add_dependency "jwt", ">= 1.4", "< 3.0"
33
- gem.add_dependency "memoist", "~> 0.16"
34
- gem.add_dependency "multi_json", "~> 1.11"
35
- gem.add_dependency "os", ">= 0.9", "< 2.0"
36
- gem.add_dependency "signet", "~> 0.14"
37
-
38
- gem.add_development_dependency "yard", "~> 0.9"
39
- end