Review main Abandoned

86123[WIP][FEATURE] Introduce `AfterUserAuthenticatedEvent`

Stefan Bürk CR 0 V 0 Normal +59 −0 updated 09/16/24, 18:31

Commit message

User authentication implementation dispatches already
the `AfterUserLoggedInEvent` event but only on active
login process.

Extension authors may be in need to directly do the
one or other thing directly on succesefully authing
an user which happens on every request.

This change now introduces a new PSR-14 event to the
user authentication process:

 \TYPO3\CMS\Core\Authentication\Event\AfterUserAuthenticatedEvent

providing following methods:

* getUser(): AbstractUserAuthentication
* getRequest(): ?ServerRequestInterface
* getRecord(): array
* setRecord(array $user): void

This event can for example be used to dynamically
apply permission presets to the user record using
the permission preset API introduced with #104672

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 45

  1. Stefan Bürk uploaded patch set 1 09/16/24, 16:14

  2. core-ci voted on patch set 1 V -1 09/16/24, 16:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65910

  3. Oli Bartsch commented on patch set 1 09/16/24, 17:14

    AbstractUserAuthentication.php:597

    According to Lolli's comment here https://review.typo3.org/c/Packages/TYPO3.CMS/+/85727, we should not pass $this to the event. Do we have real use cases where this event is needed and can we use those cases to actually identify which information are necessary?
  4. Stefan Bürk commented on patch set 1 09/16/24, 17:34

    AbstractUserAuthentication.php:597 Reply Unresolved

    The deployable permission set change. Currently only working on be_groups but benni asked if that could not be done for be_users. So either the record ($this->user) must be past and back or the authentication class which allwos user publicly to be set also being internal for now. Other way would be to later add the service to overlay records in some way directly, which benni denied to do within the group resolver alrady and use the event there (which was suitable). Not sure if I have enough power to finish this for the feature freeze and get in. Was a quick shot to have a suitable event in place as the "AfterUserLoggedIn" only fires during the real login process and not on every request. Added the authentication class to be in lign with the AfterUserLoggedIn but did not like that either - added the record then instead. Only pushed to get instance clean to work again other things. So what you thing ? Drop the authclass and add at least the `login_type` as string value to the event along with the record ?
  5. Stefan Bürk abandoned the change 09/16/24, 18:31