-
Notifications
You must be signed in to change notification settings - Fork 9
Symfony 6.0 compatibility #58
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
Comments
Hello Damien, Upgrading the packages for Symfony >= 5.4 has been discussed yesterday and it will come very soon. Regarding the We also did a presentation here : https://github.com/ecphp/session--composition-and-inheritance/ Feel free to let me know if you have any other questions. |
Ok, great about the update. Can't wait to use this library back. 👌🏼 About the final, I can perfectly use a composition (and I will). But, you make me wonder… I feel like my use-case is particularly adapted to inheritance and not composition : once the CAS has validated the user, I would like that my |
Thanks :) However, I'm using Composition over inheritance since years and I never found a use-case where inheritance was a better pattern. If you want to customize the Some code worth ten thousands lines of explanation: // This is the original class
final class CasGuardAuthenticator extends AbstractGuardAuthenticator {
// I omitted the body of it for brevity.
}
// My own custom decorator.
final class MyCustomCasGuardAuthenticator extends AbstractGuardAuthenticator {
private AuthenticatorInterface $authenticator; // This is the decorated service.
public function __construct(AuthenticatorInterface $authenticator) {
$this->authenticator = $authenticator;
}
public function getCredentials(Request $request): ?ResponseInterface {
// Call the original method here:
$response = $this->authenticator->getCredentials($request);
// Then do extra control here:
return $this->checkIfUserHasValidRegistration($response);
}
private function checkIfUserHasValidRegistration(ResponseInterface $response): bool
{
return true; // Implements your custom business logic here.
}
// Implements all the rest of the methods and call the decorated authenticator
// when you do not need to customize anything.
} And don't forget to add this in services:
FQDN\Of\My\Custom\GuardAuthenticator:
decorates: 'cas.guardauthenticator'
arguments: ['@.inner'] |
Okay 😄 I get it. Thanks! The only problem I see (if I understand well) is that for ALL the other methods in the class, I will have to do :
It's a bit tedious 😅 thanks ! |
Yes, that's the price to pay and the only downside of using the decorator pattern. I actually could provide an abstract class which does most of the job, that's an idea I keep in my head for sure for the next iteration release. |
I created a branch that should fix the issue. I'm going to wait for some feedback of yours before merging anything. The PR is sketchy, so it is possible that it might be broken, don't be afraid to report the least thing you see. Tests are currently broken, I will fix them and the documentation in the meantime. |
@damienfa Do you have any feedback to share so far? |
Hello, many thanks for your great efforts! Really appreciate your time and your helpful bundle :) Thank you again! |
Hi @Lubna93 ! I have it working with Symfony 6 on my laptop, but I still need to make some changes before committing everything. I'll update this thread when I'll commit my stuff so you'll get the notification. |
@drupol Thanks a lot for your great efforts! Your hard work to help others is so much appreciated! |
You're very welcome :) |
Description
The Guards have been removed in Symfony 6.0.
The
CasGuardAuthenticator
should be migrated to something like "CasCustomAuthenticator" using the new "custom authenticator".Expected Result
The text was updated successfully, but these errors were encountered: