diff options
author | Iltar van der Berg <ivanderberg@hostnet.nl> | 2014-09-24 09:31:12 +0200 |
---|---|---|
committer | Iltar van der Berg <ivanderberg@hostnet.nl> | 2014-09-24 09:31:49 +0200 |
commit | d52740c8c0f0a5b98e31b4f759b6681ec364d576 (patch) | |
tree | 9f9c97cb3229b6e5d9ab164c05c21355a7008e9a /Core/Authentication | |
parent | ddbd3ca7801b2e1c5028ab8d36b315ed4fb896f1 (diff) | |
download | symfony-security-d52740c8c0f0a5b98e31b4f759b6681ec364d576.zip symfony-security-d52740c8c0f0a5b98e31b4f759b6681ec364d576.tar.gz symfony-security-d52740c8c0f0a5b98e31b4f759b6681ec364d576.tar.bz2 |
Split of the SecurityContext to AuthorizationChecker and TokenStorage
Diffstat (limited to 'Core/Authentication')
-rw-r--r-- | Core/Authentication/Token/Storage/TokenStorage.php | 43 | ||||
-rw-r--r-- | Core/Authentication/Token/Storage/TokenStorageInterface.php | 36 |
2 files changed, 79 insertions, 0 deletions
diff --git a/Core/Authentication/Token/Storage/TokenStorage.php b/Core/Authentication/Token/Storage/TokenStorage.php new file mode 100644 index 0000000..4b6c11f --- /dev/null +++ b/Core/Authentication/Token/Storage/TokenStorage.php @@ -0,0 +1,43 @@ +<?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\Authentication\Token\Storage; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * TokenStorage contains a TokenInterface + * + * It gives access to the token representing the current user authentication. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Johannes M. Schmitt <schmittjoh@gmail.com> + */ +class TokenStorage implements TokenStorageInterface +{ + private $token; + + /** + * {@inheritdoc} + */ + public function getToken() + { + return $this->token; + } + + /** + * {@inheritdoc} + */ + public function setToken(TokenInterface $token = null) + { + $this->token = $token; + } +} diff --git a/Core/Authentication/Token/Storage/TokenStorageInterface.php b/Core/Authentication/Token/Storage/TokenStorageInterface.php new file mode 100644 index 0000000..218d750 --- /dev/null +++ b/Core/Authentication/Token/Storage/TokenStorageInterface.php @@ -0,0 +1,36 @@ +<?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\Authentication\Token\Storage; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * The TokenStorageInterface. + * + * @author Johannes M. Schmitt <schmittjoh@gmail.com> + */ +interface TokenStorageInterface +{ + /** + * Returns the current security token. + * + * @return TokenInterface|null A TokenInterface instance or null if no authentication information is available + */ + public function getToken(); + + /** + * Sets the authentication token. + * + * @param TokenInterface $token A TokenInterface token, or null if no further authentication information should be stored + */ + public function setToken(TokenInterface $token = null); +} |