forked from ckan/ckan-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update SAML2AuthPlugin to logout user on session expiration
- Loading branch information
1 parent
9bc8e3f
commit f4bbd7a
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/ckanext/saml2auth/plugin.py b/ckanext/saml2auth/plugin.py | ||
index 53b8454..07a3307 100644 | ||
--- a/ckanext/saml2auth/plugin.py | ||
+++ b/ckanext/saml2auth/plugin.py | ||
@@ -22,6 +22,7 @@ from saml2.client_base import LogoutError | ||
from saml2 import entity | ||
|
||
from flask import session, redirect, make_response | ||
+from flask_login import logout_user | ||
|
||
import ckan.plugins as plugins | ||
import ckan.plugins.toolkit as toolkit | ||
@@ -103,7 +104,8 @@ class Saml2AuthPlugin(plugins.SingletonPlugin): | ||
domain = h.get_site_domain_for_cookie() | ||
# Clear session cookie in the browser | ||
response.set_cookie('ckan', domain=domain, expires=0) | ||
- | ||
+ # logout user from CKAN | ||
+ logout_user() | ||
if not toolkit.check_ckan_version(min_version="2.10"): | ||
# CKAN <= 2.9.x also sets auth_tkt cookie | ||
response.set_cookie('auth_tkt', domain=domain, expires=0) |