96393[TASK] Add auth principal and local identity provider
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Benjamin Franzke +1
- Georg Ringer +1
-
Verified V +2 Done
- Benni Mack +2
- Benjamin Franzke +1
- Georg Ringer +1
- core-ci +1 CI
Issues 2
Files 14
- typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php+0 −31
- typo3/sysext/core/Classes/Authentication/CommandLineUserAuthentication.php+5 −8
- typo3/sysext/core/Classes/Authentication/CommandLineUserCreation.php5+22 −4
- typo3/sysext/core/Classes/Authentication/LocalIdentityProvider.phpnew+120 −0
- typo3/sysext/core/Classes/Authentication/Principal.php11new+82 −0
- typo3/sysext/core/Classes/Context/UserAspect.php+24 −1
- typo3/sysext/core/Tests/Functional/Authentication/Fixtures/CommandLineUser.csvnew+6 −0
- typo3/sysext/core/Tests/Functional/Authentication/Fixtures/CommandLineUserDuplicate.csvnew+4 −0
- typo3/sysext/core/Tests/Functional/Authentication/Fixtures/LocalIdentityProviderUsers.csvnew+22 −0
- typo3/sysext/core/Tests/Functional/Authentication/CommandLineUserAuthenticationTest.phpnew+110 −0
- typo3/sysext/core/Tests/Functional/Authentication/CommandLineUserCreationTest.phpnew+91 −0
- typo3/sysext/core/Tests/Functional/Authentication/LocalIdentityProviderTest.phpnew+159 −0
- typo3/sysext/core/Tests/Unit/Authentication/PrincipalTest.phpnew+138 −0
- typo3/sysext/core/Tests/Unit/Context/UserAspectTest.php+73 −0
Review log 4156
Show 2131 earlier messages
-
Benni Mack uploaded patch set 1 10/06/26, 04:50
-
core-ci voted on patch set 1 V -1 10/06/26, 05:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110174
-
Benni Mack marked it work in progress 10/06/26, 05:11
-
Benni Mack uploaded patch set 2
V -110/06/26, 05:53 -
core-ci voted on patch set 2 V +1 10/06/26, 06:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110180
-
Benni Mack uploaded patch set 3
V +110/06/26, 08:11 -
core-ci voted on patch set 3 V -1 10/06/26, 08:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110202
-
core-ci voted on patch set 3 V +1 10/06/26, 08:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110202
-
Benni Mack marked it ready for review 10/07/26, 10:44
-
Benjamin Franzke commented on patch set 3 10/08/26, 06:37
-
Oli Bartsch uploaded patch set 4
V +110/08/26, 20:01 -
Oli Bartsch commented on patch set 4 10/08/26, 20:04
Principal.php:31ReplyHey! Thanks, I've consolidated this: Principal now uses the PrincipalRole from 92211 and is the single source for PrincipalContext via toPrincipalContext(). The remaining derivation in LogEntryRepository will follow in a separate change. -
core-ci voted on patch set 4 V -1 10/08/26, 20:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110526
-
Oli Bartsch uploaded patch set 5
V -110/08/26, 20:15 -
core-ci voted on patch set 5 V -1 10/08/26, 20:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110527
-
Benni Mack commented on patch set 5 10/09/26, 09:09
Breaking-110924-RemovedUserLookupHelpersOfUserAuthentication.rst:6I don't think we should create a breaking RST, because -> IF we are going to go further with Authentication in v15, this will be the least issue people will have :) -
Oli Bartsch uploaded patch set 6
V -110/09/26, 10:18 -
Oli Bartsch commented on patch set 6 10/09/26, 10:19
Breaking-110924-RemovedUserLookupHelpersOfUserAuthentication.rst:6ReplyAgreed, both were internal: the changelog entry and the [!!!] are removed. -
core-ci voted on patch set 6 V +1 10/09/26, 10:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110579
-
Oli Bartsch uploaded patch set 7
V +110/09/26, 13:00 -
core-ci voted on patch set 7 V +1 10/09/26, 13:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110603
-
Oli Bartsch rebased onto patch set 8
V +110/09/26, 20:49 -
core-ci voted on patch set 8 V -1 10/09/26, 21:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110717
-
core-ci voted on patch set 8 V +1 10/09/26, 21:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110717
-
Georg Ringer voted on patch set 8 CR +1 V +1 10/10/26, 06:26
-
Wouter Wolters voted on patch set 8 CR +1 V +1 10/11/26, 09:50
-
Markus Klein commented on patch set 8 10/11/26, 11:31
CommandLineUserCreation.php:49This could deserve a slight performance improvement. Check for existence BEFORE the lock. And only if it does not exist: lock, check again, create, unlock This way the process does not get locked up the queue for the critical section, just because it needs to check for existence. -
Benjamin Franzke commented on patch set 8 10/12/26, 09:13
I propose to add a `PrincipialInterface` (that is implemented by AbstractUserAuthentication) instead of a new value object and let that be implemented by `AbstractUserAuthentication`. That would be a similar construct to the `TranslatorInterface` that was implemented in `LanguageService` recently, where a new restricted and consolidated interface was added. This way we can use `PrincipialInterface` everywhere where `AbstractUserAuthentication` is available today and can evaluate which requirements are actually needed (it seems like this patch needs to guess quite some parts that *may* be needed later).Principal.php:31ReplyCan we extend (or phase out) the existing `PrincipalContext` – I think we should avoid having too many layers that *mean* the same. The mentioned patch was merged with basically the justification as this patch/relation-chain: > This is a preparation for decoupling permission handling from the necessity of always having a BackendUserAuthentication instance. -
Oli Bartsch uploaded patch set 9
CR +1V +110/12/26, 12:32 -
Oli Bartsch commented on patch set 8 10/12/26, 12:39
Reply
I looked into this, but I don't think an interface implemented by AbstractUserAuthentication can replace the value object. The principal exists before and without a user object. The authenticators in https://review.typo3.org/c/Packages/TYPO3.CMS/+/95287 / https://review.typo3.org/c/Packages/TYPO3.CMS/+/95288 return it before any user authentication object is built, and in https://review.typo3.org/c/Packages/TYPO3.CMS/+/96561 the backend user is built from the principal only after the login checks have passed. With an interface on AbstractUserAuthentication, every authenticator would first need a fully initialised user object, which is the coupling this chain removes. AbstractUserAuthentication also changes during a request (switch user, workspace, logoff), while the pipeline result has to be a snapshot. You are right about the guessing, though: claims, getClaim(), displayName, authenticatedAt and toPrincipalContext() had no consumer in Core and are removed. They can come back with their first consumer. If a narrow read interface (id, role, group ids) is still useful for consumers like UserAspect or LogEntryRepository, implemented by both the Principal and BackendUserAuthentication, I'm happy to add it in a follow-up.Principal.php:31ReplyAgreed. Two types carrying the same four fields was one layer too many. Principal now composes the PrincipalContext instead of duplicating it. Principal adds what only authentication knows (realm, username, group names, authentication methods). This also matches the docblock of PrincipalContext, which describes it as part of the Principal object. Phasing PrincipalContext out completely does not work, as it also covers SYSTEM and MAINTAINER contexts without a user record. -
Oli Bartsch commented on patch set 9 10/12/26, 12:39
CommandLineUserCreation.php:49ReplyDone. existence is checked first, and only a missing user takes the lock, is checked again and created.
-
core-ci voted on patch set 9 V +1 10/12/26, 12:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110903
-
Markus Klein commented on patch set 9 10/12/26, 14:19
CommandLineUserCreation.php:48Reading this again, I'm not sure about the return value. We return false if it did exist, and only true, if we just created it. That's not reflected by the method's name. At least I wouldn't derive this behaviour from the name and the description -
Oli Bartsch uploaded patch set 10
V +110/12/26, 19:57 -
Oli Bartsch commented on patch set 10 10/12/26, 19:59
CommandLineUserCreation.php:48ReplyGood catch.. caller now looks the user up again after ensureCliUserExists() instead of relying on its result, and the method returns void. -
core-ci voted on patch set 10 V +1 10/12/26, 20:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110939
-
Andreas Kienast commented on patch set 10 10/22/26, 08:25
LocalUserLookup.php:105IMO this should be an `elseif`, be_users AND storage PIDs contradict each other. -
Benni Mack uploaded patch set 11
V +110/23/26, 10:34 -
core-ci voted on patch set 11 V +1 10/23/26, 10:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112270
-
Benni Mack commented on patch set 11 10/23/26, 11:36
LocalUserLookup.php:105ReplyDone -
Benni Mack uploaded patch set 12
V +110/23/26, 12:42 -
Benni Mack commented on patch set 12 10/23/26, 12:43
CommandLineUserCreation.php:48ReplyDonePrincipal.php:31Replyplease lets add the PrincipalInterface when we need it? -
Benni Mack commented on patch set 12 10/23/26, 12:43
Reply
yes. please add it as a followup -
Benni Mack commented on patch set 12 10/23/26, 12:43
Reply
Done -
Benjamin Franzke commented on patch set 12 10/23/26, 12:54
LocalUserLookup.php:44The term "local" sounds like we already have remote users. Also it is very similar to our `Repository` patterns. Maybe just `UserRepository`?Principal.php:59It is hard for me to grasp why this is needed. I guess to detect if the user has `mfa` in progress. That's basically state of the user, not **the user principal** itself. On the other hand the relation chain introduces a `BadgeInteface` concept to describe derived data or state. It feels like this is rather a badge than part of the identity (=principal)? Can this be extracted? I'd wish for the Principal to only describe the user and realm, similar to kerberos principals: https://web.mit.edu/kerberos/krb5-1.5/krb5-1.5.4/doc/krb5-user/What-is-a-Kerberos-Principal_003f.html -
core-ci voted on patch set 12 V +1 10/23/26, 12:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112299
-
Benni Mack uploaded patch set 13
V +110/23/26, 13:13 -
Benni Mack commented on patch set 13 10/23/26, 13:14
Principal.php:59Replyremoved it for both -
Benni Mack commented on patch set 13 10/23/26, 13:14
LocalUserLookup.php:44ReplyCalled it ProviderPrincipal.php:59ReplyDone -
core-ci voted on patch set 13 V +1 10/23/26, 13:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112304
-
Benjamin Franzke commented on patch set 13 10/23/26, 14:11
Principal.php:54Sorry, I stumbled over another thing: `$groupNames` seems to be redundant with `PrincipalContext->groupIds` and is optional. Is that on purpose? In general I wonder why `$groupNames` is optional. Maybe that is related to my question in https://review.typo3.org/c/Packages/TYPO3.CMS/+/95284/comment/5da3fa40_7f0678a3/ where it seems that we have intermediate and hydrated Principals. I think, if we add this redundancy (i guess for the UserAspect derivation), we should require it to be always present, in order to avoid forgetting to supply the group names. *(Other than that +1 from my side, although it feels still a bit rough to have a PrincipalContext and a Principal, but I can't express why.)* -
Benni Mack commented on patch set 13 10/23/26, 14:21
Principal.php:54ReplyPrincipalContext was because Olly started Authorization (and not Authentication), we should have had a better differentiation before. We need the groupNames because we are in UserContext so we make actually use of it at some point, and this is where we do. I hope we could migrate this away at some point. -
Benjamin Franzke commented on patch set 13 CR +1 V +1 10/23/26, 14:37
Principal.php:54ReplyOk, I can vote this (as this patch basically prepares but doesn't really uses the principal) in order to move forward, but I guess we'll need to revisit this as already mentioned (intermediate vs hydrated Principals): https://review.typo3.org/c/Packages/TYPO3.CMS/+/95284/comment/5da3fa40_7f0678a3/ -
Georg Ringer voted on patch set 13 CR +1 V +1 10/24/26, 06:57
-
Benni Mack voted on patch set 13 CR +2 V +2 10/24/26, 07:25
-
Benni Mack merged patch set 14 10/24/26, 07:25
Principal.php:31