From 4102354a9f94a403a4c616eb1cff0ce95e8ddb5f Mon Sep 17 00:00:00 2001 From: mjarmula Date: Wed, 29 Sep 2021 10:34:43 +0200 Subject: [PATCH] Add support for omniauth 2.0 --- omniauth-microsoft_graph.gemspec | 4 ++-- spec/omniauth/strategies/microsoft_graph_oauth2_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/omniauth-microsoft_graph.gemspec b/omniauth-microsoft_graph.gemspec index 59d9f4c..8cda244 100644 --- a/omniauth-microsoft_graph.gemspec +++ b/omniauth-microsoft_graph.gemspec @@ -18,8 +18,8 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency 'omniauth', '~> 1.1', '>= 1.1.1' - spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6' + spec.add_runtime_dependency 'omniauth', '~> 2.0.4' + spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.7.1' spec.add_development_dependency "sinatra", '~> 0' spec.add_development_dependency "rake", '~> 12.3.3', '>= 12.3.3' spec.add_development_dependency 'rspec', '~> 3.6' diff --git a/spec/omniauth/strategies/microsoft_graph_oauth2_spec.rb b/spec/omniauth/strategies/microsoft_graph_oauth2_spec.rb index dfc6790..81be2b9 100644 --- a/spec/omniauth/strategies/microsoft_graph_oauth2_spec.rb +++ b/spec/omniauth/strategies/microsoft_graph_oauth2_spec.rb @@ -243,6 +243,7 @@ describe '#callback_path' do it 'has the correct default callback path' do + allow(subject).to receive(:script_name).and_return('') expect(subject.callback_path).to eq('/auth/microsoft_graph/callback') end @@ -250,6 +251,11 @@ @options = { callback_path: '/auth/foo/callback' } expect(subject.callback_path).to eq('/auth/foo/callback') end + + it 'should set the callback_path with script_name if present' do + allow(subject).to receive(:script_name).and_return('/api/v1') + expect(subject.callback_path).to eq('/api/v1/auth/microsoft_graph/callback') + end end describe '#info' do