CDRO / simulatebe

Simulatebe allows you to log in to the backend with your frontend user.
0 stars 3 forks source link

Add support for TYPO3v10, drop support for TYPO3v9 #18

Closed cweiske closed 2 years ago

cweiske commented 2 years ago

:exclamation: Since the changes are substantial, I'd like to see tests by other users before this should be merged.

Middleware order

Biggest problem with v10 is that the order of the middlewares changed. In TYPO3v9, "typo3/cms-frontend/authentication" came first, and "typo3/cms-frontend/backend-user-authentication" second. simulatebe could squeeze between them.

With TYPO3v10 the order is switched:

  1. typo3/cms-frontend/backend-user-authentication
  2. typo3/cms-frontend/authentication

This means we don't have a frontend user when we are called before backend-user-authentication, and can't rely on backend-user-authentication to initialize the backend user automatically after we simulated the backend user cookie.

Instead we call the backend-user-authentication middleware ourselves to let it handle the setup, even if it's called a second time now.

Logout process

We have to rely on the logoff_post_processing hook to logout the backend user when the frontend user is logged out, because we do not know that a frontend user existed when our middleware is called.

Cookie cleanup is still done in our middleware because that's easier to do than in the logoff hook.

Resolves: https://github.com/CDRO/simulatebe/issues/15

cweiske commented 2 years ago

Seems to work for at least one person: https://github.com/CDRO/simulatebe/issues/15#issuecomment-1116190214

CDRO commented 2 years ago

Regarding the Error, maybe there needs to be a dependency on something, so that the extension is loaded after all core-packages that it potentially depends on (used to be sv, which is core now). But I'll keep this in the back of my mind, if it happens again. I'll release the new version during the next week, with due credits, of course.

CDRO commented 2 years ago

New version released, should be online in the next hour or so.

cweiske commented 2 years ago

Thanks!