Skip to content

Conversation

StevenRenaux
Copy link
Collaborator

Q A
Gotenberg API version ? 8.x
Bug fix ? no
New feature ? yes
BC break ? no
Issues Fix #35

@StevenRenaux StevenRenaux self-assigned this Sep 18, 2025
@StevenRenaux StevenRenaux changed the title WIP Forward Authentication Cookie WIP: Forward Authentication Cookie Sep 18, 2025
@StevenRenaux StevenRenaux force-pushed the features/Forward-auth-cookies branch 3 times, most recently from 4f32302 to 5b4542b Compare September 22, 2025 12:27
@StevenRenaux StevenRenaux changed the title WIP: Forward Authentication Cookie Feature: Forward Authentication Cookie Sep 22, 2025
@StevenRenaux StevenRenaux added the enhancement New feature or request label Sep 22, 2025
@StevenRenaux StevenRenaux force-pushed the features/Forward-auth-cookies branch from 5b4542b to d56e194 Compare September 23, 2025 12:55
composer.json Outdated
"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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it should not be required to generate PDFs. What about marking it optional like Twig ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

@StevenRenaux StevenRenaux Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we not save 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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forward cookie from request
2 participants