Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Disable turbo on logout action to fix OIDC post logout redirect

Oliver Günther380e36d17446
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 497b954f6cf..cd650ae2a69 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -122,7 +122,14 @@ Redmine::MenuManager.map :account_menu do |menu|
}
menu.push :logout,
:signout_path,
- if: ->(_) { User.current.logged? }
+ if: ->(_) { User.current.logged? },
+ html: {
+ data: {
+ # Turbo-drive needs to be disabled, as we might redirect to other origins
+ # as a result here (e.g., post logout SSO redirects).
+ turbo: false
+ }
+ }
end
Redmine::MenuManager.map :global_menu do |menu|
diff --git a/modules/openid_connect/spec/features/oidc_end_session_redirect_spec.rb b/modules/openid_connect/spec/features/oidc_end_session_redirect_spec.rb
new file mode 100644
index 00000000000..82595fd6f14
--- /dev/null
+++ b/modules/openid_connect/spec/features/oidc_end_session_redirect_spec.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+
+RSpec.describe "OpenID Connect end_session_redirect",
+ :js,
+ with_ee: %i[sso_auth_providers] do
+ let!(:provider) do
+ create(:oidc_provider,
+ slug: "keycloak",
+ end_session_endpoint: "https://example.com")
+ end
+
+ let(:password) { "password!123" }
+ let(:user) { create(:user, authentication_provider: provider, password:, password_confirmation: password) }
+
+ it "redirects to the OIDC logout endpoint without turbo (Regression #65076)" do
+ login_with(user.login, password)
+
+ visit home_path
+
+ page.find(".op-top-menu-user").click
+ click_link_or_button "Sign out"
+
+ expect(page).to have_current_path("https://example.com")
+ end
+end