-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #331 from martijnc/feature/external-redirect-response
Introduce `ExternalRedirectResponse`
- Loading branch information
Showing
4 changed files
with
120 additions
and
0 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
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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Nelmio SecurityBundle. | ||
* | ||
* (c) Nelmio <hello@nelm.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Nelmio\SecurityBundle\ExternalRedirect; | ||
|
||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
|
||
class ExternalRedirectResponse extends RedirectResponse | ||
{ | ||
/** | ||
* @var string[] | ||
*/ | ||
private array $allowedHosts; | ||
|
||
/** | ||
* @param string[] $allowedHosts | ||
* @param string[] $headers | ||
*/ | ||
public function __construct(string $url, array $allowedHosts, int $status = 302, array $headers = []) | ||
{ | ||
$this->allowedHosts = $allowedHosts; | ||
parent::__construct($url, $status, $headers); | ||
} | ||
|
||
/** | ||
* @return string[] | ||
*/ | ||
public function getAllowedHosts(): array | ||
{ | ||
return $this->allowedHosts; | ||
} | ||
} |
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