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
[chore] added redirect uri to oauth clients for auth requests
Eric Schubertbe28833ff43c
diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rbindex 6f67ae07558..893b9768624 100644--- a/app/helpers/oauth_helper.rb+++ b/app/helpers/oauth_helper.rb@@ -56,8 +56,4 @@ module OAuthHelpertokens = ::Doorkeeper::AccessToken.active_for(user).includes(:application)tokens.group_by(&:application)end-- def oauth_client_redirect_uri(oauth_client)- "#{request.protocol}#{request.host_with_port}/oauth_clients/#{oauth_client.client_id}/callback"- endenddiff --git a/app/models/oauth_client.rb b/app/models/oauth_client.rbindex a444d87b03d..a936e0fe5bc 100644--- a/app/models/oauth_client.rb+++ b/app/models/oauth_client.rb@@ -28,4 +28,8 @@class OAuthClient < ApplicationRecordbelongs_to :integration, polymorphic: true++ def redirect_uri+ File.join(OpenProject::Application.root_url, 'oauth_clients', client_id, 'callback')+ endenddiff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rbindex 7e44f3888a7..1ef56779c09 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb@@ -37,6 +37,7 @@ module Storagesdef initialize(storage)@uri = storage.uri@oauth_client = storage.oauth_client.freeze+ super()enddef authorization_state_check(token)@@ -64,6 +65,7 @@ module StoragesRack::OAuth2::Client.new(identifier: @oauth_client.client_id,secret: @oauth_client.client_secret,+ redirect_uri: @oauth_client.redirect_uri,scheme: @uri.scheme,host: @uri.host,port: @uri.port,diff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rbindex e812f896e39..58e4514aa4e 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb@@ -41,6 +41,7 @@ module Storages@uri = storage.uri@oauth_client = storage.oauth_client@oauth_uri = URI('https://login.microsoftonline.com/').normalize+ super()enddef authorization_state_check(access_token)@@ -58,6 +59,7 @@ module Storagesdef basic_rack_oauth_clientRack::OAuth2::Client.new(identifier: @oauth_client.client_id,+ redirect_uri: @oauth_client.redirect_uri,secret: @oauth_client.client_secret,scheme: @oauth_uri.scheme,host: @oauth_uri.host,diff --git a/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client_section.html.erb b/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client_section.html.erbindex 5fa95a34745..37472c0d2ef 100644--- a/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client_section.html.erb+++ b/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client_section.html.erb@@ -36,7 +36,7 @@ See COPYRIGHT and LICENSE files for more details.{ key: "#{t("storages.provider_types.#{@storage.short_provider_type}.name")} #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}",value: short_secret(@storage.oauth_client.client_secret) },{ key: "#{t("storages.provider_types.#{@storage.short_provider_type}.name")} #{Storages::Admin::LABEL_OAUTH_REDIRECT_URI}",- value: oauth_client_redirect_uri(@storage.oauth_client) }+ value: @storage.oauth_client.redirect_uri }]) %><%= link_to(t("storages.buttons.replace_provider_type_oauth", provider_type: t("storages.provider_types.#{@storage.short_provider_type}.name")),