Project

General

Profile

Actions

Bug #90070

closed

isLoggedIn not set in PSR-15 Middleware

Added by Thomas Kieslich over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Authentication
Target version:
-
Start date:
2020-01-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

/** @var UserAspect $frontendUserAspect */
        $frontendUserAspect = GeneralUtility::makeInstance(Context::class)->getAspect('frontend.user');
        $id = $frontendUserAspect->get('id');
        $loggedIn = $GLOBALS['TSFE']->loginUser;
        $loggedInNew = $frontendUserAspect->isLoggedIn();

With this Code in a Middleware Script i get a ID (User is logged in) but no loggedIn Flag (false)
I found out that in the FrontendUserAuthentication Object the groupData Property is empty.
If i run GLOBALS['TSFE']->initUserGroups(); before, it works fine.
It should work without manual Initialization. This Code works fine:

        $GLOBALS['TSFE']->initUserGroups();
        /** @var UserAspect $frontendUserAspect */
        $frontendUserAspect = GeneralUtility::makeInstance(Context::class)->getAspect('frontend.user');
        $id = $frontendUserAspect->get('id');
        $loggedIn = $GLOBALS['TSFE']->loginUser;
        $loggedInNew = $frontendUserAspect->isLoggedIn();

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #90989: Lookup of access restricted records throws 404Closed2020-04-09

Actions
Actions

Also available in: Atom PDF