Review main Merged

75797[TASK] Clean up AbstractUserAuthentication

Benni Mack CR +2 V +2 Hard +137 −180 updated 09/21/22, 15:49

Commit message

This change renames variables and splits up
some logic in AbstractUserAuthentication in order
to allow further changes.

Various variable names are changed in order
to understand the logic in the main monster
"checkAuthentication" method better.

In addition, the ->getAuthInfoArray() method
is now moved to a separate call so it is obvious
what is needed, making some unit tests a bit nicer.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Hader +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Hader +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 2028

Show 23 earlier messages
  1. Benni Mack uploaded patch set 1 09/20/22, 14:53

  2. core-ci voted on patch set 1 V +1 09/20/22, 15:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31323

  3. Benni Mack uploaded patch set 2 09/20/22, 15:22

  1. Benni Mack uploaded patch set 3 09/20/22, 15:29

  2. core-ci voted on patch set 2 V -1 09/20/22, 15:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31324

  3. core-ci voted on patch set 3 V -1 09/20/22, 15:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31325

  4. Benni Mack uploaded patch set 4 09/21/22, 07:08

  5. core-ci voted on patch set 4 V -1 09/21/22, 07:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31336

  6. Benni Mack uploaded patch set 5 09/21/22, 07:38

  7. core-ci voted on patch set 5 V -1 09/21/22, 07:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31339

  8. Benni Mack uploaded patch set 6 09/21/22, 08:46

  9. Benni Mack updated the commit message in patch set 7 09/21/22, 08:48

  10. core-ci voted on patch set 6 V +1 09/21/22, 08:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31341

  11. core-ci voted on patch set 7 V +1 09/21/22, 08:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31342

  12. Oliver Hader commented on patch set 7 09/21/22, 10:37

    AbstractUserAuthentication.php:457

    Is the comment correct? We are in `!$this->userSession->isNew()`

    AbstractUserAuthentication.php:482

    It's like before, however `$anonymousSession` implies having `$isExistingSession` as well.

    AbstractUserAuthentication.php:487

    `$authenticatedUserFromSession !== null`?

    AbstractUserAuthentication.php:529

    Is this correct? `$authenticatedUserFromSession` is `$authInfo['user']`, isn't it?
  13. Oliver Hader commented on patch set 7 V +1 09/21/22, 10:46

    See my comments code-wise. However, from a testing POV it works

    AbstractUserAuthentication.php:529 Reply

    Aha, that's merged in `getAuthServices` now...

    AbstractUserAuthentication.php:744

    From my POV changing the meaning of `$authInfo` to `$authenticatedUserFromSession` is worth documentation. I fear `getAuthServices` might be used by custom implementations as well..
  14. Frank Nägler commented on patch set 7 09/21/22, 12:17

    AbstractUserAuthentication.php:457 Reply

    I agree, this comment confuses me 😊
  15. Oliver Klee commented on patch set 7 09/21/22, 12:19

    AbstractUserAuthentication.php:487 Reply

    Or even more explicit: `$authenticatedUserFromSession instanceof …`
  16. Benni Mack commented on patch set 7 09/21/22, 12:26

    AbstractUserAuthentication.php:457 Reply

    yes. the comment is wrong.

    AbstractUserAuthentication.php:487 Reply

    instanceof array?
  17. Oliver Klee commented on patch set 7 09/21/22, 12:42

    AbstractUserAuthentication.php:487 Reply

    Oh, sorry, of course this should be: is_array($authenticatedUserFromSession)
  18. Benni Mack commented on patch set 7 09/21/22, 15:07

    AbstractUserAuthentication.php:482 Reply

    interesting, I will document this.

    AbstractUserAuthentication.php:529 Reply

    yes. previously this was merged into the main $authInfo array and it was never clear when $authInfo was used. For this reason, this is now better readable.

    AbstractUserAuthentication.php:744 Reply

    In my previous v10/v11 projects with custom authentication providers, I already use "$authInfo['user']", so this ain't a change in behaviour. I do however want to proceed in making this more explicit (as an object), which is when I would document this at that point. OK?
  19. Benni Mack uploaded patch set 8 09/21/22, 15:07

  20. Benni Mack commented on patch set 7 09/21/22, 15:08

    AbstractUserAuthentication.php:457 Reply

    Done

    AbstractUserAuthentication.php:482 Reply

    Done

    AbstractUserAuthentication.php:487 Reply

    Done

    AbstractUserAuthentication.php:529 Reply

    Done
  21. core-ci voted on patch set 8 V +1 09/21/22, 15:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31384

  22. Oliver Hader commented on patch set 8 V +1 CR +1 09/21/22, 15:19

    AbstractUserAuthentication.php:744 Reply

    I'd highly appreciate and welcome that (having a model here) 👍 Fine!
  23. Benni Mack commented on patch set 8 09/21/22, 15:29

    AbstractUserAuthentication.php:744 Reply

    Done
  24. Christian Kuhn voted on patch set 8 V +2 CR +2 09/21/22, 15:49

  25. Christian Kuhn merged patch set 9 09/21/22, 15:49