parent
803e5cb258
commit
8c555b58c4
@ -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 |
||||
|
@ -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 |
@ -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 |
@ -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 |
Loading…
Reference in new issue