Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #51502 [HttpKernel] Add temporary URI signed (BaptisteContreras)
This PR was merged into the 7.1 branch. Discussion ---------- [HttpKernel] Add temporary URI signed | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #51501 | License | MIT | Doc PR | TODO This feature add the possibilty to create a temporary URI signed as mentionned in #51501. Few things about this implementation : - I added an optional parameter to the constructor of the `UriSigner`. I'm not sure if it can be considered as a **BC** ? - The query parameter for expiration (by default "_expiration") is considered as a **reserved parameter** for the signer and if you try to sign an URI with this parameter, the method will throw a LogicalException. In fact, the `check `method will test the presence of the expiration query parameter to determine if it must (or not) verify the expiration. A problem can arise in this case : Lets say you want to sign this URI : "/demo?_expiration=foo" and you don't want a temporary URL. The URI is signed without problem but when you try to call `check`, the method will notice the presence of "_expiration" and try to determine if it has expired, considering the value "foo" as a timestamp. Commits ------- f0c2cfb [HttpFoundation] Add temporary URI signed
- Loading branch information
Showing
5 changed files
with
221 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Symfony/Component/HttpFoundation/Exception/ExceptionInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\HttpFoundation\Exception; | ||
|
||
interface ExceptionInterface extends \Throwable | ||
{ | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Symfony/Component/HttpFoundation/Exception/LogicException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\HttpFoundation\Exception; | ||
|
||
/** | ||
* Base LogicException for Http Foundation component. | ||
*/ | ||
class LogicException extends \LogicException implements ExceptionInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters