Skip to content

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

Prepare nextcloud storage docs for new authentication method

Jan Sandbrinkf96c7acafb59
diff --git a/docs/system-admin-guide/integrations/nextcloud/README.md b/docs/system-admin-guide/integrations/nextcloud/README.md
index ce03a0575de..9ebb98e0592 100644
--- a/docs/system-admin-guide/integrations/nextcloud/README.md
+++ b/docs/system-admin-guide/integrations/nextcloud/README.md
@@ -44,7 +44,7 @@ features and prompt fixes for any potential bugs.
- If you installed Nextcloud via the [community](https://hub.docker.com/_/nextcloud) docker image, we advise you to
pin it to the `stable` tag.
- Nextcloud company advises the use of there [all-in-one](https://hub.docker.com/r/nextcloud/all-in-one) docker image.
-- If you want to use the feature of [automatically managed project folders](#5-automatically-managed-project-folders)
+- If you want to use the feature of [automatically managed project folders](#4-automatically-managed-project-folders)
you need to install the officially minimal supported version `14.0.9` of
the [Group folders](https://apps.nextcloud.com/apps/groupfolders) app in Nextcloud.
@@ -81,13 +81,9 @@ Click on the **Save** button.
> [!TIP]
> If the OpenProject host cannot be added, you may check the [Troubleshooting](#troubleshooting) section at the bottom of this page.
-Please note, when you use the **Terms of Service** app on the Nextcloud side, all terms also need to be accepted for the OpenProject user that gets created during the setup. This is set to happen automatically during the initial set-up. If you see an error message indicating otherwise or the integration does not behave as expected, please refer to the [Troubleshooting](#troubleshooting) section at the bottom of this page.
-
-The next part of the setup will require you to enter OpenProject OAuth values here, but before we do that, you will need to generate them in OpenProject. To do so, navigate to your OpenProject instance in a new browser tab.
-
-### 2. Create a Nextcloud file storage in your OpenProject instance
+## 2. Create a Nextcloud file storage in your OpenProject instance
-Navigate to your administration settings page by clicking on *your avatar in the top right corner → Administration*. From the side menu on the left, click on **Files -> External file storages**.
+Navigate to your OpenProject administration settings page by clicking on *your avatar in the top right corner → Administration*. From the side menu on the left, click on **Files -> External file storages**.
Click on **+ Storage** to add a new file storage.
@@ -103,44 +99,25 @@ Next, enter the **Host URL** of your Nextcloud instance. This is simply the addr
![Adding a new storage via OpenProject Administration settings](openproject_system_guide_nextcloud_integration_setup_step_2.png)
-Click on **Save and continue setup**. Your new storage is now created, but before you can use it, you will need to exchange OAUth IDs and secrets between your Nextcloud and OpenProject instances. You will do this in the next step.
-
-### 3. Enter OpenProject OAuth values in Nextcloud settings
-
-At this point, you will see a page titled **OpenProject OAuth application details**.
-
-Note that OpenProject has automatically generated an OAuth **client ID** and a **client secret**. These values are needed to permit Nextcloud to connect to OpenProject.
-
-> [!IMPORTANT]
-> These generated values are not accessible again after you close the window. Please do not navigate away from this page before copying them over to Nextcloud, as instructed below. Treat these values with care, as you would an important password. Please do not reveal them to anyone else.
-
-![OpenProject generates OAuth values to copy over to Nextcloud](openproject_system_guide_nextcloud_integration_setup_step_3.png)
+After deciding for an authentication method (more details in the next step), click on **Save and continue setup**. Your new storage is now created, but before you can use it, you will need to configure the chosen authentication method.
-Go back to the browser tab where you were configuring the **OpenProject Integration** app. (We recommend you have two browser tabs open: the current one with OpenProject and the former one with Nextcloud).
+### 3. Configure Authentication method
-Copy the two generated values (client ID and secret) from the OpenProject tab to the respective fields in Nextcloud, namely **OpenProject OAuth client ID** and **OpenProject OAuth client secret**.
+The next part of the setup will be different depending on the way that you choose authentication between OpenProject and Nextcloud to happen.
-![OAuth values generated by OpenProject are entered into Nextcloud app configuration](openproject_system_guide_nextcloud_integration_setup_step_4.png)
+**Two-way OAuth 2.0 authorization code flow:** This way of authentication works with all deployments of OpenProject and Nextcloud. Requests between the two applications will act with the target application acting as OAuth 2.0 authorization server. For the users this means, that they will usually have to confirm a separate OAuth consent screen for both directions of communication.
-Once you have copied the values, click on **Save** to proceed to the next step.
+**Single-Sign-On through OpenID Connect Identity Provider:** In this authentication mode, users will not have to confirm additional consent screens, providing a better user experience. Requests between OpenProject and Nextcloud are authenticated with access tokens obtained from a common Identity Provider. This works only if users authenticate to OpenProject and Nextcloud through the same OpenID Connect Identity Provider and specific configuration needs to be done at the identity provider. This advanced feature is available to all installations under the Corporate plan.
-### 4. Enter Nextcloud OAuth values in OpenProject
-In the page that appears, you will see new OAuth values that are once again generated automatically, but this time by Nextcloud.
+Instructions for both authentication methods can be found on the following pages:
-OpenProject will need these values to be able to connect to your Nextcloud instance.
+* [Setup Two-way OAuth 2.0 authorization code flow](./two-way-oauth2/)
+* [Setup Single-Sign-On through OpenID Connect Identity Provider](./oidc-sso/)
-Much like in the previous step, you will need to copy these two generated values (**Nextcloud OAuth client ID** and **Nextcloud OAuth client secret**) and paste them into OpenProject.
+After finishing the corresponding setup steps, continue with the following steps on this page.
-![Nextcloud also generates OAuth values that need to be copied to OpenProject](openproject_system_guide_nextcloud_integration_setup_step_5.png)
-
-Navigate back to your OpenProject tab and click on the **Done, continue** button on the screen you previously left it at. You will now see a screen where you will be able to enter the Nextcloud values.
-
-![OpenProject_NC_OAuth_values](openproject_system_guide_nextcloud_integration_setup_step_6.png)
-
-Once you have entered the client ID and client secrets on this page, click on **Save and continue**.
-
-### 5. Automatically managed project folders
+### 4. Automatically managed project folders
As a last step, you will be asked if you want to use automatically managed folders. If you choose this option, OpenProject will automatically create project folders in Nextcloud and manage permissions such that all project members always have the necessary access privileges. Unless you already have a particular folder structure in place, we recommend choosing this option.
@@ -155,6 +132,8 @@ In case you want to use this functionality you will be requested to enter a pass
> [!IMPORTANT]
> You will need to install the [Group folder](https://apps.nextcloud.com/apps/groupfolders) app in Nextcloud in order to have OpenProject automatically managed your Nextcloud folders. Each storage can only have one group folder with the same name.
+Please note, when you use the **Terms of Service** app on the Nextcloud side, all terms also need to be accepted for the OpenProject user that gets created during the setup. This is set to happen automatically during the initial set-up. If you see an error message indicating otherwise or the integration does not behave as expected, please refer to the [Troubleshooting](#troubleshooting) section at the bottom of this page.
+
At this point, you can click on **Done, complete setup** in both applications and your instance configuration will be completed.
![Integration successfully completed on the OpenProject end](openproject_system_guide_nextcloud_integration_setup_step_10.png)
@@ -172,13 +151,13 @@ Additional settings on this page also allow you, as an administrator, to define
- **Enable navigation link** displays a link to the OpenProject instance in the Nextcloud header
- **Enable unified search for tickets** allows users to search for OpenProject work packages via the universal search bar in Nextcloud
-### 6. Add your new Nextcloud file storage to a project
+### 5. Add your new Nextcloud file storage to a project
Now that the integration is set up, the next step is to make the Nextcloud file storage you just created available to individual projects. This can be either done by you directly in the system administration under **Enabled in projects** tab of a specific file storage, or on a project level under **Project settings**.
To add a Nextcloud to a specific project on a project level, navigate to any existing project in your OpenProject instance and click on **Project settings** -> **Files** and follow the instructions in the [Project settings user guide](../../../user-guide/projects/project-settings/files/).
-To add a Nextcloud storage to one or multiple projects on an instance level, click on a file storage under *Administration -> Files -> External file storages* and select **Enabled in projects** tab. If the file storage setup was not completed properly, you will see a respective message.
+To add a Nextcloud storage to one or multiple projects on an instance level, click on a file storage under *Administration -> Files -> External file storages* and select **Enabled in projects** tab. If the file storage setup was not completed properly, you will see a respective message.
![Storage setup incomplete message in OpenProject file storages administration](openproject_system_guide_nextcloud_integration_setup_incomplete_message.png)
@@ -190,7 +169,7 @@ You can you use the search bar to select either one or multiple projects and hav
![Select projects to activate Nextcloud storage in in OpenProject administration](openproject_system_guide_nextcloud_setup_activate_in_projects.png)
-You can always edit project folders or remove file storage from projects by selecting the respective option.
+You can always edit project folders or remove file storage from projects by selecting the respective option.
![Remove Nextcloud file storage from a project in OpenProject administration](openproject_system_guide_nextcloud_edit_remove_in_projects.png)
@@ -251,10 +230,10 @@ Attention: Please do not confuse the CA for the Nextcloud server's certificate w
#### Error message "Sign terms of services"
-**Terms of services** is an app on the Nextcloud side of integration that makes it mandatory for users to accept terms of services before Nextcloud can be used. In order for the integration to work properly the OpenProject user also needs to accept all terms that are set up. It should be accepted automatically during the set up process. However, it is possible that in certain situations it does not happen automatically.
+**Terms of services** is an app on the Nextcloud side of integration that makes it mandatory for users to accept terms of services before Nextcloud can be used. In order for the integration to work properly the OpenProject user also needs to accept all terms that are set up. It should be accepted automatically during the set up process. However, it is possible that in certain situations it does not happen automatically.
-To fix this please log into Nextcloud, proceed to Administration and select OpenProject. This will trigger an automatic background check and suggest that *Terms of services* be signed.
+To fix this please log into Nextcloud, proceed to Administration and select OpenProject. This will trigger an automatic background check and suggest that *Terms of services* be signed.
![Fix a Terms of services error in Nextcloud](openproject_system_guide_tos_fix.png)
#### While setting up Project folders
@@ -328,9 +307,9 @@ On OpenProject inside the storage administration (*Administration → File stora
```shell
curl -H 'OCS-APIRequest:true' -H 'Accept:application/json' https://nextcloud.example.com/ocs/v2.php/cloud/capabilities
```
-
+
If Nextcloud is setup correctly the response should look similar to the following. Pay special attention to current Nextcloud version, which in this example here is "24.0.6". At the time of writing this documentation the minimum version of Nextcloud is 22.
-
+
```json
{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":24,"minor":0,"micro":6,"string":"24.0.6","edition":"","extendedSupport":false},"capabilities":{"bruteforce":{"delay":0},"metadataAvailable":{"size":["\/image\\\/.*\/"]},"theming":{"name":"Nextcloud","url":"https:\/\/nextcloud.com","slogan":"a safe home for all your data","color":"#0082c9","color-text":"#ffffff","color-element":"#0082c9","color-element-bright":"#0082c9","color-element-dark":"#0082c9","logo":"https:\/\/nextcloud.example.com\/nextcloud\/core\/img\/logo\/logo.svg?v=0","background":"https:\/\/nextcloud.example.com\/nextcloud\/core\/img\/background.png?v=0","background-plain":false,"background-default":true,"logoheader":"https:\/\/nextcloud.example.com\/nextcloud\/core\/img\/logo\/logo.svg?v=0","favicon":"https:\/\/nextcloud.example.com\/nextcloud\/core\/img\/logo\/logo.svg?v=0"}}}}}
```
@@ -359,9 +338,9 @@ If Nextcloud setup correctly the response should look like the following
{"user_id":"","authorization_header":foo}
```
-If not, first verify that the app **OpenProject Integration** is installed.
+If not, first verify that the app **OpenProject Integration** is installed.
-If that is the case verify that the mod_rewrite is activated on the Nextcloud server.
+If that is the case verify that the mod_rewrite is activated on the Nextcloud server.
To activate mod_rewrite the following commands can be used on the Nextcloud server:
```shell
@@ -374,8 +353,8 @@ If that also not work please check the [instructions for setting up pretty URLs
#### Files are not encrypted when using Nextcloud server-side encryption
> [!NOTE]
-> If your Nextcloud server uses server-side encryption, the GroupFolder encryption needs to be manually enabled.
-> This is relevant for automatically managed project folders, as the GroupFolder app is used in these cases.
+> If your Nextcloud server uses server-side encryption, the GroupFolder encryption needs to be manually enabled.
+> This is relevant for automatically managed project folders, as the GroupFolder app is used in these cases.
To enable encryption for GroupFolders, run the following command on your Nextcloud server:
```shell
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/README.md b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/README.md
new file mode 100644
index 00000000000..b0d8c55cf38
--- /dev/null
+++ b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/README.md
@@ -0,0 +1,156 @@
+---
+sidebar_navigation:
+ title: Setup Single-Sign-On through OpenID Connect Identity Provider
+ priority: 600
+description: Set up Single-Sign-On through OpenID Connect Identity Provider as the authentication method for your Nextcloud storage
+keywords: Nextcloud file storage integration
+---
+
+# Setup Single-Sign-On through OpenID Connect Identity Provider
+
+This authentication mode will use access tokens provided by an identity provider shared among Nextcloud and OpenProject to authenticate requests performed in the name of users.
+
+You will have to perform configuration in OpenProject, Nextcloud and in your chosen identity provider.
+
+## 1. Prerequisites
+
+To use SSO authentication between OpenProject and Nextcloud, a few prerequisites have to be met:
+
+1. Users need to login to OpenProject and Nextcloud through the same identity provider
+2. The identity provider needs to hand out compatible access tokens
+3. The identity provider needs to allow long-term access (e.g. through the `offline_access` scope)
+
+Those requirements are explained in more detail below.
+
+### User authentication
+
+The requests between OpenProject and Nextcloud usually happen on behalf of a specific user. For example when OpenProject requests a file, Nextcloud will need to make sure that the user for whom we download the file had access to it in the first place.
+
+For that to be possible, the user must authenticate in both applications through the same identity provider.
+
+Additionally the user account has to be created in both systems already at the time of the request. Right now this requires users to login to both systems at least once. In the future, the initial creations of accounts will also be automated.
+
+### Token compatibility
+
+The identity provider will need to hand out JWT encoded access tokens that can be validated according to the rules of [RFC 9068](https://www.rfc-editor.org/rfc/rfc9068). Such tokens indicate at which application they are allowed to be used (the so-called Token _Audience_) and can be validated by an application mostly without performing additional web requests to the identity provider.
+
+It must be possible for OpenProject to obtain an access token that includes the Nexcloud client in the audience and vice versa, to allow making requests between the two applications. This has to be supported in one of two ways by the identity provider:
+
+1. It allows to perform _OAuth 2.0 Token Exchange_ according to [RFC 8693](https://www.rfc-editor.org/rfc/rfc8693)
+2. Alternatively, it provides tokens with the necessary audience during initial SSO authentication of the user
+
+Token exchange is generally the more secure option, since it allows fine-grained control by the identity provider which application can obtain tokens to make requests to other applications. It's usually harder to use leaked access tokens of this kind for privilege escalation. However, depending on the provider, the latter option may be easier to set-up.
+
+### Long-term access
+
+OpenProject relies on the ability to retain access to issued tokens over a long duration. That means issued refresh tokens should not expire under normal circumstances. This is usually achieved by requesting a scope called `offline_access` from the identity provider.
+
+## 2. Configuring supported identity providers
+
+The integration between OpenProject and Nextcloud has been tested with the following identity providers and we consider them officially supported:
+
+* Keycloak
+* Nextcloud Hub
+
+Other identity providers might work as well, but we only have limited capabilities to help you in setting them up. The Keycloak instructions should explain all the general steps necessary to make it work, but the exact way to configure it for your identity provider will most likely be different.
+
+### Keycloak
+
+Keycloak can provide tokens via Token Exchange, as well as immediately after signing in the user. Using Token Exchange is preferred, but requires to enable two preview features in the Keycloak deployment:
+
+* `token-exchange`
+* `admin-fine-grained-authz`
+
+If you prefer to not enable preview features on your production deployment, it's also possible to use wide-access tokens.
+
+#### ... using Token Exchange
+
+##### Configuring Keycloak
+
+First make sure that you enabled both required features in Keycloak: `token-exchange` and `admin-fine-grained-authz`. You can [follow the Keycloak docs on how to do that](https://www.keycloak.org/server/features). Once they are enabled you can confirm them from the "Server Info" tab in your Keycloak installation:
+
+![The Keycloak UI that shows enabled features](keycloak_features.png)
+
+For the rest of this guide we will assume that you already have a client for OpenProject configured in Keycloak and it's client ID is `openproject` and a client configured for Nextcloud with the client ID `nextcloud`. We will need to allow OpenProject to exchange tokens with `nextcloud` in the audience, as well as allowing Nextcloud to exchange tokens with `openproject` in the audience.
+
+To do this, we first create policies that will be used to control which clients are allowed to exchange tokens for a specific audience. Go to the `realm-management` client (in the default realm this client is called `master-realm`) and switch to the Tab "Authorization" and there to the "Policies" submenu. In case the "Authorization" tab is not visible, it might be necessary to make it visible by going to "Permissions" first and enabling fine-grained permissions there. Assuming you didn't create any other policies yet, your view should look similar to this:
+
+![An empty list of policies](keycloak_empty_policies.png)
+
+Click the "Create client policy" button and select "Client" as the policy type. Other types would be possible as well (such as Client scope), but this guide will explain the setup based on a client policy. Name the policy `allowed-to-exchange-openproject-token` and add at least `nextcloud` to the list of clients, while making sure that the Logic is "Positive". Afterwards repeat the same steps, creating a policy called `allowed-to-exchange-nextcloud-token`, including `openproject` in the list of clients:
+
+![One of the two exchange policies configured above](keycloak_exchange_policy.png)
+
+We will later use these policies to control who is allowed to perform a token exchange that results in a token usable for requests to the given client. For example if you have additional clients that need to obtain a token usable at OpenProject, you'd add those clients to the `allowed-to-exchange-openproject-token` client list. The names suggested here are proposals for readable policy names, but they have no practical impact.
+
+Next we will need to use the policies, so that they actually do allow the token exchange for given clients. Navigate to the `openproject` client, go to the Tab "Permissions", enable the box "Permissions enabled" and select the permission with the name `token-exchange`. You should end up on a form similar to this one:
+
+![Empty view of the permission configuration dialog](keycloak_exchange_permission.png)
+
+In the field "Policies" you can now add the `allowed-to-exchange-openproject-token` we created earlier. This means that clients matching that policy will be allowed to exchange an access token that has the `openproject`.
+
+Afterwards repeat the previous steps to add the `allowed-to-exchange-nextcloud-token` policy to the `nextcloud` client.
+
+##### Configuring OpenProject
+
+In OpenProject it is enough to configure the ID of the Nextcloud client (in our example: `nextcloud`) as the "Storage Audience". This will make sure that OpenProject will attempt to exchange a token for that audience before making requests to Nextcloud:
+
+![OpenProject is configured to manually exchange tokens for the audience called nextcloud](openproject_manual_storage_audience.png)
+
+##### Configuring Nextcloud
+
+In Nextcloud we need to configure the OIDC provider that we are using as a common identity provider and also set the client ID of OpenProject as it's configured in Keycloak (in our case: `openproject`):
+
+![Nextcloud is configured to exchange tokens for the audience called openproject](nextcloud_manual_storage_audience.png)
+
+This wraps up the configuration of this authentication method using Keycloak and token exchange. For details on the next step continue with the [general setup instructions](../#4-automatically-managed-project-folders).
+
+#### ... using wide-access tokens
+
+##### Configuring Keycloak
+
+We will assume that you already have a client for OpenProject configured in Keycloak and it's client ID is `openproject` and a client configured for Nextcloud with the client ID `nextcloud`. We will add client scopes that result in the inclusion of an additional audience to the tokens returned during user authentication. This will cause OpenProject to receive tokens with an additional `nextcloud` audience and Nextcloud to receive tokens with an additional `openproject` audience.
+
+First navigate to "Client scopes" and there press the button to "Create client scope" and give the scope a name of `add-openproject-audience`. After saving your view should look similar to this:
+
+![A newly saved client scope form](keycloak_new_client_scope.png)
+
+This scope does not have any effect yet, we have to add a mapper first. Navigate to the "Mappers" tab, Click "Configure a new mapper" and select "Audience". Give the mapper a name of your choice and make sure to select `openproject` in "Included Client Audience". This will make sure that clients that receive a token with this scope, will get an additional audience of `openproject`:
+
+![A configured audience mapper for including openproject as audience in a token](keycloak_audience_mapper.png)
+
+Afterwards make sure to create another scope called `add-nextcloud-audience` that will add the `nextcloud` audience to tokens that carry it.
+
+Finally we need to assign our newly created client scopes to our OpenProject and Nextcloud clients, so that the scopes take effect there. Navigate to the Nextcloud client, open the "Client Scopes" tab of the client and click "Add client scope". Then select the `add-openproject-audience` scope and add it as a "Default" scope:
+
+![Nextcloud client with an additional scope added as default](keycloak_client_with_scope.png)
+
+Adding the scope as a default scope means that it doesn't have to be explicitly requested by the client, but will be implicitly included whenever requesting a token. Lastly repeat the same steps on the OpenProject client, adding the `add-nextcloud-audience` scope.
+
+##### Configuring OpenProject
+
+In OpenProject configure the storage to "Use first access token obtained by identity provider". This means OpenProject will not attempt to perform a token exchange, but simply use the first token returned by the identity provider for authentication against the storage as well:
+
+![OpenProject is configured to use the first access token obtained from the IDP](openproject_idp_storage_audience.png)
+
+##### Configuring Nextcloud
+
+TODO: How should we configure Nextcloud in this case? Not possible yet? Use `openproject`?
+
+This wraps up the configuration of this authentication method using Keycloak without token exchange. For details on the next step continue with the [general setup instructions](../#4-automatically-managed-project-folders).
+
+### Nextcloud Hub
+
+TODO: Maybe a few introductory words about Nextcloud Hub? (e.g. "Nextcloud has two roles; 1. IDP, 2. storage)
+
+##### Configuring OpenProject
+
+In OpenProject configure the storage to "Use first access token obtained by identity provider". This means OpenProject will not attempt to perform a token exchange, but simply use the first token returned by the identity provider for authentication against the storage as well:
+
+![OpenProject is configured to use the first access token obtained from the IDP](openproject_idp_storage_audience.png)
+
+##### Configuring Nextcloud
+
+TODO: How do we configure this scenario?
+
+This wraps up the configuration of this authentication method using Nextcloud Hub. For details on the next step continue with the [general setup instructions](../#4-automatically-managed-project-folders).
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_audience_mapper.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_audience_mapper.png
new file mode 100644
index 00000000000..dc9757607eb
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_audience_mapper.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_client_with_scope.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_client_with_scope.png
new file mode 100644
index 00000000000..0a5f754dc6f
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_client_with_scope.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_empty_policies.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_empty_policies.png
new file mode 100644
index 00000000000..97c5b8436ef
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_empty_policies.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_exchange_permission.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_exchange_permission.png
new file mode 100644
index 00000000000..8e278538bd6
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_exchange_permission.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_exchange_policy.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_exchange_policy.png
new file mode 100644
index 00000000000..d1ad4795094
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_exchange_policy.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_features.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_features.png
new file mode 100644
index 00000000000..becdc39336d
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_features.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_new_client_scope.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_new_client_scope.png
new file mode 100644
index 00000000000..8de7f6db0d4
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/keycloak_new_client_scope.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/nextcloud_manual_storage_audience.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/nextcloud_manual_storage_audience.png
new file mode 100644
index 00000000000..58d6f769c24
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/nextcloud_manual_storage_audience.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/openproject_idp_storage_audience.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/openproject_idp_storage_audience.png
new file mode 100644
index 00000000000..5984bb6488d
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/openproject_idp_storage_audience.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/oidc-sso/openproject_manual_storage_audience.png b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/openproject_manual_storage_audience.png
new file mode 100644
index 00000000000..b45e343d619
Binary files /dev/null and b/docs/system-admin-guide/integrations/nextcloud/oidc-sso/openproject_manual_storage_audience.png differ
diff --git a/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/README.md b/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/README.md
new file mode 100644
index 00000000000..76e195e6e0a
--- /dev/null
+++ b/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/README.md
@@ -0,0 +1,50 @@
+---
+sidebar_navigation:
+ title: Setup Two-way OAuth 2.0 authentication
+ priority: 600
+description: Set up Two-way OAuth 2.0 authentication as the authentication method for your Nextcloud storage
+keywords: Nextcloud file storage integration
+---
+
+# Setup Two-way OAuth 2.0 authentication
+
+This authentication mode will use access tokens provided by an OAuth application of either side of the integration between OpenProject and Nextcloud to authenticate requests performed in the name of users.
+
+You will have to perform configuration in OpenProject and in Nextcloud.
+
+## 1. Enter OpenProject OAuth values in Nextcloud settings
+
+After selecting and saving the authentication method in OpenProject, you will see a form with two text fields that show a **client ID** and a **client secret** that belong to the OAuth application that OpenProject has just automatically created.
+
+These values are needed to permit Nextcloud to connect to OpenProject.
+
+> [!IMPORTANT]
+> These generated values are not accessible again after you close the window. Please do not navigate away from this page before copying them over to Nextcloud, as instructed below. Treat these values with care, as you would an important password. Please do not reveal them to anyone else.
+
+![OpenProject generates OAuth values to copy over to Nextcloud](two_way_oauth2_setup_step_1.png)
+
+Go back to the browser tab where you were configuring the **OpenProject Integration** app. (We recommend you have two browser tabs open: the current one with OpenProject and the former one with Nextcloud).
+
+Copy the two generated values (client ID and secret) from the OpenProject tab to the respective fields in Nextcloud, namely **OpenProject OAuth client ID** and **OpenProject OAuth client secret**.
+
+![OAuth values generated by OpenProject are entered into Nextcloud app configuration](two_way_oauth2_setup_step_2.png)
+
+Once you have copied the values, click on **Save** to proceed to the next step.
+
+## 2. Enter Nextcloud OAuth values in OpenProject
+
+In the page that appears, you will see new OAuth values that are once again generated automatically, but this time by Nextcloud.
+
+OpenProject will need these values to be able to connect to your Nextcloud instance.
+
+Much like in the previous step, you will need to copy these two generated values (**Nextcloud OAuth client ID** and **Nextcloud OAuth client secret**) and paste them into OpenProject.
+
+![Nextcloud also generates OAuth values that need to be copied to OpenProject](two_way_oauth2_setup_step_3.png)
+
+Navigate back to your OpenProject tab and click on the **Done, continue** button on the screen you previously left it at. You will now see a screen where you will be able to enter the Nextcloud values.
+
+![OpenProject_NC_OAuth_values](two_way_oauth2_setup_step_4.png)
+
+Once you have entered the client ID and client secrets on this page, click on **Save and continue**.
+
+This wraps up the configuration of the authentication method. For details on the next step continue with the [general setup instructions](../#4-automatically-managed-project-folders).
diff --git a/docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_3.png b/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_1.png
similarity index 100%
rename from docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_3.png
rename to docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_1.png
diff --git a/docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_4.png b/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_2.png
similarity index 100%
rename from docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_4.png
rename to docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_2.png
diff --git a/docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_5.png b/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_3.png
similarity index 100%
rename from docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_5.png
rename to docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_3.png
diff --git a/docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_6.png b/docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_4.png
similarity index 100%
rename from docs/system-admin-guide/integrations/nextcloud/openproject_system_guide_nextcloud_integration_setup_step_6.png
rename to docs/system-admin-guide/integrations/nextcloud/two-way-oauth2/two_way_oauth2_setup_step_4.png