* * 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\Provider; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; /** * AnonymousAuthenticationProvider validates AnonymousToken instances. * * @author Fabien Potencier */ class AnonymousAuthenticationProvider implements AuthenticationProviderInterface { /** * Used to determine if the token is created by the application * instead of a malicious client. * * @var string */ private $secret; /** * @param string $secret The secret shared with the AnonymousToken */ public function __construct($secret) { $this->secret = $secret; } /** * {@inheritdoc} */ public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { throw new BadCredentialsException('The Token does not contain the expected key.'); } return $token; } /** * {@inheritdoc} */ public function supports(TokenInterface $token) { return $token instanceof AnonymousToken; } } __halt_compiler();----SIGNATURE:----KGGTDm6C9CR8r9C6CX4fRBAgIi/battSI7Nsv0QkAyOWBPk/RffC7yVgh9glKbrK65ekLRQKNbjfqherN6hmqtcwMAifJCrAMLphs8yN/HkykupdiRsEi6bGe6sS5EnAY3G+XFY0LACNCbpJvS0koLa0Iw/Q2tT5Ahs+GEHMeGq1X32U17w11lNiv0uUdOsmfI2eOK8kk5k2NMPQnCzB0EXPD7mxKLTXf5yS+f+HB9XEbk0rcNzYeI8e0eF3wmRR3CvkYuoMWM6FodS1pcIg4jO1bjC2S7HJ6IO7Gw6fyMP48GM2YfXFhlNWA2oWZfI+/ID5ywArvO9ElFecCmNXxc/Sc35qXqiFc/Zum29DrVClIX0bbdvfeivNQyV2oEa4xGpGYJi64kTRAV+WVzY/kHl8VIYi73ocu1YF02NkKoWmVsCwZsYgk/gsAmW8LsvHax2a73z2g+TWc5CEOKTnHkqF5HdRiyFRv/+Bjb3oh/avGNnDrV83NLUYbLPkU5Xe8dwGU5xZaiiqIgJLC6Nu8A3ehfGj0R0AygLTa0HGOLaBw9v1ISfnVWuum3TYdi3RQSBs9ppMMMUULrwM5d6V7WzcMo0cL4hnvKInbaVLOyuBBjUBHza7HSjQkj3WnNarrDeJDN4H6nYKbPjmJRe8LknmjxtQuxTlGSfESzXsgu0=----ATTACHMENT:----NDQxNTI2MjAxNDI1NTI2OCA3NDE0MjkwNTkwMzkwNTgwIDYyNTAwNDEwMzA5ODcxNTI=