mirror of
https://github.com/grocy/grocy.git
synced 2025-10-14 09:11:11 +00:00
Reworked authentication related menu item handling (fixes #1462)
This commit is contained in:
@@ -19,11 +19,6 @@ class ApiKeyAuthMiddleware extends AuthMiddleware
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
if (!defined('GROCY_SHOW_AUTH_VIEWS'))
|
||||
{
|
||||
define('GROCY_SHOW_AUTH_VIEWS', true);
|
||||
}
|
||||
|
||||
$routeContext = RouteContext::fromRequest($request);
|
||||
$route = $routeContext->getRoute();
|
||||
$routeName = $route->getName();
|
||||
|
@@ -11,6 +11,8 @@ class LdapAuthMiddleware extends AuthMiddleware
|
||||
{
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
define('GROCY_EXTERNALLY_MANAGED_AUTHENTICATION', true);
|
||||
|
||||
// TODO: Reuse DefaultAuthMiddleware->authenticate somehow
|
||||
|
||||
// First try to authenticate by API key
|
||||
|
@@ -10,12 +10,9 @@ class ReverseProxyAuthMiddleware extends AuthMiddleware
|
||||
{
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$db = DatabaseService::getInstance()->GetDbConnection();
|
||||
define('GROCY_EXTERNALLY_MANAGED_AUTHENTICATION', true);
|
||||
|
||||
if (!defined('GROCY_SHOW_AUTH_VIEWS'))
|
||||
{
|
||||
define('GROCY_SHOW_AUTH_VIEWS', false);
|
||||
}
|
||||
$db = DatabaseService::getInstance()->GetDbConnection();
|
||||
|
||||
// API key authentication is also ok
|
||||
$auth = new ApiKeyAuthMiddleware($this->AppContainer, $this->ResponseFactory);
|
||||
|
@@ -15,11 +15,6 @@ class SessionAuthMiddleware extends AuthMiddleware
|
||||
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
if (!defined('GROCY_SHOW_AUTH_VIEWS'))
|
||||
{
|
||||
define('GROCY_SHOW_AUTH_VIEWS', true);
|
||||
}
|
||||
|
||||
$sessionService = SessionService::getInstance();
|
||||
|
||||
if (!isset($_COOKIE[SessionService::SESSION_COOKIE_NAME]) || !$sessionService->IsValidSession($_COOKIE[SessionService::SESSION_COOKIE_NAME]))
|
||||
|
Reference in New Issue
Block a user