Skip to content

Commit c94e709

Browse files
Merge pull request #280 from NYULibraries/mcain/add-logout-redirect
Add Logout Redirect
2 parents 5531dc8 + 0d77fd2 commit c94e709

File tree

2 files changed

+33
-27
lines changed

2 files changed

+33
-27
lines changed

app/controllers/application_controller.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ def current_user_dev
2727
# After signing out from the local application,
2828
# redirect to the logout path for the Login app
2929
def after_sign_out_path_for(resource_or_scope)
30-
if logout_path.present?
31-
logout_path
32-
else
33-
super(resource_or_scope)
34-
end
30+
Faraday.get(logout_path) if logout_path.present?
31+
super(resource_or_scope)
3532
end
3633

3734
def logout_path

spec/routing/user_routing_spec.rb

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,42 @@
11
# frozen_string_literal: true
22

33
describe 'routes for users' do
4-
describe 'GET /auth/shibboleth' do
5-
subject { get('/auth/shibboleth') }
6-
it do
7-
should route_to({
8-
controller: 'omniauth_callbacks',
9-
action: 'passthru'
10-
})
4+
describe 'Logging in' do
5+
describe 'GET /auth/shibboleth' do
6+
subject { get('/auth/shibboleth') }
7+
it do
8+
should route_to({
9+
controller: 'omniauth_callbacks',
10+
action: 'passthru'
11+
})
12+
end
1113
end
12-
end
1314

14-
describe 'POST /auth/shibboleth' do
15-
subject { post('/auth/shibboleth') }
16-
it do
17-
should route_to({
18-
controller: 'omniauth_callbacks',
19-
action: 'passthru'
20-
})
15+
describe 'POST /auth/shibboleth' do
16+
subject { post('/auth/shibboleth') }
17+
it do
18+
should route_to({
19+
controller: 'omniauth_callbacks',
20+
action: 'passthru'
21+
})
22+
end
23+
end
24+
25+
describe 'GET /auth/shibboleth/callback' do
26+
subject { get('/auth/shibboleth/callback') }
27+
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
2128
end
22-
end
2329

24-
describe 'GET /auth/shibboleth/callback' do
25-
subject { get('/auth/shibboleth/callback') }
26-
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
30+
describe 'POST /auth/shibboleth/callback' do
31+
subject { post('/auth/shibboleth/callback') }
32+
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
33+
end
2734
end
2835

29-
describe 'POST /auth/shibboleth/callback' do
30-
subject { post('/auth/shibboleth/callback') }
31-
it { should route_to({ controller: 'omniauth_callbacks', action: 'shibboleth' }) }
36+
describe 'Logging out' do
37+
describe 'GET /logout' do
38+
subject { get('/logout') }
39+
it { should route_to({ controller: 'devise/sessions', action: 'destroy' }) }
40+
end
3241
end
3342
end

0 commit comments

Comments
 (0)