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
[#60151] use sso strategy only for oidc provider
Eric Schubertc0888d3ed364
diff --git a/.editorconfig b/.editorconfigindex 9b411022ae0..7f864d6081e 100644--- a/.editorconfig+++ b/.editorconfig@@ -350,10 +350,7 @@ ij_json_spaces_within_brackets = falseij_json_wrap_long_lines = false[{rcov,spec,rake,rails,spork,capfile,gemfile,rakefile,guardfile,isolate,vagrantfile,Puppetfile,*.jbuilder,*.rbw,*.gemspec,*.thor,*.ru,*.rb,*.rake}]-indent_size = 2-tab_width = 2trim_trailing_whitespace=true-ij_continuation_indent_size = 2ij_ruby_align_group_field_declarations = falseij_ruby_align_multiline_parameters = trueij_ruby_blank_lines_around_method = 1@@ -364,7 +361,6 @@ ij_ruby_indent_protected_methods = falseij_ruby_indent_public_methods = falseij_ruby_indent_when_cases = falseij_ruby_keep_blank_lines_in_declarations = 2-ij_ruby_keep_indents_on_empty_lines = falseij_ruby_keep_line_breaks = trueij_ruby_parentheses_around_method_arguments = trueij_ruby_spaces_around_hashrocket = truediff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/nextcloud_strategies.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/nextcloud_strategies.rbindex ba325f17f73..4e7e3599db5 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/nextcloud_strategies.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/nextcloud_strategies.rb@@ -33,27 +33,37 @@ module Storagesmodule StorageInteractionmodule AuthenticationStrategiesmodule NextcloudStrategies- extend TaggedLogging-UserLess = -> do::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::BasicAuth.strategyend- UserBound = ->(user:, storage:) do- with_tagged_logger do- sso_preferred = storage.audience.present? && user.authentication_provider.present?+ class UserBound+ class << self+ include TaggedLogging++ def call(user:, storage:)+ with_tagged_logger do+ sso_preferred = storage.audience.present? && oidc_provider_for(user)++ if sso_preferred+ ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::SsoUserToken+ .strategy+ .with_user(user)+ elsif storage.oauth_client.present?+ ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken+ .strategy+ .with_user(user)+ else+ error "No user-bound authentication strategy applicable for file storage #{storage.id}."+ ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::Failure.strategy+ end+ end+ end++ private- if sso_preferred- ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::SsoUserToken- .strategy- .with_user(user)- elsif storage.oauth_client.present?- ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken- .strategy- .with_user(user)- else- error "No user-bound authentication strategy applicable for file storage #{storage.id}."- ::Storages::Peripherals::StorageInteraction::AuthenticationStrategies::Failure.strategy+ def oidc_provider_for(user)+ user.authentication_provider.is_a?(OpenIDConnect::Provider)endendend