googleauth 0.8.0 → 0.8.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/.kokoro/build.sh +2 -34
  3. data/.kokoro/continuous/common.cfg +5 -0
  4. data/.kokoro/continuous/linux.cfg +1 -1
  5. data/.kokoro/osx.sh +2 -33
  6. data/.kokoro/presubmit/common.cfg +5 -0
  7. data/.kokoro/presubmit/linux.cfg +1 -1
  8. data/.kokoro/release.cfg +53 -0
  9. data/.kokoro/trampoline.sh +3 -23
  10. data/.kokoro/windows.sh +2 -30
  11. data/.rubocop.yml +7 -24
  12. data/CHANGELOG.md +24 -39
  13. data/Gemfile +14 -14
  14. data/README.md +21 -1
  15. data/Rakefile +84 -10
  16. data/googleauth.gemspec +23 -23
  17. data/lib/googleauth.rb +6 -6
  18. data/lib/googleauth/application_default.rb +11 -11
  19. data/lib/googleauth/client_id.rb +16 -16
  20. data/lib/googleauth/compute_engine.rb +27 -27
  21. data/lib/googleauth/credentials.rb +35 -37
  22. data/lib/googleauth/credentials_loader.rb +64 -67
  23. data/lib/googleauth/default_credentials.rb +18 -18
  24. data/lib/googleauth/iam.rb +9 -9
  25. data/lib/googleauth/json_key_reader.rb +6 -6
  26. data/lib/googleauth/scope_util.rb +11 -11
  27. data/lib/googleauth/service_account.rb +42 -42
  28. data/lib/googleauth/signet.rb +15 -17
  29. data/lib/googleauth/stores/file_token_store.rb +8 -8
  30. data/lib/googleauth/stores/redis_token_store.rb +17 -17
  31. data/lib/googleauth/token_store.rb +6 -6
  32. data/lib/googleauth/user_authorizer.rb +55 -59
  33. data/lib/googleauth/user_refresh.rb +27 -27
  34. data/lib/googleauth/version.rb +1 -1
  35. data/lib/googleauth/web_user_authorizer.rb +55 -56
  36. data/spec/googleauth/apply_auth_examples.rb +46 -46
  37. data/spec/googleauth/client_id_spec.rb +54 -54
  38. data/spec/googleauth/compute_engine_spec.rb +41 -41
  39. data/spec/googleauth/credentials_spec.rb +97 -97
  40. data/spec/googleauth/get_application_default_spec.rb +114 -114
  41. data/spec/googleauth/iam_spec.rb +25 -25
  42. data/spec/googleauth/scope_util_spec.rb +24 -24
  43. data/spec/googleauth/service_account_spec.rb +204 -194
  44. data/spec/googleauth/signet_spec.rb +37 -38
  45. data/spec/googleauth/stores/file_token_store_spec.rb +12 -12
  46. data/spec/googleauth/stores/redis_token_store_spec.rb +11 -11
  47. data/spec/googleauth/stores/store_examples.rb +16 -16
  48. data/spec/googleauth/user_authorizer_spec.rb +120 -121
  49. data/spec/googleauth/user_refresh_spec.rb +151 -146
  50. data/spec/googleauth/web_user_authorizer_spec.rb +66 -66
  51. data/spec/spec_helper.rb +19 -19
  52. metadata +4 -6
  53. data/.kokoro/common.cfg +0 -22
  54. data/.travis.yml +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e646bac53d9ec3282d73ffc1110581dbd52a36d89a5ad3e78d2d7b6cb998f6c
4
- data.tar.gz: ed9f5ff32c8a8093dbfba02266c2f50544572dda9ed5e77e081ff6eabdcd2ac4
3
+ metadata.gz: 25babf8085ee83a898e246364f5f177b31cdaebd1a7721650a4601ca9a568335
4
+ data.tar.gz: a62751620c543425fc7a8d83b07bb2a77b0d5e94c7dc5a790808115c17173f07
5
5
  SHA512:
6
- metadata.gz: b4bf425795f1274eee8197d50bf2d8ec433881eee828081ee8e4ec6b078357b6a1c1a72b177dd81e0fa91170f0aad69dc5c937e134b813215caec095630259bd
7
- data.tar.gz: 216d5d6ae1dbc594247686eec49447a3a7a3dac7ccea3d5245ee6571ae446c1186bfd7ac41223f8d0f325abe5b444162a66248c4b2c8bc5e5d5cf5b3a4e5ff67
6
+ metadata.gz: 6309bd3fe40fecbb4a19e4cb0196400a4a8fe75dabe540c878eada5e454a1b1491cbbdad537523689901be4f51f6a8270440fc7f1535660c730298b764e77aa0
7
+ data.tar.gz: 52c8eb2d015b1442ff2c13bd13b86c40931d50f1eeedbc6fcaa2c278bfc2ed3a29199685f57c3540f110d90f693a32cee92e3ee1305da9507c4a307cc2f15555
@@ -1,36 +1,4 @@
1
1
  #!/bin/bash
2
2
 
3
- # This file runs tests for merges, PRs, and nightlies.
4
- # There are a few rules for what tests are run:
5
- # * PRs run all non-acceptance tests for every library.
6
- # * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries.
7
- # * Nightlies run all acceptance tests for every library.
8
-
9
- set -eo pipefail
10
-
11
- # Debug: show build environment
12
- env | grep KOKORO
13
-
14
- cd github/google-auth-library-ruby/
15
-
16
- # Print out Ruby version
17
- ruby --version
18
-
19
- # Temporary workaround for a known bundler+docker issue:
20
- # https://github.com/bundler/bundler/issues/6154
21
- export BUNDLE_GEMFILE=
22
-
23
- RUBY_VERSIONS=("2.3.8" "2.4.5" "2.5.3")
24
-
25
- # Capture failures
26
- EXIT_STATUS=0 # everything passed
27
- function set_failed_status {
28
- EXIT_STATUS=1
29
- }
30
-
31
- for version in "${RUBY_VERSIONS[@]}"; do
32
- rbenv global "$version"
33
- (bundle update && bundle exec rake) || set_failed_status
34
- done
35
-
36
- exit $EXIT_STATUS
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
@@ -17,3 +17,8 @@ env_vars: {
17
17
  key: "JOB_TYPE"
18
18
  value: "continuous"
19
19
  }
20
+
21
+ env_vars: {
22
+ key: "REPO_DIR"
23
+ value: "github/google-auth-library-ruby"
24
+ }
@@ -6,7 +6,7 @@ build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
6
6
  # Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/ruby-multi
7
7
  env_vars: {
8
8
  key: "TRAMPOLINE_IMAGE"
9
- value: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-ruby/ruby-multi-ubuntu"
9
+ value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/ruby-multi"
10
10
  }
11
11
 
12
12
  env_vars: {
@@ -1,35 +1,4 @@
1
1
  #!/bin/bash
2
2
 
3
- # This file runs tests for merges, PRs, and nightlies.
4
- # There are a few rules for what tests are run:
5
- # * PRs run all non-acceptance tests for every library.
6
- # * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries.
7
- # * Nightlies run all acceptance tests for every library.
8
- # * Currently only runs tests on 2.5.0
9
-
10
- set -eo pipefail
11
-
12
- # Debug: show build environment
13
- env | grep KOKORO
14
-
15
- cd github/google-auth-library-ruby/
16
-
17
- # Print out Ruby version
18
- ruby --version
19
-
20
- # Temporary workaround for a known bundler+docker issue:
21
- # https://github.com/bundler/bundler/issues/6154
22
- export BUNDLE_GEMFILE=
23
-
24
- # Capture failures
25
- EXIT_STATUS=0 # everything passed
26
- function set_failed_status {
27
- EXIT_STATUS=1
28
- }
29
-
30
- gem install bundle
31
-
32
-
33
- (bundle update && bundle exec rake) || set_failed_status
34
-
35
- exit $EXIT_STATUS
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
@@ -17,3 +17,8 @@ env_vars: {
17
17
  key: "JOB_TYPE"
18
18
  value: "presubmit"
19
19
  }
20
+
21
+ env_vars: {
22
+ key: "REPO_DIR"
23
+ value: "github/google-auth-library-ruby"
24
+ }
@@ -5,7 +5,7 @@ build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
5
5
  # Configure the docker image for kokoro-trampoline.
6
6
  env_vars: {
7
7
  key: "TRAMPOLINE_IMAGE"
8
- value: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-ruby/ruby-multi-ubuntu"
8
+ value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/ruby-multi"
9
9
  }
10
10
 
11
11
  env_vars: {
@@ -0,0 +1,53 @@
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
+ # Fetch the token needed for reporting release status to GitHub
11
+ before_action {
12
+ fetch_keystore {
13
+ keystore_resource {
14
+ keystore_config_id: 73713
15
+ keyname: "yoshi-automation-github-key"
16
+ }
17
+ }
18
+ }
19
+
20
+ # Download resources for system tests (service account key, etc.)
21
+ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby"
22
+
23
+ # Download trampoline resources.
24
+ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
25
+
26
+ # Use the trampoline script to run in docker.
27
+ build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
28
+
29
+ # Configure the docker image for kokoro-trampoline.
30
+ env_vars: {
31
+ key: "TRAMPOLINE_IMAGE"
32
+ value: "gcr.io/cloud-devrel-kokoro-resources/google-cloud-ruby/ruby-release"
33
+ }
34
+
35
+ env_vars: {
36
+ key: "TRAMPOLINE_BUILD_FILE"
37
+ value: "github/google-auth-library-ruby/.kokoro/build.sh"
38
+ }
39
+
40
+ env_vars: {
41
+ key: "JOB_TYPE"
42
+ value: "release"
43
+ }
44
+
45
+ env_vars: {
46
+ key: "OS"
47
+ value: "linux"
48
+ }
49
+
50
+ env_vars: {
51
+ key: "REPO_DIR"
52
+ value: "github/google-auth-library-ruby"
53
+ }
@@ -1,24 +1,4 @@
1
1
  #!/bin/bash
2
- # Copyright 2017 Google Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- set -eo pipefail
16
- # Always run the cleanup script, regardless of the success of bouncing into
17
- # the container.
18
- function cleanup() {
19
- chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
20
- ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
21
- echo "cleanup";
22
- }
23
- trap cleanup EXIT
24
- python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
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
@@ -1,32 +1,4 @@
1
1
  #!/bin/bash
2
2
 
3
- # This file runs tests for merges, PRs, and nightlies.
4
- # There are a few rules for what tests are run:
5
- # * PRs run all non-acceptance tests for every library.
6
- # * Merges run all non-acceptance tests for every library, and acceptance tests for all altered libraries.
7
- # * Nightlies run all acceptance tests for every library.
8
- # * Currently only runs tests on 2.5.1
9
-
10
- set -eo pipefail
11
-
12
- # Debug: show build environment
13
- env | grep KOKORO
14
-
15
- cd github/google-auth-library-ruby/
16
-
17
- # Print out Ruby version
18
- ruby --version
19
-
20
- # Temporary workaround for a known bundler+docker issue:
21
- # https://github.com/bundler/bundler/issues/6154
22
- export BUNDLE_GEMFILE=
23
-
24
- # Capture failures
25
- EXIT_STATUS=0 # everything passed
26
- function set_failed_status {
27
- EXIT_STATUS=1
28
- }
29
-
30
- (bundle update && bundle exec rake) || set_failed_status
31
-
32
- exit $EXIT_STATUS
3
+ script_url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/windows.sh"
4
+ curl -o master-windows.sh $script_url && source master-windows.sh
@@ -1,28 +1,11 @@
1
+ inherit_gem:
2
+ google-style: google-style.yml
3
+
1
4
  AllCops:
2
5
  Exclude:
3
6
  - "spec/**/*"
4
-
5
- Metrics/AbcSize:
6
- Max: 25
7
- Metrics/BlockLength:
8
- Exclude:
9
- - "googleauth.gemspec"
10
- Metrics/CyclomaticComplexity:
11
- Max: 8
12
- Metrics/MethodLength:
13
- Max: 20
14
- Metrics/ModuleLength:
15
- Max: 150
7
+ - "Rakefile"
16
8
  Metrics/ClassLength:
17
- Enabled: false
18
- Layout/IndentHeredoc:
19
- Enabled: false
20
- Style/FormatString:
21
- Enabled: false
22
- Style/GuardClause:
23
- Enabled: false
24
- Style/PercentLiteralDelimiters: # Contradicting rule
25
- Enabled: false
26
- Style/SymbolArray: # Undefined syntax in Ruby 1.9.3
27
- Enabled: false
28
-
9
+ Max: 110
10
+ Metrics/ModuleLength:
11
+ Max: 110
@@ -1,83 +1,76 @@
1
- ## 0.8.0 (2019/01/02)
1
+ ### 0.8.1 / 2019-03-27
2
+
3
+ * Silence unnecessary gcloud warning
4
+ * Treat empty credentials environment variables as unset
5
+
6
+ ### 0.8.0 / 2019-01-02
2
7
 
3
8
  * 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.
4
9
  * Removed an unnecessary warning about project IDs.
5
10
 
6
- ## 0.7.1 (2018/10/25)
11
+ ### 0.7.1 / 2018-10-25
7
12
 
8
13
  * Make load_gcloud_project_id module function.
9
14
 
10
- ## 0.7.0 (2018/10/24)
15
+ ### 0.7.0 / 2018-10-24
11
16
 
12
17
  * Add project_id instance variable to UserRefreshCredentials, ServiceAccountCredentials, and Credentials.
13
18
 
14
- ## 0.6.7 (2018/10/16)
19
+ ### 0.6.7 / 2018-10-16
15
20
 
16
21
  * Update memoist dependency to ~> 0.16.
17
22
 
18
- ## 0.6.6 (2018/08/22)
23
+ ### 0.6.6 / 2018-08-22
19
24
 
20
25
  * Remove ruby version warnings.
21
26
 
22
- ## 0.6.5 (2018/08/16)
27
+ ### 0.6.5 / 2018-08-16
23
28
 
24
29
  * Fix incorrect http verb when revoking credentials.
25
30
  * Warn on EOL ruby versions.
26
31
 
27
- ## 0.6.4 (2018/08/03)
32
+ ### 0.6.4 / 2018-08-03
28
33
 
29
34
  * Resolve issue where DefaultCredentials constant was undefined.
30
35
 
31
- ## 0.6.3 (2018/08/02)
36
+ ### 0.6.3 / 2018-08-02
32
37
 
33
38
  * Resolve issue where token_store was being written to twice
34
39
 
35
- ## 0.6.2 (2018/08/01)
40
+ ### 0.6.2 / 2018-08-01
36
41
 
37
42
  * Add warning when using cloud sdk credentials
38
43
 
39
- ## 0.6.1 (2017/10/18)
44
+ ### 0.6.1 / 2017-10-18
40
45
 
41
46
  * Fix file permissions
42
47
 
43
- ## 0.6.0 (2017/10/17)
44
-
45
- ### Changes
48
+ ### 0.6.0 / 2017-10-17
46
49
 
47
50
  * Support ruby-jwt 2.0
48
51
  * Add simple credentials class
49
52
 
50
- ## 0.5.3 (2017/07/21)
51
-
52
- ### Changes
53
+ ### 0.5.3 / 2017-07-21
53
54
 
54
55
  * Fix file permissions on the gem's `.rb` files.
55
56
 
56
- ## 0.5.2 (2017/07/19)
57
-
58
- ### Changes
57
+ ### 0.5.2 / 2017-07-19
59
58
 
60
59
  * Add retry mechanism when fetching access tokens in `GCECredentials` and `UserRefreshCredentials` classes.
61
60
  * Update Google API OAuth2 token credential URI to v4.
62
61
 
63
- ## 0.5.1 (2016/01/06)
64
-
65
- ### Changes
62
+ ### 0.5.1 / 2016-01-06
66
63
 
67
64
  * Change header name emitted by `Client#apply` from "Authorization" to "authorization" ([@murgatroid99][])
68
65
  * Fix ADC not working on some windows machines ([@vsubramani][])
69
66
  [#55](https://github.com/google/google-auth-library-ruby/issues/55)
70
67
 
71
- ## 0.5.0 (2015/10/12)
72
-
73
- ### Changes
68
+ ### 0.5.0 / 2015-10-12
74
69
 
75
70
  * Initial support for user credentials ([@sqrrrl][])
76
71
  * Update Signet to 0.7
77
72
 
78
- ## 0.4.2 (2015/08/05)
79
-
80
- ### Changes
73
+ ### 0.4.2 / 2015-08-05
81
74
 
82
75
  * Updated UserRefreshCredentials hash to use string keys ([@haabaato][])
83
76
  [#36](https://github.com/google/google-auth-library-ruby/issues/36)
@@ -91,27 +84,19 @@
91
84
  * Relax the constraint of dependent version of multi_json ([@igrep][])
92
85
  [#30](https://github.com/google/google-auth-library-ruby/issues/30)
93
86
 
94
- ### Changes
95
-
96
87
  * Enables passing credentials via environment variables. ([@haabaato][])
97
88
  [#27](https://github.com/google/google-auth-library-ruby/issues/27)
98
89
 
99
- ## 0.4.1 (2015/04/25)
100
-
101
- ### Changes
90
+ ### 0.4.1 / 2015-04-25
102
91
 
103
92
  * Improves handling of --no-scopes GCE authorization ([@tbetbetbe][])
104
93
  * Refactoring and cleanup ([@joneslee85][])
105
94
 
106
- ## 0.4.0 (2015/03/25)
107
-
108
- ### Changes
95
+ ### 0.4.0 / 2015-03-25
109
96
 
110
97
  * Adds an implementation of JWT header auth ([@tbetbetbe][])
111
98
 
112
- ## 0.3.0 (2015/03/23)
113
-
114
- ### Changes
99
+ ### 0.3.0 / 2015-03-23
115
100
 
116
101
  * makes the scope parameter's optional in all APIs. ([@tbetbetbe][])
117
102
  * changes the scope parameter's position in various constructors. ([@tbetbetbe][])
data/Gemfile CHANGED
@@ -1,22 +1,22 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in googleauth.gemspec
4
4
  gemspec
5
5
 
6
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 'logging', '~> 2.0'
12
- gem 'rack-test', '~> 0.6'
13
- gem 'rake', '~> 10.0'
14
- gem 'redis', '~> 3.2'
15
- gem 'rspec', '~> 3.0'
16
- gem 'rubocop', '>= 0.41', '< 0.50'
17
- gem 'simplecov', '~> 0.9'
18
- gem 'sinatra'
19
- gem 'webmock', '~> 1.21'
7
+ gem "bundler", ">= 1.9"
8
+ gem "coveralls", "~> 0.7"
9
+ gem "fakefs", "~> 0.6"
10
+ gem "fakeredis", "~> 0.5"
11
+ gem "google-style", "~> 0.2"
12
+ gem "logging", "~> 2.0"
13
+ gem "rack-test", "~> 0.6"
14
+ gem "rake", "~> 10.0"
15
+ gem "redis", "~> 3.2"
16
+ gem "rspec", "~> 3.0"
17
+ gem "simplecov", "~> 0.9"
18
+ gem "sinatra"
19
+ gem "webmock", "~> 1.21"
20
20
  end
21
21
 
22
22
  platforms :jruby do