nextcloud / user_oidc

OIDC connect user backend for Nextcloud
GNU Affero General Public License v3.0
89 stars 36 forks source link

Does not correctly generate redirection urls if Nextcloud is in a path other than / #989

Open bdovaz opened 2 days ago

bdovaz commented 2 days ago

How to use GitHub


Steps to reproduce

We are migrating from user_saml to user_oidc and we noticed that user_oidc generates bad redirect urls when Nextcloud is set to a path other than β€œ/” which is done by following these steps:

https://docs.nextcloud.com/server/21/admin_manual/configuration_server/reverse_proxy_configuration.html?highlight=overwrite#overwrite-parameters

If we look at user_saml it has solved it by generating the absolute urls which is why it works for us:

https://github.com/nextcloud/user_saml/blob/72a8539a5447a73abf941b4b4c9e1a5cfc70fc78/appinfo/app.php#L146

In user_oidc does not work because it does not:

https://github.com/nextcloud/user_oidc/blob/d161cdd8b254ca90246b362165003ae2854cec1e/lib/AppInfo/Application.php#L86

https://github.com/nextcloud/user_oidc/blob/d161cdd8b254ca90246b362165003ae2854cec1e/lib/AppInfo/Application.php#L100

To fix it we would have to convert the urls to absolute urls.

Expected behaviour

It should redirect correctly even if it is set to a path other than β€œ/”.

Actual behaviour

It gives a 404 because it tries to resolve urls without taking into account that it is in a path different from β€œ/”.

Server configuration

Web server: Apache/Nginx

Database: MySQL/Maria/SQLite/PostgreSQL

PHP version: 8.1/8.2/8.3

Nextcloud version: (see Nextcloud admin page)

List of activated apps ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder ```
Nextcloud configuration ``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder ```

Browser

Browser name: Firefox/Chrome/Safari/…

Browser version: 124/125/…

Operating system: Windows/Ubuntu/Mac/…

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```