File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -2810,10 +2810,30 @@ argument of :method:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`::
2810
2810
2811
2811
The feature to add an expiration date for a signed URI was introduced in Symfony 7.1.
2812
2812
2813
+ If you need to know the reason why a signed URI is invalid, you can use the
2814
+ ``verify() `` method which throws exceptions on failure::
2815
+
2816
+ use Symfony\Component\HttpFoundation\Exception\ExpiredSignedUriException;
2817
+ use Symfony\Component\HttpFoundation\Exception\UnsignedUriException;
2818
+ use Symfony\Component\HttpFoundation\Exception\UnverifiedSignedUriException;
2819
+
2820
+ // ...
2821
+
2822
+ try {
2823
+ $uriSigner->verify($uri); // $uri can be a string or Request object
2824
+
2825
+ // the URI is valid
2826
+ } catch (UnsignedUriException) {
2827
+ // the URI isn't signed
2828
+ } catch (UnverifiedSignedUriException) {
2829
+ // the URI is signed but the signature is invalid
2830
+ } catch (ExpiredSignedUriException) {
2831
+ // the URI is signed but expired
2832
+ }
2833
+
2813
2834
.. versionadded :: 7.3
2814
2835
2815
- Starting with Symfony 7.3, signed URI hashes no longer include the ``/ `` or
2816
- ``+ `` characters, as these may cause issues with certain clients.
2836
+ The ``verify() `` method was introduced in Symfony 7.3.
2817
2837
2818
2838
Troubleshooting
2819
2839
---------------
You can’t perform that action at this time.
0 commit comments