grocy/middleware
Geoffrey “Frogeye” Preud'homme 1734484ba7
Forbid empty username header for reverse proxy authentication
Consider the case where a Grocy user wants to use reverse proxy
authentication OR authentication with an API key.

By default, authenticating reverse proxy will unconditionally perform
user authentication, before allowing a request to be passed to Grocy
which will verify an API key, rendering them virtually useless.
So the proxy needs to be configured not to perform authentication in
certain cases, for example the presence of the `Grocy-Api-Key` HTTP
header, or the path being a subdirectory of `/api/`.

It can however be tricky to configure this though. For example, nginx
does not allow conditional authentication, or conditional header
setting. In those cases, when the condition is met, the username header
would still be returned, albeit empty. Grocy will then create an user
with empty username (not normally possible). It default to having all
permissions, and while most are removable, reading chores/stock/etc.
do not seem to be, and would thus be public.

This returns an error when the username is empty, to accomodate for
those cases.
2025-11-30 00:30:34 +01:00
..
ApiKeyAuthMiddleware.php Upgraded package php-di/php-di 2023-07-29 14:02:56 +02:00
AuthMiddleware.php Upgraded package php-di/php-di 2023-07-29 14:02:56 +02:00
BaseMiddleware.php Upgraded PHP-CS-Fixer / applied optimized rules 2023-08-02 18:44:30 +02:00
CorsMiddleware.php Optimized imports 2023-05-13 14:43:51 +02:00
DefaultAuthMiddleware.php Typo 2020-10-19 18:41:16 +02:00
JsonMiddleware.php Removed unused code 2020-12-21 19:27:04 +01:00
LdapAuthMiddleware.php Optimized LDAP error handling (references #1865) 2022-04-19 16:56:48 +02:00
LocaleMiddleware.php Upgraded PHP-CS-Fixer / applied optimized rules 2023-08-02 18:44:30 +02:00
ReverseProxyAuthMiddleware.php Forbid empty username header for reverse proxy authentication 2025-11-30 00:30:34 +01:00
SessionAuthMiddleware.php Upgraded package php-di/php-di 2023-07-29 14:02:56 +02:00