summaryrefslogtreecommitdiffstats
path: root/Core/Exception/AuthenticationException.php
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Exception/AuthenticationException.php')
-rw-r--r--Core/Exception/AuthenticationException.php54
1 files changed, 40 insertions, 14 deletions
diff --git a/Core/Exception/AuthenticationException.php b/Core/Exception/AuthenticationException.php
index 074dad0..2b897c2 100644
--- a/Core/Exception/AuthenticationException.php
+++ b/Core/Exception/AuthenticationException.php
@@ -11,36 +11,42 @@
namespace Symfony\Component\Security\Core\Exception;
+use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
+
/**
* AuthenticationException is the base class for all authentication exceptions.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class AuthenticationException extends \RuntimeException implements \Serializable
{
- private $extraInformation;
-
- public function __construct($message, $extraInformation = null, $code = 0, \Exception $previous = null)
- {
- parent::__construct($message, $code, $previous);
+ private $token;
- $this->extraInformation = $extraInformation;
- }
-
- public function getExtraInformation()
+ /**
+ * Get the token.
+ *
+ * @return TokenInterface
+ */
+ public function getToken()
{
- return $this->extraInformation;
+ return $this->token;
}
- public function setExtraInformation($extraInformation)
+ /**
+ * Set the token.
+ *
+ * @param TokenInterface $token
+ */
+ public function setToken(TokenInterface $token)
{
- $this->extraInformation = $extraInformation;
+ $this->token = $token;
}
public function serialize()
{
return serialize(array(
- $this->extraInformation,
+ $this->token,
$this->code,
$this->message,
$this->file,
@@ -51,11 +57,31 @@ class AuthenticationException extends \RuntimeException implements \Serializable
public function unserialize($str)
{
list(
- $this->extraInformation,
+ $this->token,
$this->code,
$this->message,
$this->file,
$this->line
) = unserialize($str);
}
+
+ /**
+ * Message key to be used by the translation component.
+ *
+ * @return string
+ */
+ public function getMessageKey()
+ {
+ return 'An authentication exception occurred.';
+ }
+
+ /**
+ * Message data to be used by the translation component.
+ *
+ * @return array
+ */
+ public function getMessageData()
+ {
+ return array();
+ }
}