Skip to content

Commit

Permalink
Merge pull request #280 from NYULibraries/mcain/add-logout-redirect
Browse files Browse the repository at this point in the history
Add Logout Redirect
  • Loading branch information
the-codetrane authored Aug 9, 2023
2 parents 5531dc8 + 0d77fd2 commit c94e709
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
7 changes: 2 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ def current_user_dev
# After signing out from the local application,
# redirect to the logout path for the Login app
def after_sign_out_path_for(resource_or_scope)
if logout_path.present?
logout_path
else
super(resource_or_scope)
end
Faraday.get(logout_path) if logout_path.present?
super(resource_or_scope)
end

def logout_path
Expand Down
53 changes: 31 additions & 22 deletions spec/routing/user_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
# frozen_string_literal: true

describe 'routes for users' do
describe 'GET /auth/shibboleth' do
subject { get('/auth/shibboleth') }
it do
should route_to({
controller: 'omniauth_callbacks',
action: 'passthru'
})
describe 'Logging in' do
describe 'GET /auth/shibboleth' do
subject { get('/auth/shibboleth') }
it do
should route_to({
controller: 'omniauth_callbacks',
action: 'passthru'
})
end
end
end

describe 'POST /auth/shibboleth' do
subject { post('/auth/shibboleth') }
it do
should route_to({
controller: 'omniauth_callbacks',
action: 'passthru'
})
describe 'POST /auth/shibboleth' do
subject { post('/auth/shibboleth') }
it do
should route_to({
controller: 'omniauth_callbacks',
action: 'passthru'
})
end
end

describe 'GET /auth/shibboleth/callback' do
subject { get('/auth/shibboleth/callback') }
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
end
end

describe 'GET /auth/shibboleth/callback' do
subject { get('/auth/shibboleth/callback') }
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
describe 'POST /auth/shibboleth/callback' do
subject { post('/auth/shibboleth/callback') }
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
end
end

describe 'POST /auth/shibboleth/callback' do
subject { post('/auth/shibboleth/callback') }
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
describe 'Logging out' do
describe 'GET /logout' do
subject { get('/logout') }
it { should route_to({ controller: 'devise/sessions', action: 'destroy' }) }
end
end
end

0 comments on commit c94e709

Please sign in to comment.