summaryrefslogtreecommitdiffstats
path: root/Core/Exception
diff options
context:
space:
mode:
authorAlexander <iam.asm89@gmail.com>2012-07-15 15:16:07 +0200
committerAlexander <iam.asm89@gmail.com>2013-01-07 20:58:57 +0100
commit84296286f4b9cfd4bc1b88c2245d10a0ee32a367 (patch)
tree2a00e491edbe3d689010711a2f328370684b6772 /Core/Exception
parentce45cc1049e24b3400b5f5ba1f40f8ba53866eeb (diff)
downloadsymfony-security-84296286f4b9cfd4bc1b88c2245d10a0ee32a367.zip
symfony-security-84296286f4b9cfd4bc1b88c2245d10a0ee32a367.tar.gz
symfony-security-84296286f4b9cfd4bc1b88c2245d10a0ee32a367.tar.bz2
[Security] Add `getMessageKey` and `getMessageData` to auth exceptions
Diffstat (limited to 'Core/Exception')
-rw-r--r--Core/Exception/AuthenticationCredentialsNotFoundException.php8
-rw-r--r--Core/Exception/AuthenticationException.php20
-rw-r--r--Core/Exception/AuthenticationServiceException.php8
-rw-r--r--Core/Exception/BadCredentialsException.php8
-rw-r--r--Core/Exception/CookieTheftException.php8
-rw-r--r--Core/Exception/InsufficientAuthenticationException.php8
-rw-r--r--Core/Exception/InvalidCsrfTokenException.php8
-rw-r--r--Core/Exception/NonceExpiredException.php8
-rw-r--r--Core/Exception/ProviderNotFoundException.php8
-rw-r--r--Core/Exception/SessionUnavailableException.php8
-rw-r--r--Core/Exception/TokenNotFoundException.php8
-rw-r--r--Core/Exception/UsernameNotFoundException.php8
12 files changed, 106 insertions, 2 deletions
diff --git a/Core/Exception/AuthenticationCredentialsNotFoundException.php b/Core/Exception/AuthenticationCredentialsNotFoundException.php
index 16686ad..1bd8ffd 100644
--- a/Core/Exception/AuthenticationCredentialsNotFoundException.php
+++ b/Core/Exception/AuthenticationCredentialsNotFoundException.php
@@ -16,7 +16,15 @@ namespace Symfony\Component\Security\Core\Exception;
* because no Token is available.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class AuthenticationCredentialsNotFoundException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.authentication_credentials_not_found_exception';
+ }
}
diff --git a/Core/Exception/AuthenticationException.php b/Core/Exception/AuthenticationException.php
index fbe10eb..93e395b 100644
--- a/Core/Exception/AuthenticationException.php
+++ b/Core/Exception/AuthenticationException.php
@@ -52,4 +52,24 @@ class AuthenticationException extends \RuntimeException implements \Serializable
$this->line
) = unserialize($str);
}
+
+ /**
+ * Message key to be used by the translation component.
+ *
+ * @return string
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.authentication_exception';
+ }
+
+ /**
+ * Message data to be used by the translation component.
+ *
+ * @return array
+ */
+ public function getMessageData()
+ {
+ return array();
+ }
}
diff --git a/Core/Exception/AuthenticationServiceException.php b/Core/Exception/AuthenticationServiceException.php
index 5b32d81..b002067 100644
--- a/Core/Exception/AuthenticationServiceException.php
+++ b/Core/Exception/AuthenticationServiceException.php
@@ -15,7 +15,15 @@ namespace Symfony\Component\Security\Core\Exception;
* AuthenticationServiceException is thrown when an authentication request could not be processed due to a system problem.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class AuthenticationServiceException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.authentication_service_exception';
+ }
}
diff --git a/Core/Exception/BadCredentialsException.php b/Core/Exception/BadCredentialsException.php
index 2eae5b8..3ac4800 100644
--- a/Core/Exception/BadCredentialsException.php
+++ b/Core/Exception/BadCredentialsException.php
@@ -15,11 +15,15 @@ namespace Symfony\Component\Security\Core\Exception;
* BadCredentialsException is thrown when the user credentials are invalid.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class BadCredentialsException extends AuthenticationException
{
- public function __construct($message, $code = 0, \Exception $previous = null)
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
{
- parent::__construct($message, null, $code, $previous);
+ return 'security.exception.bad_credentials_exception';
}
}
diff --git a/Core/Exception/CookieTheftException.php b/Core/Exception/CookieTheftException.php
index 2ada78d..badd7b1 100644
--- a/Core/Exception/CookieTheftException.php
+++ b/Core/Exception/CookieTheftException.php
@@ -16,7 +16,15 @@ namespace Symfony\Component\Security\Core\Exception;
* detects that a presented cookie has already been used by someone else.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class CookieTheftException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.cookie_theft_exception';
+ }
}
diff --git a/Core/Exception/InsufficientAuthenticationException.php b/Core/Exception/InsufficientAuthenticationException.php
index bbf5517..d99c03f 100644
--- a/Core/Exception/InsufficientAuthenticationException.php
+++ b/Core/Exception/InsufficientAuthenticationException.php
@@ -17,7 +17,15 @@ namespace Symfony\Component\Security\Core\Exception;
* This is the case when a user is anonymous and the resource to be displayed has an access role.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class InsufficientAuthenticationException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.insufficient_authentication_exception';
+ }
}
diff --git a/Core/Exception/InvalidCsrfTokenException.php b/Core/Exception/InvalidCsrfTokenException.php
index 4181bac..98a64d0 100644
--- a/Core/Exception/InvalidCsrfTokenException.php
+++ b/Core/Exception/InvalidCsrfTokenException.php
@@ -15,7 +15,15 @@ namespace Symfony\Component\Security\Core\Exception;
* This exception is thrown when the csrf token is invalid.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class InvalidCsrfTokenException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.invalid_csrf_token_exception';
+ }
}
diff --git a/Core/Exception/NonceExpiredException.php b/Core/Exception/NonceExpiredException.php
index 6a6a781..0e31713 100644
--- a/Core/Exception/NonceExpiredException.php
+++ b/Core/Exception/NonceExpiredException.php
@@ -18,7 +18,15 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException;
* the digest nonce has expired.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class NonceExpiredException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.nonce_expired_exception';
+ }
}
diff --git a/Core/Exception/ProviderNotFoundException.php b/Core/Exception/ProviderNotFoundException.php
index e11c8aa..aefe2ae 100644
--- a/Core/Exception/ProviderNotFoundException.php
+++ b/Core/Exception/ProviderNotFoundException.php
@@ -16,7 +16,15 @@ namespace Symfony\Component\Security\Core\Exception;
* supports an authentication Token.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class ProviderNotFoundException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.provider_not_found_exception';
+ }
}
diff --git a/Core/Exception/SessionUnavailableException.php b/Core/Exception/SessionUnavailableException.php
index 519164a..ff88c32 100644
--- a/Core/Exception/SessionUnavailableException.php
+++ b/Core/Exception/SessionUnavailableException.php
@@ -21,7 +21,15 @@ namespace Symfony\Component\Security\Core\Exception;
* request.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class SessionUnavailableException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.session_unavailable_exception';
+ }
}
diff --git a/Core/Exception/TokenNotFoundException.php b/Core/Exception/TokenNotFoundException.php
index 593f3ad..da06847 100644
--- a/Core/Exception/TokenNotFoundException.php
+++ b/Core/Exception/TokenNotFoundException.php
@@ -14,7 +14,15 @@ namespace Symfony\Component\Security\Core\Exception;
* TokenNotFoundException is thrown if a Token cannot be found.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class TokenNotFoundException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.token_not_found_exception';
+ }
}
diff --git a/Core/Exception/UsernameNotFoundException.php b/Core/Exception/UsernameNotFoundException.php
index 38533e7..2dc5534 100644
--- a/Core/Exception/UsernameNotFoundException.php
+++ b/Core/Exception/UsernameNotFoundException.php
@@ -15,7 +15,15 @@ namespace Symfony\Component\Security\Core\Exception;
* UsernameNotFoundException is thrown if a User cannot be found by its username.
*
* @author Fabien Potencier <fabien@symfony.com>
+ * @author Alexander <iam.asm89@gmail.com>
*/
class UsernameNotFoundException extends AuthenticationException
{
+ /**
+ * {@inheritDoc}
+ */
+ public function getMessageKey()
+ {
+ return 'security.exception.username_not_found_exception';
+ }
}