- ๐ง๐ชBelgium swentel
It's already on the UserController, so I think we're done here ?
- ๐จ๐ญSwitzerland ParisLiakos
nope. i dont think we should suggest calling controller methods directly. still the API call here is user_logout() which is procedural
- ๐บ๐ธUnited States Crell
We need a service or method on a service that explicitly logs out an active user. It should be called FROM a controller, but not be on a controller. Controllers should not have meaningful business logic in them.
- ๐ฉ๐ชGermany dawehner
I really wonder whether it is worth to make an interface here and I can't get some sleep.
The last submitted patch, user-2012976-4.patch, failed testing.
- ๐จ๐ญSwitzerland ParisLiakos
if we are introducing a separate service for this i think we should generalize it more and include similar functions eg
user_login_finalizemaybe call it UserHandler? or AccountHandler
- ๐ฉ๐ชGermany dawehner
Mark will come up with a better name anyway if needed.
The last submitted patch, user_handler-2012976-8.patch, failed testing.
Drupal 8.4.4 โ was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. ( Drupal 8.5.0-alpha1 โ is available for testing.)
Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule โ and the Allowed changes during the Drupal 8 release cycle โ .
Drupal 8.3.6 โ was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. ( Drupal 8.4.0-alpha1 โ is available for testing.)
Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule โ and the Allowed changes during the Drupal 8 release cycle โ .
Drupal 8.2.6 โ was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. ( Drupal 8.3.0-alpha1 โ is available for testing.)
Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule โ and the Allowed changes during the Drupal 8 release cycle โ .
Drupal 8.1.9 โ was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 โ is now available and sites should prepare to upgrade to 8.2.0.
Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule โ and the Allowed changes during the Drupal 8 release cycle โ .
Drupal 8.0.6 โ was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 โ is now available and sites should prepare to update to 8.1.0.
Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule โ and the Allowed changes during the Drupal 8 release cycle โ .
- ๐จ๐ญSwitzerland ParisLiakos
We have UserAuth now, its probably a nice place to put those there, too
Drupal 8.5.6 โ was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. ( Drupal 8.6.0-rc1 โ is available for testing.)
Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule โ and the Allowed changes during the Drupal 8 release cycle โ .
- ๐จ๐ฆCanada jibran Toronto, Canada
Which include file are we killing here?
Drupal 9.4.9 โ was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule โ and the Allowed changes during the Drupal core release cycle โ .
Drupal 9.3.15 โ was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule โ and the Allowed changes during the Drupal core release cycle โ .
Drupal 8 is end-of-life as of November 17, 2021 โ . There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule โ and the Allowed changes during the Drupal core release cycle โ .
Drupal 8.8.7 โ was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 โ or Drupal 9.0.0 โ for ongoing support.
Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule โ and the Allowed changes during the Drupal 8 and 9 release cycles โ .
Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule โ and the Allowed changes during the Drupal 8 and 9 release cycles โ .
- ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Yeah, I agree. This is just methods on user.module
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
The issue summary must be updated too. It is not completely clear what should be done and why.
- Merge request !4539Issue #2012976: Deprecate user_logout() and user_login_finalize() and replace with a service โ (Open) created by kim.pepper
- last update
over 1 year ago 29,948 pass - Status changed to Needs review
over 1 year ago 6:41am 4 August 2023 - ๐ซ๐ทFrance andypost
It looks nice but naming confusing me, as just landed ๐ Remove try...catch from SessionHandler::write Fixed with another session handler
Maybe user module should just decorate
\Drupal\Core\Session\SessionHandler
?
it's the real storage service which is mussing in related issue - last update
over 1 year ago 29,955 pass - last update
over 1 year ago 29,952 pass, 2 fail - last update
over 1 year ago 29,955 pass - Status changed to Needs work
over 1 year ago 4:14pm 11 August 2023 - ๐บ๐ธUnited States smustgrave
All threads appear to be resolved and tests all green.
This was tagged for CR updates so moving to NW for that.
Good job everyone!
- Status changed to Needs review
over 1 year ago 12:42am 14 August 2023 - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Updated CR
- Status changed to RTBC
over 1 year ago 2:34pm 17 August 2023 - ๐บ๐ธUnited States smustgrave
Updated CR reads well.
Thanks @kim.pepper!
- last update
over 1 year ago 29,979 pass - last update
over 1 year ago 30,051 pass - Status changed to Needs review
over 1 year ago 9:01am 21 August 2023 - ๐ซ๐ฎFinland lauriii Finland
Added few comments to the MR. Tagging for framework manager review to get a review on the new API.
- last update
over 1 year ago 30,048 pass, 2 fail - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Thanks for the reviews. Addressed all feedback.
43:32 39:47 Running- last update
over 1 year ago 30,172 pass - Status changed to RTBC
over 1 year ago 9:40pm 9 October 2023 - ๐บ๐ธUnited States smustgrave
With 10.2 approaching going to remark this for committers/framework managers to take a look.
- last update
over 1 year ago 30,388 pass - last update
over 1 year ago 30,396 pass - last update
over 1 year ago 30,401 pass - last update
over 1 year ago 30,401 pass - last update
over 1 year ago 30,417 pass 0:07 58:41 Running- last update
over 1 year ago 30,429 pass - last update
over 1 year ago 30,430 pass - last update
over 1 year ago 30,440 pass - last update
over 1 year ago 30,442 pass - last update
over 1 year ago 30,468 pass - last update
over 1 year ago 30,485 pass - last update
over 1 year ago 30,487 pass - last update
over 1 year ago 30,489 pass, 1 fail - last update
over 1 year ago 30,490 pass - last update
over 1 year ago 30,514 pass - last update
over 1 year ago 30,520 pass - last update
over 1 year ago 30,517 pass, 2 fail - last update
over 1 year ago 30,534 pass 45:10 42:52 Running- last update
over 1 year ago 30,606 pass - last update
over 1 year ago Build Successful - last update
over 1 year ago 30,609 pass - last update
over 1 year ago 30,672 pass - last update
over 1 year ago 30,679 pass - last update
over 1 year ago 30,683 pass - last update
over 1 year ago 30,690 pass - last update
over 1 year ago 30,692 pass - last update
over 1 year ago 30,692 pass - last update
over 1 year ago 30,700 pass - last update
over 1 year ago 30,702 pass - last update
over 1 year ago 30,706 pass - last update
over 1 year ago 30,716 pass - last update
over 1 year ago 30,768 pass - last update
over 1 year ago 30,770 pass - last update
about 1 year ago 25,918 pass, 1,817 fail - last update
about 1 year ago 25,868 pass, 1,793 fail - last update
about 1 year ago Build Successful - last update
about 1 year ago 25,925 pass, 1,806 fail - Status changed to Needs work
about 1 year ago 1:36pm 25 December 2023 - ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
#32 was never really addressed - the name UserSessionHandler implies something that extends \SessionHandlerInterface like \Drupal\Core\Session\SessionHandler but this is not that.
Also by introducing \Drupal\user\UserSessionHandlerInterface and the service we are creating a new swappable API which feels like something we don't actually want to do. Are there use-cases?
We also need to update the deprecations for 10.3.
- Status changed to Needs review
about 1 year ago 9:03pm 25 December 2023 - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Removed
UserSessionHandlerInterface
and updated deprecation notices to 10.3.0.Not sure what a better name is? Maybe
UserLoginHandler
?Back to NR for feedback on that suggestion.
- ๐ซ๐ทFrance andypost
OTOH there's
SessionManagerInterface
which can be extended withfinalizeLogin()
andfinalizeLogout()
methods - ๐จ๐ญSwitzerland znerol
OTOH there's SessionManagerInterface which can be extended with finalizeLogin() and finalizeLogout() methods
I'd prefer if
SessionManagerInterface
will go away in the long run. All of the remaining code inSessionManager
is supposed to be extracted to session handler decorators or even to upstream. - ๐ฎ๐ณIndia prashant.c Dharamshala
Prashant.c โ made their first commit to this issueโs fork.
- ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
How about
UserSessionFinalizer
withfinalizeLogin()
andfinalizeLogout()
? - ๐ซ๐ทFrance andypost
extracted to session handler decorators
it sounds good idea, needs to check which services can get decorators to react of login/logout
- First commit to issue fork.
- Status changed to Needs work
about 1 year ago 8:58pm 8 January 2024 - ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Looks great.
Couple of places where we're missing docs (can't use @inheritdoc if there is no parent interface).#45 sounds like a good idea.
This feels like a case where we would want to make the service final to make it a bit harder to swap out.
Looks to have failing tests.
- Status changed to Needs review
about 1 year ago 1:39am 12 January 2024 - Status changed to RTBC
about 1 year ago 2:56pm 12 January 2024 - ๐บ๐ธUnited States smustgrave
Appears all feedback has been addressed.
Since this has gone through several rounds of reviews I'm going to remark it vs the new #needs-review-queue-initiative strategy of waiting a week.
- Status changed to Needs work
about 1 year ago 5:21pm 12 January 2024 - ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
- Status changed to Needs review
about 1 year ago 2:00am 15 January 2024 - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Renamed to
UserSessionFinalizer
and made the service classfinal
. - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Getting this error in the test failure which I think is unrelated:
1) Drupal\Tests\standard\FunctionalJavascript\StandardJavascriptTest::testBigPipe TypeError: trim(): Argument #1 ($string) must be of type string, bool given
- Status changed to Needs work
about 1 year ago 1:57pm 29 January 2024 The Needs Review Queue Bot โ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- Status changed to Needs review
about 1 year ago 8:54pm 29 January 2024 - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Rebased on 11.x
- ๐ซ๐ทFrance andypost
Thank you! It looks ready!
btw as the new service is public it makes it an extension point, literally hooks user_(ligin|logout) can be implemented as the service decorators?
- Status changed to RTBC
about 1 year ago 2:35pm 31 January 2024 - ๐บ๐ธUnited States smustgrave
Appears feedback has been addressed.
@andypost let me know if I'm wrong but sounds like in #57 you're asking a general question correct?
- Status changed to Needs review
about 1 year ago 4:06am 1 February 2024 - ๐ฌ๐งUnited Kingdom catch
The issue summary and change record no longer match the MR.
- Status changed to RTBC
about 1 year ago 1:10am 2 February 2024 - ๐ฆ๐บAustralia kim.pepper ๐โโ๏ธ๐ฆ๐บSydney, Australia
Updated CR and IS. As I just updated the service and method names, and there are no code changes, I think it's safe to re-RTBC.
- Status changed to Needs review
about 1 year ago 12:23am 21 February 2024 - ๐ณ๐ฟNew Zealand quietone
I'm triaging RTBC issues โ . I read the IS and the comments. I didn't find any unanswered questions.
I read the MR and made some comments. One of which is questioning the name of the service so I am setting to NR to settle that.
- ๐ณ๐ฟNew Zealand quietone
I chatted with @kim.pepper who wasn't not opposed to changing UserSessionFinalizer to UserSessionFinalize. Therefore, I have made a commit for that. And also updated a comment.
- ๐ณ๐ฟNew Zealand quietone
I did not update the change record. Happy to do that if folks agree to the name change.
- Status changed to RTBC
about 1 year ago 3:30pm 21 February 2024 - ๐บ๐ธUnited States smustgrave
I think Finalize makes sense too. I updated the CR and issue summary to reflect that.
- Status changed to Needs review
about 1 year ago 10:12am 5 March 2024 - ๐ฌ๐งUnited Kingdom catch
There are some things I'm not sure about with this one but not sure I can articulate all of them. Left some review comments on the MR for now.
- ๐ฌ๐งUnited Kingdom longwave UK
@catch asked for further opinions on this. My first thought was that really we are just moving code around; procedural code is now in a service that isn't meant to be swapped (because it's declared final), so what do we gain here?
Also, a new service with seven very different dependencies is a bit of a code smell. Should login and logout be events instead? Then each subsystem can declare event subscribers and react as they see fit, and each part would be replaceable individually if someone wanted to switch something out?
- ๐จ๐ญSwitzerland znerol
Should login and logout be events instead? Then each subsystem can declare event subscribers and react as they see fit, and each part would be replaceable individually if someone wanted to switch something out?
I was thinking the same.
- ๐จ๐ญSwitzerland berdir Switzerland
> @catch asked for further opinions on this. My first thought was that really we are just moving code around; procedural code is now in a service that isn't meant to be swapped (because it's declared final), so what do we gain here?
See ๐ Only load all modules when a hook gets invoked Needs review . What we gain is that we move one of the few remaining .module functions called from controllers and other OOP code, allowing us to load .module files only when a hook is invoked.
> Should login and logout be events instead? Then each subsystem can declare event subscribers and react as they see fit, and each part would be replaceable individually if someone wanted to switch something out?
We already have login/logout hooks. This is the API responsible for calling these hooks. I think we shouldn't have events *and* hooks for the same thing, so is the proposal to replace the existing hooks with an event and the sole API for finalizing login/logout would be to invoke the respective event?
That does sound sensible, we do have some existing examples for that, for example around file name sanitization. But that would also make this a considerably larger issue as we'd need to convert existing hook_user_login/logout implementations, deprecate the hook and also think about the API design of these hooks. One of the major use cases for hook_user_login() is to control where the user is redirected to afterwards and that's only possible with workarounds atm which tend to break other implementations of that hook.
FWIW, basically everything the service does is a user module thing, I don't think we could really split that up much apart from separating login and logout.
> Given we log separately here, do we need the logging to be done in the finalize service itself? I think we could take that out of the service and callers are responsible for logging if they want to.
I can see an argument for both options. Ensuring that each login is properly logged seems important from a security perspective, so it seems sensible to do it in the API. But separating would avoid duplicate logs and logs could be more specific.
- ๐บ๐ธUnited States smustgrave
So this is something that should still move forward?
- ๐ฌ๐งUnited Kingdom catch
I think we shouldn't have events *and* hooks for the same thing, so is the proposal to replace the existing hooks with an event and the sole API for finalizing login/logout would be to invoke the respective event?
I think what @longwave meant here was that the methods added here would be a wrapper around the even dispatcher, and the implementation would move into the event - e.g. the logging could then be its own event listener which a site could remove if they wanted to. I haven't thought through the impact of this myself yet.
- ๐บ๐ธUnited States cmlara
Speaking as a voice for contrib that interfaces with authentication.
My reading is that user_login_finalize() is currently public API and that it is intended to be called whenever a module wishes to indicate a user has logged-in and user_logout() is intended to be called whenever we wish to logout a user no matter how they were logged into the system.
Both of these global functions currently perform double duty, where they trigger actions for contrib to act upon and they setup/tear down User module internal information (setting the user in the session).
I recently mistakenly thought user_login_finalize() was only used for session based auth and that all others would provide their own authentication provider event listener, however in TFA we recently encountered a bug (due to our increasing security) that forced me to realize the user_login_finalize() method is called by modules that perform external authentication, ref ๐ 2.x-dev incompatible with social_auth Active .
This raises the question what is the future vision for this new service? Is it intended to only be used by the user module and the rest of us should invoking the hooks ourselves or is it intended to still be called by 3rd party contrib to 'log in' a user?
If its intended to be used by the user module only than I would suggest the deprecation should be changed to indicate these methods have been deprecated with no direct replacment, the user should instead call the necessary hooks/events themselves. The service may not even be necessary if the actions can be done in-line.
If its intended to be used by contrib than I believe we need to either put this on an interface or at a minimal make the class non-final to allow it to be mocked in unit tests. If the class stays final with no interface a helper trait (that provisions it in a dummy mode) for unit tests would be helpful to avoid boilerplate code in contrib. Addtionaly it would likely be helpful if the User module specific items (setting up a session with the UID set) are moved outside of the service and instead done where elsewhere.
From a TFA maintainer standpoint:
Having this as a service that could be decorated would allow a long term cleaner fix to ๐ 2.x-dev incompatible with social_auth Active and allow us to be involved in more locations to provide enhanced security.
Having this as internal we could provide likely provide our own authentication provider and cleanup some of our code. It would probably make intercepting the login form more complicated however I doubt it would be a blockerIn either case I do agree that user_login_finalize() and user_logout() should be be removed from procedural code.
Tagging as related to โจ Facilitate 2FA+MultiFactor compatibility (2FA/two-factor -> MFA/multi-factor) Active as user_login_finalize() and replacements impact the MFA ecosystem
Glad to see there's an issue for this. I was going to open an issue if there wasn't one already.
- Status changed to Needs work
12 months ago 3:09pm 21 March 2024 - ๐บ๐ธUnited States smustgrave
Only moving to NW for the open threads from @catch on the MR.
[144538] was committed, which added a new
UserLogoutConfirm
form callinguser_logout()
.The MR will need to be rebased and then the form will need to be updated to use the new service.
- ๐ฉ๐ชGermany donquixote
Also wondering why login and logout are on the same service - they have quite different dependencies, e.g. loggout out doesn't need the entity storage.
I think I would prefer to see two distinct services.