Commit Graph

64 Commits

Author SHA1 Message Date
Mike Moore a33a640e61
Credentials: Use methods instead of constants (#212)
Update Credentials to use methods for values that are intended to
be changed by users, replacing constants.
Add Credentials documentation.
2019-05-07 17:56:17 -06:00
Mike Moore f6e8355edd
Credentials Environment Variable Refactor (#211)
* Refactor env var methods
  Have the iteration return for the first match, instead of comparing
  all elements and choosing the first one that matches.
* Combine file and json credentials detection
  Allow an environment variable to contain either a file path
  or JSON to describe the credentials.
  This change matches how these variables are used in Google Cloud.
2019-05-01 15:04:48 -06:00
igorpeshansky 23f9b5071f Treat empty credentials environment variables as unset. (#205) 2019-03-27 10:55:08 -07:00
Graham Paye bf822910fa
add google-style and refactor (#203) 2019-03-15 12:34:54 -07:00
Daniel Azuma f0b95e72f9
Support configuration of the connection object used to fetch tokens (#185) 2019-01-02 14:42:42 -08:00
Graham Paye 0d2becbdcd
make load_gcloud_project_id module function (#170) 2018-10-26 12:17:12 -07:00
Graham Paye f0b0c6f8e8
Add project_id instance variable (#167) 2018-10-24 09:23:37 -07:00
Graham Paye 7e42656b1c
make tests windows friendly (#164) 2018-10-10 18:23:50 -07:00
Tadas Tamošauskas e521abd799 Fix auth token revocation (#157) 2018-08-15 12:50:16 -07:00
Thea Flowers af69fc5347 Use new auth URIs (#147) 2018-08-01 13:42:29 -07:00
Graham Paye 5d42d3b4be
Warn when using cloud sdk credentials (#145)
* Issue warning when cloud sdk credentials are used.
2018-07-18 13:54:03 -07:00
Daniel Azuma 9232aa3176
Unescape private_key loaded from ENV (#132) 2018-06-05 09:56:48 -07:00
Mike Moore 9f395a2338 Fix Credentials.default bug
If no PATH_ENV_VARS were found Credentials.default would return an empty array.
Update each default lookup method to return nil if no match was found.
Fix call to from_default_paths method, was calling from_default_vars instead.
Add spec coverage for path, json, and default cases.
Add spec coverage for application_default case.
Fix spec coverage to check the return type from calling Credentials.default.
2017-11-10 15:59:34 -07:00
Mike Moore 4c4e6cef21 Add focus config to RSpec
This allows us to focus on specs by changing it to fit.
2017-11-10 15:42:48 -07:00
Ernest Landrito c148fc12bb Add simple credentials class. (#122)
* Add simple credentials class

* 1.9.3 fix

* Review fixes

* Move  into it's own file. Cleanup require statements
2017-10-12 09:19:43 -07:00
Jurriaan Pruis 2e9841e084 Support ruby-jwt 2.0
This version of ruby-jwt requires specification of the algorithm (see
jwt/ruby-jwt#184) for more information.

I've created a PR on signet to. That has to be merged before ruby-jwt
2.0 can be really used (see https://github.com/google/signet/pull/93).

Tested locally against ruby-jwt 2.0 and 1.5.6.
2017-09-16 01:11:12 +02:00
Edward Betts 62c3761727 correct spelling mistake (#115) 2017-09-01 17:14:34 -07:00
Heng Xiong 0dab02dbaa Merge pull request #112 from hxiong388/new-token-uri
Upgrade to new token URI
2017-07-17 11:47:53 -07:00
Heng Xiong f2b5b8ac98 Upgrade to new token URI 2017-07-17 11:14:06 -07:00
Kazuhiro Serizawa 40f4e166a2 Use retry_with_error in UserRefreshCredentials#revoke! 2017-07-14 07:53:35 +09:00
Kazuhiro Serizawa a1a9387c2b Use retry_with_error in GCECredentials#fetch_access_token 2017-07-14 07:53:35 +09:00
Kazuhiro Serizawa 9fda76427a Use normalcase for variable numbers. 2017-02-25 23:27:52 +09:00
Kazuhiro Serizawa a67e5297c2 rubocop autocorrect: Fix empty method definition 2017-02-25 23:27:04 +09:00
nicholas shook 82a4f8520c added ruby 2.3 compatability
also:

* updated rubocop and applied styling
* made small test refactorings (using the expect block notation)
* made a small refactor to remove an unnecessary ``return credentials``
* bumped the version
2016-07-13 15:45:46 -07:00
murgatroid99 6991904343 Use lowercase :authorization for metadata key 2016-01-05 13:58:50 -08:00
Steven Bazyl b78ebc4ab8 Remove blank link to appease rubocop 2015-12-11 12:39:43 -08:00
Steven Bazyl ebdc177aeb Remove dead codeblock leftover after moving to webmock, enable coverage output locally 2015-12-11 12:10:50 -08:00
Steven Bazyl b46a7dc82c Prep for 0.5 release, update unit tests to use webmock instead of Faraday stubs (due to fragility -- sensitive to internal changes made in signet) 2015-12-09 15:45:22 -08:00
Steven Bazyl 8ac3dcff8f Preload multijson adapter to avoid loading adapter while FakeFS enabled 2015-11-11 15:50:17 -08:00
Steven Bazyl cdc12a2c08 3LO support round 2 - web support 2015-10-14 14:26:21 -07:00
Steven Bazyl e903a12563 Base version of 3LO support. 2015-10-14 13:54:03 -07:00
Tim Emiola 19b32b47d8 Fixes styles issues before releasing
- also update .travis.yml to use new infrastructure
2015-08-06 12:50:23 -07:00
Tim Emiola 1463e5f5f9 Merge pull request #33 from mr-salty/add-system-default-creds-path
Add support for a system default credentials file.
2015-07-10 15:08:19 +02:00
Tim Emiola 4c057404e6 Merge pull request #35 from mr-salty/fix-env-var-test
Fix a failing test introduced in #28.
2015-07-10 14:01:40 +02:00
Tim Emiola caed076711 Merge pull request #34 from mr-salty/fix-raise-error
Fix 'raise_error' WARNINGs.
2015-07-07 15:25:14 +01:00
Todd Derr b31df0caaa Fix rubocop errors (long line wrapping). 2015-06-30 17:47:16 -04:00
Todd Derr f0de3295fc Fix some issues discovered by rubocop.
fix failures due to:
- misformatting of wrapped lines
- a superflous block (and temp dir creation) due to overzealous cut & paste.
2015-06-30 17:42:30 -04:00
Todd Derr 883fb14147 Fix a failing test introduced in #28.
The environment variables in the 'fails if env vars are set' test
were not actually being set because they used a nonexistent hash key
(which has the effect of unsetting the environment variable).
2015-06-29 17:01:19 -04:00
Todd Derr c04e91569d Eliminate a new 'raise_error' WARNING.
I have another outstanding PR to fix these; so avoid introducing
another one here.
2015-06-29 16:56:42 -04:00
Todd Derr 60a079a41e Fix 'raise_error' WARNINGs.
rspec spews a warning when using raise_error without a specific error;
add "RuntimeError" to all of these occurrences.
2015-06-29 16:50:55 -04:00
Todd Derr 86de5fe13b Add support for a system default credentials file.
The path is:
  - windows: %ProgramData%\Google\Auth\application_default_credentials.json
  - other: /etc/google/auth/application_default_credentials.json
2015-06-29 16:35:45 -04:00
David Wilkie 15fbf92199 Fix bug where loading credentials from ENV doesn't set the credentials in the UserRefreshCredentials 2015-06-26 14:31:09 +07:00
Herbert Siojo 5061fb5add Enables reading credentials from env vars.
- ServiceAccountCredentials, ServiceAccountJwtHeaderCredentials
and UserRefreshCredentials initializers now take keyword args
via options hash.

- In `credentials_loader.rb`, refactored env var checking into
private methods

- Updated tests & added new tests.

- Fixed existing test for #from_well_known_path 'fails if
the file is invalid', where `from_env` was called instead of
`from_well_known_path`.

- Fixed rubocop errors I introduced, but two existing ones remain.

- Added entry to changelog.

- Fixed rubocop errors from code containing parallel assignments

- Updated rubocop_todo.yml to ignore parallel assignments and
trailing underscore assignments.
2015-05-21 13:38:19 -07:00
Tim Emiola 133e05cf4a Merge pull request #24 from tbetbetbe/ruby-auth-add-iam-creds
Adds an implementation of IAMCredentials
2015-04-30 14:47:15 -04:00
Tim Emiola fe1c46cc14 Corrects grammar 2015-04-23 11:21:31 -07:00
Tim Emiola 98816f7b67 Adds more robust checking of the status code during compute engine auth.
Currently the implementation does not verify that a 200 response is received
before attempting to parse the JSON response.

This PR updates the behaviour to fail with an authorization error, similar to
how other auth library implementations.
2015-04-23 09:50:11 -07:00
Tim Emiola 1560686f3a Adds an implementation of IAMCredentials 2015-04-22 15:40:56 -07:00
Trung Lê 66ae035cce More refactoring to please rubocop 2015-04-08 11:10:25 +10:00
Tim Emiola c4bde552e6 Promote ServiceAccountCredentials when scope is nil
- if the ServiceAccountCredentials#apply is called when the scope is not set,
  authentication with the equivalent ServiceAccountJwtHeaderCredentials instance
  is attempted.
2015-03-23 21:35:07 -07:00
Tim Emiola 53ec6fce3b Splits the JWTHeader creds into its own class 2015-03-23 20:08:46 -07:00