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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Allow setting omniauth direct login provider to the new auth providers
Oliver Günther15dcc7603aa4
diff --git a/app/models/auth_provider.rb b/app/models/auth_provider.rbindex 69d724c0fae..769d63d65cc 100644--- a/app/models/auth_provider.rb+++ b/app/models/auth_provider.rb@@ -36,6 +36,10 @@ class AuthProvider < ApplicationRecordraise NotImplementedErrorend+ def human_type+ raise NotImplementedError+ end+def auth_urlroot_url = OpenProject::StaticRouting::StaticUrlHelpers.new.root_urlURI.join(root_url, "auth/#{slug}/").to_sdiff --git a/app/views/admin/settings/authentication_settings/show.html.erb b/app/views/admin/settings/authentication_settings/show.html.erbindex 8943b42aee4..cca0e8c6d32 100644--- a/app/views/admin/settings/authentication_settings/show.html.erb+++ b/app/views/admin/settings/authentication_settings/show.html.erb@@ -57,6 +57,27 @@ See COPYRIGHT and LICENSE files for more details.<%= render Settings::NumericSettingComponent.new("invitation_expiration_days", unit: "days") %></fieldset>+ <fieldset class="form--fieldset">+ <legend class="form--fieldset-legend"><%= I18n.t(:'settings.authentication.single_sign_on') %></legend>+ <div class="form--field">+ <% providers = AuthProvider+ .where(available: true)+ .order("lower(display_name) ASC")+ .select(:type, :display_name, :slug)+ .to_a+ .map { |p| ["#{p.display_name} (#{p.human_type})", p.slug] }+ %>+ <%= setting_select :omniauth_direct_login_provider,+ [[t(:label_disabled), ""]] + providers,+ container_class: '-middle' %>+ <span class="form--field-instructions">+ <%= t("settings.authentication.omniauth_direct_login_hint_html",+ internal_path: internal_signin_url) %>+ </span>+ </div>+ </fieldset>++<fieldset class="form--fieldset"><fieldset id="registration_footer" class="form--fieldset"><legend class="form--fieldset-legend"><%= I18n.t(:setting_registration_footer) %></legend>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 41923099e2a..efff8183f18 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3343,7 +3343,9 @@ en:setting_default_language: "Default language"setting_default_projects_modules: "Default enabled modules for new projects"setting_default_projects_public: "New projects are public by default"+ setting_disable_password_login: "Disable password authentication"setting_diff_max_lines_displayed: "Max number of diff lines displayed"+ setting_omniauth_direct_login_provider: "Direct login SSO provider"setting_display_subprojects_work_packages: "Display subprojects work packages on main projects by default"setting_duration_format: "Duration format"setting_duration_format_hours_only: "Hours only"@@ -3447,6 +3449,14 @@ en:setting_working_days: "Working days"settings:+ authentication:+ single_sign_on: "Single Sign-On"+ omniauth_direct_login_hint_html: >+ If this option is active, login requests will redirect to the configured omniauth provider.+ The login dropdown and sign-in page will be disabled.+ <br/>+ <strong>Note:</strong> Unless you also disable password logins, with this option enabled,+ users can still log in internally by visiting the <code>%{internal_path}</code> login page.attachments:whitelist_text_html: >Define a list of valid file extensions and/or mime types for uploaded files.diff --git a/modules/auth_saml/app/models/saml/provider.rb b/modules/auth_saml/app/models/saml/provider.rbindex 3ae89b0fb72..515c3a42d67 100644--- a/modules/auth_saml/app/models/saml/provider.rb+++ b/modules/auth_saml/app/models/saml/provider.rb@@ -45,6 +45,10 @@ module Samldef self.slug_fragment = "saml"+ def human_type+ "SAML"+ end+def seeded_from_env?(Setting.seed_saml_provider || {}).key?(slug)enddiff --git a/modules/openid_connect/app/models/openid_connect/provider.rb b/modules/openid_connect/app/models/openid_connect/provider.rbindex 14a35feeed5..65d353fba77 100644--- a/modules/openid_connect/app/models/openid_connect/provider.rb+++ b/modules/openid_connect/app/models/openid_connect/provider.rb@@ -37,6 +37,10 @@ module OpenIDConnectdef self.slug_fragment = "oidc"+ def human_type+ "OpenID Connect"+ end+def seeded_from_env?(Setting.seed_oidc_provider || {}).key?(slug)end