-
-
Notifications
You must be signed in to change notification settings - Fork 144
feat(auth): add various improvements to auth and oauth installer #1921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.x
Are you sure you want to change the base?
Conversation
|
Tests passing, accidentally committed a migration file into |
|
Waiting for @brendt's approval but LGTM! |
|
One thought I have, what about naming the Or using invokable single action controllers, Sorry if this is a bit nitpicky but I assume this will be used pretty widely among (new) tempest users 😅 |
I get where you're coming from, and the best name in that case would be AuthenticationController::class but not SessionController::class. This isn't a session. This is an authentication, which USES a session to work. Also, there's absolutely no reason why you can't just rename the generated class to whatever you want, such as PumpkinController::class if you wish. These are just intended as partial starters as there's no fixed opinionated way of doing it - and both are valid. Happy to make the change to AuthenticationController if there's support for it? |
Yes, ofcourse, my thinking was that the naming should reflect what is considered best practice in tempest as it will become something (I assume) most people will refer to when looking up how to they should structure their controllers etc. Sorry if it came out a bit harsh 🥶
Id argue that it is, you are creating(store) an (Authenticated)Session on login and when you logout you destroy the session. :) |
It wasn't at all!
When you use the logout action provided, It de-authenticates an Authenticatable model. That's stored in a session. Other things can be stored in a session, which would mean the session itself would persist. If there's nothing else in the session, it may also be destroyed too, I honestly haven't looked at the code for Tempest\Http\Session to know that well enough. Sure, destroying the session would destroy the authentication. But it'd also destroy the session and anything else that was stored in it. However someone interacting with your app can have a session without an authentication. See https://tempestphp.com/3.x/essentials/routing#flashing-values for just one example. And authentication requires a session, a session does not require an authentication. This controller is performing authentication actions, with a dependency of a session. It wouldn't work without a session. But it's separate to just a session. Login and Logout are Authentication actions, and thus I can change it to AuthenticationController, as Login is already misleading since there's a logout action in there too. |
|
I actually agree with @NeoIsRecursive here. Laravel names it At the end of the day, the user can make changes themselves (that's why we publish stuff), but providing good practices by default can't hurt! |
Yes, I know, but you should regenerate the session on login and invalidate it on logout so in that sense it works (technically you "crud" an "AuthenticatedSession", not a normal Session so there you are correct I guess). But lets agree to disagree! 😄
Is there anything in the docs for "best practices building with tempest" atm (other than the contributing section)? Or is it up to the example applications to display that? Sorry for out-of-this-pr-scope question 😬 |
|
Okie no worries, I definitely see the logic in avoiding a single function name, it's really not a single function. Updated naming convention to AuthenticateUserController since we're authenticating a user model specifically, and there could be other types of auth like API etc! Tests passing locally, should be ready for approval once more :)
Docs and example apps are what there is at the moment I believe, but hanging out in the discord you can raise discussions on topics or generally chat about that kinda thing if you're not already in there! Invite here if you need it! https://discord.com/invite/pPhpTGUMPQ |
|
Looks like the tests all failed to run likely due to the PHPUnit CVE. Are they something I can re-trigger or does it need more permissions? |
…uding additional stubs (tempestphp#1888)
This was a temporary file generated in local testing, and shouldn't have been committed.
88c92d6 to
ded8eb6
Compare
(Replaces PR 1900 with clean code...)
Closes #1888 various improvements to auth/oauth installers, as follows