parent
3492d08fdd
commit
49471bbd66
@ -1,32 +1,20 @@ |
||||
require 'open_project/authentication' |
||||
Rails.application.config.after_initialize do |
||||
WS = OpenProject::Authentication::Strategies::Warden |
||||
|
||||
# Strategies provided by OpenProject: |
||||
require 'open_project/authentication/strategies/warden/basic_auth_failure' |
||||
require 'open_project/authentication/strategies/warden/global_basic_auth' |
||||
require 'open_project/authentication/strategies/warden/user_basic_auth' |
||||
require 'open_project/authentication/strategies/warden/doorkeeper_oauth' |
||||
require 'open_project/authentication/strategies/warden/session' |
||||
strategies = [ |
||||
[:basic_auth_failure, WS::BasicAuthFailure, 'Basic'], |
||||
[:global_basic_auth, WS::GlobalBasicAuth, 'Basic'], |
||||
[:user_basic_auth, WS::UserBasicAuth, 'Basic'], |
||||
[:oauth, WS::DoorkeeperOAuth, 'OAuth'], |
||||
[:anonymous_fallback, WS::AnonymousFallback, 'Basic'], |
||||
[:session, WS::Session, 'Session'] |
||||
] |
||||
|
||||
WS = OpenProject::Authentication::Strategies::Warden |
||||
strategies.each do |name, clazz, auth_scheme| |
||||
OpenProject::Authentication.add_strategy name, clazz, auth_scheme |
||||
end |
||||
|
||||
strategies = [ |
||||
[:basic_auth_failure, WS::BasicAuthFailure, 'Basic'], |
||||
[:global_basic_auth, WS::GlobalBasicAuth, 'Basic'], |
||||
[:user_basic_auth, WS::UserBasicAuth, 'Basic'], |
||||
[:oauth, WS::DoorkeeperOAuth, 'OAuth'], |
||||
[:anonymous_fallback, WS::AnonymousFallback, 'Basic'], |
||||
[:session, WS::Session, 'Session'] |
||||
] |
||||
|
||||
strategies.each do |name, clazz, auth_scheme| |
||||
OpenProject::Authentication.add_strategy name, clazz, auth_scheme |
||||
end |
||||
|
||||
include OpenProject::Authentication::Scope |
||||
|
||||
api_v3_options = { |
||||
store: false |
||||
} |
||||
OpenProject::Authentication.update_strategies(API_V3, api_v3_options) do |_strategies| |
||||
%i[global_basic_auth user_basic_auth basic_auth_failure oauth session anonymous_fallback] |
||||
OpenProject::Authentication.update_strategies(OpenProject::Authentication::Scope::API_V3, { store: false }) do |_| |
||||
%i[global_basic_auth user_basic_auth basic_auth_failure oauth session anonymous_fallback] |
||||
end |
||||
end |
||||
|
@ -1,3 +1,29 @@ |
||||
# OpenProject is an open source project management software. |
||||
# Copyright (C) 2022 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 'open_project/authentication/manager' |
||||
|
||||
module OpenProject |
Loading…
Reference in new issue