diff --git a/README.md b/README.md index 79e982582e..34e4b76ba5 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ You will have to add the following lines to your OpenProject's `Gemfile.plugins` gem 'omniauth-openid-connect', :git => 'git@github.com:finnlabs/omniauth-openid-connect.git', :branch => 'dev' gem 'omniauth-openid_connect-providers', :git => 'git@github.com:finnlabs/omniauth-openid_connect-providers.git', :branch => 'dev' gem 'openproject-openid_connect', :git => 'git@github.com:finnlabs/openproject-openid_connect.git', :branch => 'dev' - - gem 'lobby_boy', :git => 'git@github.com:finnlabs/lobby_boy.git', :branch => 'dev' ``` ### Development diff --git a/config/routes.rb b/config/routes.rb index 8631942509..10810f3a74 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,3 @@ -require 'lobby_boy' - Rails.application.routes.draw do - mount LobbyBoy::Engine, at: '/' - get '/session/logout_warning', to: 'session#logout_warning' end diff --git a/lib/open_project/hooks/session_iframes.rb b/lib/open_project/hooks/session_iframes.rb deleted file mode 100644 index 45cece17f1..0000000000 --- a/lib/open_project/hooks/session_iframes.rb +++ /dev/null @@ -1,33 +0,0 @@ -#-- copyright -# OpenProject is a project management system. -# Copyright (C) 2012-2015 the OpenProject Foundation (OPF) -# -# 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 doc/COPYRIGHT.rdoc for more details. -#++ - -module OpenProject - class Hooks::SessionIFrames < Redmine::Hook::ViewListener - render_on :view_layouts_base_body_bottom, partial: 'lobby_boy/iframes' - end -end diff --git a/lib/open_project/openid_connect/engine.rb b/lib/open_project/openid_connect/engine.rb index e945534854..e816990ecb 100644 --- a/lib/open_project/openid_connect/engine.rb +++ b/lib/open_project/openid_connect/engine.rb @@ -1,6 +1,4 @@ -require 'open_project/openid_connect/lobby_boy_configuration' require 'open_project/plugins' -require 'lobby_boy' module OpenProject::OpenIDConnect class Engine < ::Rails::Engine @@ -52,31 +50,6 @@ module OpenProject::OpenIDConnect end end - config.to_prepare do - OpenProject::OpenIDConnect::LobbyBoyConfiguration.update! - - if LobbyBoy.configured? - require 'open_project/hooks/session_iframes' - - require 'open_project/openid_connect/sso_login' - ::Concerns::OmniauthLogin.prepend SSOLogin - - require 'open_project/openid_connect/sso_logout' - ::AccountController.prepend SSOLogout - end - end - - initializer "openid_connect.middleware.lobby_boy_config" do |app| - anchor = - if defined? ::Multitenancy::Elevators::MappedDomainElevator - ::Multitenancy::Elevators::MappedDomainElevator - else - ActionDispatch::Callbacks - end - - app.config.middleware.insert_after anchor, OpenProject::OpenIDConnect::LobbyBoyConfiguration - end - config.to_prepare do # set a secure cookie in production secure_cookie = !!Rails.configuration.force_ssl diff --git a/lib/open_project/openid_connect/lobby_boy_configuration.rb b/lib/open_project/openid_connect/lobby_boy_configuration.rb deleted file mode 100644 index 2c939480dc..0000000000 --- a/lib/open_project/openid_connect/lobby_boy_configuration.rb +++ /dev/null @@ -1,62 +0,0 @@ -module OpenProject - module OpenIDConnect - class LobbyBoyConfiguration - def initialize(app) - @app = app - end - - ## - # Updates the lobby boy settings with each request in case - # the host or protocol change in OpenProject's settings. - def call(env) - self.class.update_client! if LobbyBoy.configured? - - @app.call env - end - - class << self - attr_accessor :provider - - def enabled? - Rails.env != 'test' - end - - def update! - self.provider = lookup_provider - - if enabled? && provider - update_client! - update_provider! - end - end - - def lookup_provider - OpenProject::Plugins::AuthPlugin.providers.find { |p| p[:sso] } - end - - def update_client! - LobbyBoy.configure_client! host: host, - logged_in: lambda { !session[:user_id].nil? }, - end_session_endpoint: end_session_endpoint, - on_logout_js_partial: 'session/warn_logout' - end - - def update_provider! - LobbyBoy.configure_provider! name: provider[:name], - client_id: provider[:client_options][:identifier], - issuer: provider[:issuer], - end_session_endpoint: provider[:end_session_endpoint], - check_session_iframe: provider[:check_session_iframe] - end - - def host - "#{Setting.protocol}://#{Setting.host_name}" - end - - def end_session_endpoint - '/logout?script' - end - end - end - end -end diff --git a/lib/open_project/openid_connect/sso_login.rb b/lib/open_project/openid_connect/sso_login.rb deleted file mode 100644 index 2f5641a33f..0000000000 --- a/lib/open_project/openid_connect/sso_login.rb +++ /dev/null @@ -1,13 +0,0 @@ -module OpenProject - module OpenIDConnect - module SSOLogin - include ::LobbyBoy::SessionHelper - - def authorization_successful(_user, auth_hash) - super.tap do |_| - confirm_login! # lobby_boy helper - end - end - end - end -end diff --git a/lib/open_project/openid_connect/sso_logout.rb b/lib/open_project/openid_connect/sso_logout.rb index 5ce318b5c9..8b9aead48f 100644 --- a/lib/open_project/openid_connect/sso_logout.rb +++ b/lib/open_project/openid_connect/sso_logout.rb @@ -1,7 +1,6 @@ module OpenProject module OpenIDConnect module SSOLogout - include LobbyBoy::SessionHelper include ::OmniauthHelper def session_expired? diff --git a/openproject-openid_connect.gemspec b/openproject-openid_connect.gemspec index a70c871f7e..b2264256cb 100644 --- a/openproject-openid_connect.gemspec +++ b/openproject-openid_connect.gemspec @@ -18,5 +18,4 @@ Gem::Specification.new do |s| s.add_dependency 'rails', '~> 5.0' s.add_dependency 'openproject-auth_plugins', '~> 8.0' s.add_dependency 'omniauth-openid_connect-providers', '~> 0.1' - s.add_dependency 'lobby_boy' end