googleauth 0.5.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +7 -0
  3. data/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +5 -4
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
  6. data/.github/ISSUE_TEMPLATE/support_request.md +7 -0
  7. data/.kokoro/build.bat +16 -0
  8. data/.kokoro/build.sh +4 -0
  9. data/.kokoro/continuous/common.cfg +24 -0
  10. data/.kokoro/continuous/linux.cfg +25 -0
  11. data/.kokoro/continuous/osx.cfg +8 -0
  12. data/.kokoro/continuous/post.cfg +30 -0
  13. data/.kokoro/continuous/windows.cfg +29 -0
  14. data/.kokoro/osx.sh +4 -0
  15. data/.kokoro/presubmit/common.cfg +24 -0
  16. data/.kokoro/presubmit/linux.cfg +24 -0
  17. data/.kokoro/presubmit/osx.cfg +8 -0
  18. data/.kokoro/presubmit/windows.cfg +29 -0
  19. data/.kokoro/release.cfg +94 -0
  20. data/.kokoro/trampoline.bat +10 -0
  21. data/.kokoro/trampoline.sh +4 -0
  22. data/.repo-metadata.json +5 -0
  23. data/.rubocop.yml +19 -1
  24. data/CHANGELOG.md +112 -19
  25. data/CODE_OF_CONDUCT.md +43 -0
  26. data/Gemfile +19 -13
  27. data/{COPYING → LICENSE} +0 -0
  28. data/README.md +58 -18
  29. data/Rakefile +126 -9
  30. data/googleauth.gemspec +28 -25
  31. data/integration/helper.rb +31 -0
  32. data/integration/id_tokens/key_source_test.rb +74 -0
  33. data/lib/googleauth.rb +7 -96
  34. data/lib/googleauth/application_default.rb +81 -0
  35. data/lib/googleauth/client_id.rb +21 -19
  36. data/lib/googleauth/compute_engine.rb +70 -43
  37. data/lib/googleauth/credentials.rb +442 -0
  38. data/lib/googleauth/credentials_loader.rb +117 -43
  39. data/lib/googleauth/default_credentials.rb +93 -0
  40. data/lib/googleauth/iam.rb +11 -11
  41. data/lib/googleauth/id_tokens.rb +233 -0
  42. data/lib/googleauth/id_tokens/errors.rb +71 -0
  43. data/lib/googleauth/id_tokens/key_sources.rb +394 -0
  44. data/lib/googleauth/id_tokens/verifier.rb +144 -0
  45. data/lib/googleauth/json_key_reader.rb +50 -0
  46. data/lib/googleauth/scope_util.rb +12 -12
  47. data/lib/googleauth/service_account.rb +74 -63
  48. data/lib/googleauth/signet.rb +55 -13
  49. data/lib/googleauth/stores/file_token_store.rb +8 -8
  50. data/lib/googleauth/stores/redis_token_store.rb +22 -22
  51. data/lib/googleauth/token_store.rb +6 -6
  52. data/lib/googleauth/user_authorizer.rb +80 -68
  53. data/lib/googleauth/user_refresh.rb +44 -35
  54. data/lib/googleauth/version.rb +1 -1
  55. data/lib/googleauth/web_user_authorizer.rb +77 -68
  56. data/rakelib/devsite_builder.rb +45 -0
  57. data/rakelib/link_checker.rb +64 -0
  58. data/rakelib/repo_metadata.rb +59 -0
  59. data/spec/googleauth/apply_auth_examples.rb +74 -50
  60. data/spec/googleauth/client_id_spec.rb +75 -55
  61. data/spec/googleauth/compute_engine_spec.rb +98 -46
  62. data/spec/googleauth/credentials_spec.rb +478 -0
  63. data/spec/googleauth/get_application_default_spec.rb +149 -111
  64. data/spec/googleauth/iam_spec.rb +25 -25
  65. data/spec/googleauth/scope_util_spec.rb +26 -24
  66. data/spec/googleauth/service_account_spec.rb +269 -144
  67. data/spec/googleauth/signet_spec.rb +101 -30
  68. data/spec/googleauth/stores/file_token_store_spec.rb +12 -13
  69. data/spec/googleauth/stores/redis_token_store_spec.rb +11 -11
  70. data/spec/googleauth/stores/store_examples.rb +16 -16
  71. data/spec/googleauth/user_authorizer_spec.rb +153 -124
  72. data/spec/googleauth/user_refresh_spec.rb +186 -121
  73. data/spec/googleauth/web_user_authorizer_spec.rb +82 -69
  74. data/spec/spec_helper.rb +21 -19
  75. data/test/helper.rb +33 -0
  76. data/test/id_tokens/key_sources_test.rb +240 -0
  77. data/test/id_tokens/verifier_test.rb +269 -0
  78. metadata +87 -34
  79. data/.rubocop_todo.yml +0 -32
  80. data/.travis.yml +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e2b7b1cf21b1190e227d1c6da0e204a2eaf9a562
4
- data.tar.gz: e2bb3c3f74e40bea4ff997f3613f07815f8f78ab
2
+ SHA256:
3
+ metadata.gz: 8846e57d325ff993c15ca691e299b9c2c4b7472b1b0a9e905b36cdb99216e061
4
+ data.tar.gz: 2fcee29e36a6fd57420b9cd0106cf3ab73bf447e94e2f6bdce61a973d256cd5e
5
5
  SHA512:
6
- metadata.gz: f268b6486b2638195745c6750f256de0d4e703c9896bc6164b84c626eb6057ef6e6c159471d75215e3110cefe5c07c44180273d1ce6140fa1ffd8274272cb930
7
- data.tar.gz: 2cf2c5a305ecc069c01c7a0a3a848e45bceb449cf5a57c3a15906284a96dca9631b86c1e563cb6a5b1b3d25828ad7971e7a1e6315964b838bdbc0cfad8a5d499
6
+ metadata.gz: dd54bce055240fc1db34ccfe2850ab49f23b17f55f5336dfeccf380c2f93b8b9e29100a1c53f360564e8387805a9c4bf74d09eb2ca58b5bda666cdab3b061f45
7
+ data.tar.gz: 27dae4439e8163194604e912918709d2cd623c61856f70f7c350b08dfac010fdff50ad703934b88631c2759dcf7e5aab5b315a884cb160790c153115ee88bdfe
@@ -0,0 +1,7 @@
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
@@ -9,11 +9,12 @@ Please fill out either the individual or corporate Contributor License Agreement
9
9
  (CLA).
10
10
 
11
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
- (http://code.google.com/legal/individual-cla-v1.0.html).
12
+ own the intellectual property, then you'll need to sign an [individual CLA].
14
13
  * If you work for a company that wants to allow you to contribute your work,
15
- then you'll need to sign a [corporate CLA]
16
- (http://code.google.com/legal/corporate-cla-v1.0.html).
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
17
18
 
18
19
  Follow either of the two links above to access the appropriate CLA and
19
20
  instructions for how to sign and return it. Once we receive it, we'll be able to
@@ -0,0 +1,36 @@
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!
@@ -0,0 +1,21 @@
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.
@@ -0,0 +1,7 @@
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.
@@ -0,0 +1,16 @@
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%
@@ -0,0 +1,4 @@
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
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,30 @@
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
+ }
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,4 @@
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
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,94 @@
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
+ # Fetch magictoken to use with Magic Github Proxy
21
+ before_action {
22
+ fetch_keystore {
23
+ keystore_resource {
24
+ keystore_config_id: 73713
25
+ keyname: "releasetool-magictoken"
26
+ backend_type: FASTCONFIGPUSH
27
+ }
28
+ }
29
+ }
30
+
31
+ # Fetch api key to use with Magic Github Proxy
32
+ before_action {
33
+ fetch_keystore {
34
+ keystore_resource {
35
+ keystore_config_id: 73713
36
+ keyname: "magic-github-proxy-api-key"
37
+ backend_type: FASTCONFIGPUSH
38
+ }
39
+ }
40
+ }
41
+
42
+ before_action {
43
+ fetch_keystore {
44
+ keystore_resource {
45
+ keystore_config_id: 73713
46
+ keyname: "docuploader_service_account"
47
+ }
48
+ }
49
+ }
50
+
51
+ # Download resources for system tests (service account key, etc.)
52
+ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby"
53
+
54
+ # Download trampoline resources.
55
+ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
56
+
57
+ # Use the trampoline script to run in docker.
58
+ build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
59
+
60
+ # Configure the docker image for kokoro-trampoline.
61
+ env_vars: {
62
+ key: "TRAMPOLINE_IMAGE"
63
+ value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/release"
64
+ }
65
+
66
+ env_vars: {
67
+ key: "TRAMPOLINE_BUILD_FILE"
68
+ value: "github/google-auth-library-ruby/.kokoro/build.sh"
69
+ }
70
+
71
+ env_vars: {
72
+ key: "TRAMPOLINE_SCRIPT"
73
+ value: "trampoline_v1.py"
74
+ }
75
+
76
+ env_vars: {
77
+ key: "JOB_TYPE"
78
+ value: "release"
79
+ }
80
+
81
+ env_vars: {
82
+ key: "OS"
83
+ value: "linux"
84
+ }
85
+
86
+ env_vars: {
87
+ key: "REPO_DIR"
88
+ value: "github/google-auth-library-ruby"
89
+ }
90
+
91
+ env_vars: {
92
+ key: "PACKAGE"
93
+ value: "googleauth"
94
+ }