symfony-docs icon indicating copy to clipboard operation
symfony-docs copied to clipboard

[Security] add the $token argument to checkPostAuth()

Open xabbuh opened this issue 1 year ago • 1 comments

fixes #20062

xabbuh avatar Jul 25 '24 07:07 xabbuh

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('...');
            }

Timherlaud avatar Jul 25 '24 08:07 Timherlaud

@xabbuh Do you have time to apply suggestions ?

(If not I can take care of this)

alamirault avatar Oct 11 '24 09:10 alamirault

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!

javiereguiluz avatar Oct 16 '24 14:10 javiereguiluz

Thank you Javier!

xabbuh avatar Oct 17 '24 10:10 xabbuh