feat: Forward Authentication Cookie#187
Conversation
StevenRenaux
commented
Sep 18, 2025
| Q | A |
|---|---|
| Gotenberg API version ? | 8.x |
| Bug fix ? | no |
| New feature ? | yes |
| BC break ? | no |
| Issues | Fix #35 |
4f32302 to
5b4542b
Compare
5b4542b to
d56e194
Compare
| "symfony/http-foundation": "^6.4 || ^7.0", | ||
| "symfony/http-kernel": "^6.4 || ^7.0", | ||
| "symfony/mime": "^6.4 || ^7.0", | ||
| "symfony/security-core": "^6.4 || ^7.0", |
There was a problem hiding this comment.
IMO, it should not be required to generate PDFs. What about marking it optional like Twig ?
There was a problem hiding this comment.
I wanted to to that but because of the typing Userinterface into asUser method (https://github.com/StevenRenaux/GotenbergBundle/blob/features/Forward-auth-cookies/src/Builder/Behaviors/Chromium/CookieTrait.php#L132) I need to get it actually
| return $this; | ||
| } | ||
|
|
||
| $request->getSession()->save(); |
There was a problem hiding this comment.
I'm not sure of the impact of this call. Saving session could lead to unwanted behaviors since it's usually done at the end of the request.
There was a problem hiding this comment.
If we not save and close the session, we have a time out. Because Gotenberg call back our app to generate from a route or template and if the session is locked we have this time out
| throw new \LogicException(\sprintf('UsernamePasswordToken is required to use "%s" method. Try to run "composer require symfony/security-bundle".', __METHOD__)); | ||
| } | ||
|
|
||
| $token = new UsernamePasswordToken($user, $firewallName, $user->getRoles()); |
There was a problem hiding this comment.
We should use an Authenticator since it does additional steps on login (like user checkers).
The SecurityBundle already provides a method for allowing interactive login. If we want to only require the component, not the bundle, we could take a look to AuthenticatorManager::authenticateUser :thinking: