diff --git a/app/controllers/openproject_metadata_controller.rb b/app/controllers/openproject_metadata_controller.rb new file mode 100644 index 00000000000..ca4907c02a3 --- /dev/null +++ b/app/controllers/openproject_metadata_controller.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +#-- copyright +# OpenProject is an open source project management software. +# Copyright (C) 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. +#++ + +class OpenprojectMetadataController < ApplicationController + no_authorization_required! :show + + skip_before_action :check_if_login_required + + def show + render json: { + installation_uuid: Setting.installation_uuid + } + end +end diff --git a/config/routes.rb b/config/routes.rb index 9336c99219e..e74c6615bc2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,8 +75,12 @@ Rails.application.routes.draw do get "/auth/:provider", to: proc { [404, {}, [""]] }, as: "omni_auth_start" match "/auth/:provider/callback", to: "omni_auth_login#callback", as: "omni_auth_callback", via: %i[get post] - get "/.well-known/oauth-authorization-server", to: "oauth_metadata#authorization_server", as: :authorization_server_metadata - get "/.well-known/oauth-protected-resource", to: "oauth_metadata#protected_resource", as: :protected_resource_metadata + scope ".well-known" do + get "oauth-authorization-server", to: "oauth_metadata#authorization_server", as: :authorization_server_metadata + get "oauth-protected-resource", to: "oauth_metadata#protected_resource", as: :protected_resource_metadata + + get "openproject-metadata", to: "openproject_metadata#show" + end # In case assets are actually delivered by a node server (e.g. in test env) # forward requests to the proxy diff --git a/docs/api/README.md b/docs/api/README.md index 7857e1d9467..6d3fa20105f 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -12,6 +12,7 @@ OpenProject offers different APIs: * SCIM (System for Cross-domain Identity Management) * MCP (Model Context Protocol) * BCF API v2.1 api targeted towards BIM use cases +* .well-known endpoints Please note that we intend to keep this specification as accurate and stable as possible, however work on APIs is still ongoing and not all resources and actions in OpenProject are yet accessible through the APIs. @@ -26,7 +27,7 @@ The API v3 is a general purpose API supporting multiple use cases. While by no means complete, a whole lot of different scenarios can be automatized which otherwise would have to be carried out by hand via the UI. Examples for this include managing work packages, projects and users. -We strive to maintain backward compatibility with this API in our stable OpenProject releases whenever possible. +We strive to maintain backward compatibility with this API in our stable OpenProject releases whenever possible. ➔ [Go to OpenProject API](./introduction/) @@ -53,3 +54,19 @@ This API supports BCF management in the context of BIM projects. While this API supports way less use cases than the more generic *API v3* it is compatible with the generic specification of a BCF API as [defined by the standard](https://github.com/buildingSMART/BCF-API/blob/release_2_1/README.md). Clients implementing the specification can manage topics and viewpoints. ➔ [Go to BCF API](./bcf-rest-api/) + +## .well-known endpoints + +Each OpenProject installation exposes some endpoints under the `/.well-known/` path: + +* `/.well-known/oauth-authorization-server`: [RFC 8414](https://datatracker.ietf.org/doc/html/rfc8414): OAuth 2.0 Authorization Server Metadata +* `/.well-known/oauth-protected-resource`: [RFC 9728](https://datatracker.ietf.org/doc/html/rfc9728): OAuth 2.0 Protected Resource Metadata +* `/.well-known/openproject-metadata`: Exposing non-confidential metadata about the OpenProject installation + +### OpenProject Metadata + +The `/.well-known/openproject-metadata` endpoint exposes some non-confidential metadata about the OpenProject instance in JSON format. This endpoint is accessible without authentication. + +The following keys are exposed: + +* `installation_uuid`: A unique identifier that's different per installation of OpenProject