Merge pull request #45 from tbetbetbe/ruby-auth-release-0.4.2

Ruby auth release 0.4.2
This commit is contained in:
Tim Emiola 2015-08-06 12:57:36 -07:00
commit 38bd991ac7
7 changed files with 46 additions and 21 deletions

View File

@ -13,13 +13,3 @@ Metrics/AbcSize:
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/MethodLength: Metrics/MethodLength:
Max: 13 Max: 13
# Offense count: 1
# Cop supports --auto-correct.
Performance/ParallelAssignment:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/TrailingUnderscoreVariable:
Enabled: false

View File

@ -1,3 +1,4 @@
sudo: false
language: ruby language: ruby
rvm: rvm:
- 2.2 - 2.2
@ -7,10 +8,24 @@ rvm:
- rbx-2 - rbx-2
- jruby - jruby
script: "bundle exec rake" script: "bundle exec rake"
addons:
apt:
packages:
- idn
- build-essential # this and below attempt allow rubinius to be setup ok
- bison
- ruby-dev
- rake zlib1g-dev
- libyaml-dev
- libssl-dev
- libreadline-dev
- libncurses5-dev
- llvm
- llvm-dev
- libeditline-dev
- libedit-dev
before_install: before_install:
- gem update bundler - gem update bundler
- sudo apt-get update
- sudo apt-get install idn
notifications: notifications:
email: email:
recipients: recipients:

View File

@ -1,3 +1,19 @@
## 0.4.2 (05/08/2015)
### Changes
* Updated UserRefreshCredentials hash to use string keys ([@haabator][])
[#36](https://github.com/google/google-auth-library-ruby/issues/36)
* Add support for a system default credentials file. ([@mr-salty][])
[#33](https://github.com/google/google-auth-library-ruby/issues/33)
* Fix bug when loading credentials from ENV ([@dwilkie][])
[#31](https://github.com/google/google-auth-library-ruby/issues/31)
* Relax the constraint of dependent version of multi_json ([@igrep][])
[#30](https://github.com/google/google-auth-library-ruby/issues/30)
### Changes ### Changes
* Enables passing credentials via environment variables. ([@haabaato][]) * Enables passing credentials via environment variables. ([@haabaato][])
@ -23,6 +39,9 @@
* makes the scope parameter's optional in all APIs. ([@tbetbetbe][]) * makes the scope parameter's optional in all APIs. ([@tbetbetbe][])
* changes the scope parameter's position in various constructors. ([@tbetbetbe][]) * changes the scope parameter's position in various constructors. ([@tbetbetbe][])
[@tbetbetbe]: https://github.com/tbetbetbe [@dwilkie]: https://github.com/dwilkie
[@joneslee85]: https://github.com/joneslee85
[@haabaato]: https://github.com/haabaato [@haabaato]: https://github.com/haabaato
[@igrep]: https://github.com/igrep
[@joneslee85]: https://github.com/joneslee85
[@mr-salty]: https://github.com/mr-salty
[@tbetbetbe]: https://github.com/tbetbetbe

View File

@ -91,7 +91,8 @@ module Google
# #
# @param scope [string|array|nil] the scope(s) to access # @param scope [string|array|nil] the scope(s) to access
def from_well_known_path(scope = nil) def from_well_known_path(scope = nil)
home_var, base = windows? ? 'APPDATA' : 'HOME', WELL_KNOWN_PATH home_var = windows? ? 'APPDATA' : 'HOME'
base = WELL_KNOWN_PATH
root = ENV[home_var].nil? ? '' : ENV[home_var] root = ENV[home_var].nil? ? '' : ENV[home_var]
base = File.join('.config', base) unless windows? base = File.join('.config', base) unless windows?
path = File.join(root, base) path = File.join(root, base)

View File

@ -31,6 +31,6 @@ module Google
# Module Auth provides classes that provide Google-specific authorization # Module Auth provides classes that provide Google-specific authorization
# used to access Google APIs. # used to access Google APIs.
module Auth module Auth
VERSION = '0.4.1' VERSION = '0.4.2'
end end
end end

View File

@ -71,10 +71,10 @@ describe '#get_application_default' do
{ 'Metadata-Flavor' => 'Google' }, { 'Metadata-Flavor' => 'Google' },
''] '']
end end
end # GCE not detected end # GCE not detected
Dir.mktmpdir do |dir| Dir.mktmpdir do |dir|
ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var
ENV['HOME'] = dir # no config present in this tmp dir ENV['HOME'] = dir # no config present in this tmp dir
c = Faraday.new do |b| c = Faraday.new do |b|
b.adapter(:test, stubs) b.adapter(:test, stubs)
end end
@ -127,10 +127,10 @@ describe '#get_application_default' do
{ 'Metadata-Flavor' => 'Google' }, { 'Metadata-Flavor' => 'Google' },
''] '']
end end
end # GCE detected end # GCE detected
Dir.mktmpdir do |dir| Dir.mktmpdir do |dir|
ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var
ENV['HOME'] = dir # no config present in this tmp dir ENV['HOME'] = dir # no config present in this tmp dir
c = Faraday.new do |b| c = Faraday.new do |b|
b.adapter(:test, stubs) b.adapter(:test, stubs)
end end

View File

@ -54,7 +54,7 @@ shared_examples 'jwt header auth' do
expect(hdr).to_not be_nil expect(hdr).to_not be_nil
expect(hdr.start_with?(auth_prefix)).to be true expect(hdr.start_with?(auth_prefix)).to be true
authorization = hdr[auth_prefix.length..-1] authorization = hdr[auth_prefix.length..-1]
payload, _ = JWT.decode(authorization, @key.public_key) payload, = JWT.decode(authorization, @key.public_key)
expect(payload['aud']).to eq(test_uri) expect(payload['aud']).to eq(test_uri)
expect(payload['iss']).to eq(client_email) expect(payload['iss']).to eq(client_email)
end end