diff --git a/powerdnsadmin/models/setting.py b/powerdnsadmin/models/setting.py index 7a7aa30..b68ea53 100644 --- a/powerdnsadmin/models/setting.py +++ b/powerdnsadmin/models/setting.py @@ -90,6 +90,7 @@ class Setting(db.Model): 'oidc_oauth_api_url': '', 'oidc_oauth_token_url': '', 'oidc_oauth_authorize_url': '', + 'oidc_oauth_logout_url': '', 'oidc_oauth_username': 'preferred_username', 'oidc_oauth_firstname': 'given_name', 'oidc_oauth_last_name': 'family_name ', diff --git a/powerdnsadmin/routes/index.py b/powerdnsadmin/routes/index.py index da2d80b..e6e1adc 100644 --- a/powerdnsadmin/routes/index.py +++ b/powerdnsadmin/routes/index.py @@ -453,6 +453,13 @@ def logout(): session_index=session['samlSessionIndex'], name_id=session['samlNameId'])) + redirect_uri = url_for('index.login') + oidc_logout = Setting().get('oidc_oauth_logout_url') + + if 'oidc_token' in session and oidc_logout: + redirect_uri = "{}?redirect_uri={}".format( + oidc_logout, url_for('index.login', _external=True)) + # Clean cookies and flask session clear_session() @@ -476,7 +483,7 @@ def logout(): return res - return redirect(url_for('index.login')) + return redirect(redirect_uri) @index_bp.route('/register', methods=['GET', 'POST']) diff --git a/powerdnsadmin/templates/admin_setting_authentication.html b/powerdnsadmin/templates/admin_setting_authentication.html index 0cd1657..15661c2 100644 --- a/powerdnsadmin/templates/admin_setting_authentication.html +++ b/powerdnsadmin/templates/admin_setting_authentication.html @@ -522,6 +522,11 @@ +