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

Add Logout Redirect #280

Merged
merged 2 commits into from
Aug 9, 2023
Merged
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
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