From a0a5039704a561b48c7ef96cf0867bc421e09941 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 10 Jan 2024 14:30:11 +0100 Subject: [PATCH] Add OmniAuth v2 support Close #62 --- omniauth-cas.gemspec | 2 +- spec/omniauth/strategies/cas_spec.rb | 8 +++----- spec/spec_helper.rb | 1 + 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/omniauth-cas.gemspec b/omniauth-cas.gemspec index 45e7b60..699b671 100644 --- a/omniauth-cas.gemspec +++ b/omniauth-cas.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |gem| gem.add_dependency 'addressable', '~> 2.8' gem.add_dependency 'nokogiri', '~> 1.12' - gem.add_dependency 'omniauth', '~> 1.9' + gem.add_dependency 'omniauth', '~> 2.1' end diff --git a/spec/omniauth/strategies/cas_spec.rb b/spec/omniauth/strategies/cas_spec.rb index 6a272b7..0f734c2 100644 --- a/spec/omniauth/strategies/cas_spec.rb +++ b/spec/omniauth/strategies/cas_spec.rb @@ -38,7 +38,7 @@ let(:redirect_params) { "service=#{Rack::Utils.escape("http://example.org/auth/cas/callback?url=#{Rack::Utils.escape(return_url)}")}" } - before { get url, nil, request_env } + before { post url, nil, request_env } it { is_expected.to be_redirect } @@ -95,7 +95,7 @@ it { is_expected.to include('ssl' => true) } end - describe 'GET /auth/cas' do + describe 'POST /auth/cas' do let(:return_url) { 'http://example.org/admin/foo' } context 'with a referer' do @@ -115,7 +115,7 @@ end end - describe 'GET /auth/cas/callback' do + describe 'POST /auth/cas/callback' do context 'without a ticket' do subject { last_response } @@ -253,9 +253,7 @@ it_behaves_like 'successful validation' end end - end - describe 'POST /auth/cas/callback' do describe 'with a Single Sign-Out logoutRequest' do subject do post 'auth/cas/callback', logoutRequest: logoutRequest diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c7d891b..af9385c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,7 @@ require 'webmock/rspec' OmniAuth.config.logger = Logger.new('/dev/null') +OmniAuth.config.request_validation_phase = nil # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.