Skip to content

Commit 921f333

Browse files
Merge pull request #160 from ADolhov/docs/slo-readme-preserve-session-index
Update readme for Single Logout
2 parents 6d9e756 + 93c8a18 commit 921f333

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ advertised in metadata by setting the `single_logout_service_url` config option)
204204
When using Devise as an authentication solution, the SP initiated flow can be integrated
205205
in the `SessionsController#destroy` action.
206206

207-
For this to work it is important to preserve the `saml_uid` value before Devise
207+
For this to work it is important to preserve the `saml_uid` and `saml_session_index` value before Devise
208208
clears the session and redirect to the `/spslo` sub-path to initiate the single logout.
209209

210210
Example `destroy` action in `sessions_controller.rb`:
@@ -214,17 +214,19 @@ class SessionsController < Devise::SessionsController
214214
# ...
215215

216216
def destroy
217-
# Preserve the saml_uid in the session
218-
saml_uid = session["saml_uid"]
217+
# Preserve the saml_uid and saml_session_index in the session
218+
saml_uid = session['saml_uid']
219+
saml_session_index = session['saml_session_index']
219220
super do
220-
session["saml_uid"] = saml_uid
221+
session['saml_uid'] = saml_uid
222+
session['saml_session_index'] = saml_session_index
221223
end
222224
end
223225

224226
# ...
225227

226228
def after_sign_out_path_for(_)
227-
if session['saml_uid'] && SAML_SETTINGS.idp_slo_target_url
229+
if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_target_url
228230
user_saml_omniauth_authorize_path + "/spslo"
229231
else
230232
super

0 commit comments

Comments
 (0)