symfony-docs
symfony-docs copied to clipboard
[Security] add the $token argument to checkPostAuth()
fixes #20062
Hello,
You can add the import of TokenInterface
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
I think we can add a notice version :
.. versionadded:: 7.2
The token argument for checkPostAuth function was introduced in Symfony 7.2.
And maybe an example of usage in function :
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
if (!\in_array('foo', $token->getRoleNames())) {
throw new AccessDeniedException('...');
}
@xabbuh Do you have time to apply suggestions ?
(If not I can take care of this)
Thanks Christian!
@Timherlaud while merging I did all the changes that you suggested. Thanks a lot!
Antoine, if you think there's something else that should be documented about this, please create a new PR. Thanks!
Thank you Javier!