Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Security][CSRF] Double Submit Cookies CSRF prevention strategy #18333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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.
*/

namespace Symfony\Component\Security\Core\Exception;

/**
* Base UnexpectedValueException for the Security component.
*
* @author Oliver Hoff <oliver@hofff.com>
*/
class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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.
*/

namespace Symfony\Component\Security\Csrf\TokenStorage;

/**
* Forwards calls to another TokenStorageInterface.
*
* @author Oliver Hoff <oliver@hofff.com>
*/
abstract class AbstractTokenStorageProxy implements TokenStorageInterface
{
/**
* {@inheritdoc}
*/
public function getToken($tokenId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it makes sense to mark concrete public methods as final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think final should only be used in very special cases when you absolutely rely on the implemented behavior and to keep the internal state of the class clean and valid, and this cannot be provided by subclasses (e.g. not being able to access private properties). Both is not the case here. Imagine someone wants to create a decorater that fixes the token ID to a certain value, using this class as a parent would not be possible with final methods.

{
return $this->getProxiedTokenStorage()->getToken($tokenId);
}

/**
* {@inheritdoc}
*/
public function setToken($tokenId, $token)
{
// TODO interface declares return void, use return stmt or not?
$this->getProxiedTokenStorage()->setToken($tokenId, $token);
}

/**
* {@inheritdoc}
*/
public function removeToken($tokenId)
{
return $this->getProxiedTokenStorage()->removeToken($tokenId);
}

/**
* {@inheritdoc}
*/
public function hasToken($tokenId)
{
return $this->getProxiedTokenStorage()->hasToken($tokenId);
}

/**
* @return TokenStorageInterface
*/
abstract protected function getProxiedTokenStorage();
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.