Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cf-uaa-lib to latest one. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

source 'http://rubygems.org'

gem 'cf-uaa-lib', '~> 1.3.7'

gemspec

group :example do
Expand Down
35 changes: 17 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
PATH
remote: .
specs:
omniauth-uaa-oauth2 (0.0.3)
cf-uaa-lib (>= 1.3.1, < 2.0)
cf-uaa-lib (>= 1.3.1, < 2.0)
omniauth-uaa-oauth2 (0.0.4)
cf-uaa-lib (~> 2.0.1)
cf-uaa-lib (~> 2.0.1)
omniauth (~> 1.0)

GEM
remote: http://rubygems.org/
specs:
cf-uaa-lib (1.3.7)
cf-uaa-lib (2.0.1)
multi_json
diff-lcs (1.1.3)
hashie (2.0.5)
multi_json (1.6.0)
omniauth (1.1.4)
hashie (>= 1.2, < 3)
hashie (3.4.1)
multi_json (1.11.0)
omniauth (1.2.2)
hashie (>= 1.2, < 4)
rack (~> 1.0)
rack (1.6.0)
rack-protection (1.5.3)
rack
rack (1.4.1)
rack-protection (1.2.0)
rack
rake (0.9.2.2)
rake (10.4.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
Expand All @@ -29,17 +29,16 @@ GEM
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
tilt (2.0.1)

PLATFORMS
ruby

DEPENDENCIES
cf-uaa-lib (~> 1.3.7)
omniauth-uaa-oauth2!
rake
rspec (~> 2.6.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/cloudfoundry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def callback_phase
end

def raw_info
@raw_info ||= CF::UAA::Misc.whoami(@token_server_url, self.access_token.auth_header)
@raw_info ||= CF::UAA::Info.new(@token_server_url).whoami(self.access_token.auth_header)
rescue CF::UAA::TargetError => e
log :error, "#{e.message}: #{e.info}"
{}
Expand Down
6 changes: 2 additions & 4 deletions omniauth-uaa-oauth2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
require File.expand_path('../lib/omniauth/uaa_oauth2/version', __FILE__)

Gem::Specification.new do |gem|
gem.add_dependency 'omniauth', '~> 1.0'
gem.add_dependency 'cf-uaa-lib', ['>= 1.3.1', '< 2.0']

gem.authors = ["Joel D'sa", "Dave Syer", "Dale Olds", "Vidya Valmikinathan", "Luke Taylor"]
gem.email = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
gem.description = %q{An OmniAuth strategy for the Cloudfoundry UAA}
Expand All @@ -31,7 +28,8 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = OmniAuth::Cloudfoundry::VERSION

gem.add_runtime_dependency 'cf-uaa-lib', ['>= 1.3.1', '< 2.0']
gem.add_dependency 'omniauth', '~> 1.0'
gem.add_dependency 'cf-uaa-lib', '~> 2.0.1'

gem.add_development_dependency 'rspec', '~> 2.6.0'
gem.add_development_dependency 'rake'
Expand Down
8 changes: 4 additions & 4 deletions spec/omniauth/strategies/uaa_oauth2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def app; lambda{|env| [200, {}, ["Hello."]]} end
subject.stub(:env).and_return({})
subject.stub(:expired?) { true }
@request.stub(:query_string)
CF::UAA::Misc.stub(:whoami) { {
CF::UAA::Info.stub(:whoami) { {
"omniauth.auth" => "something"
} }
end
Expand Down Expand Up @@ -140,19 +140,19 @@ def app; lambda{|env| [200, {}, ["Hello."]]} end
end

after do
CF::UAA::Misc.rspec_reset
CF::UAA::Info.rspec_reset
OmniAuth.config.logger = @omni_logger
end

it 'should return raw info' do
CF::UAA::Misc.stub(:whoami) { "something" }
CF::UAA::Info.stub(:whoami) { "something" }

subject.access_token = OmniAuth::Strategies::CFAccessToken.new
subject.raw_info.should_not be_empty
end

it 'should rescue, log, and return empty hash on target error' do
CF::UAA::Misc.stub(:whoami).and_raise(CF::UAA::TargetError)
CF::UAA::Info.stub(:whoami).and_raise(CF::UAA::TargetError)
logger = double("logger")
logger.should_receive(:error).once
OmniAuth.config.logger = logger
Expand Down