Skip to content

Commit 35d9c6a

Browse files
committed
[Security] Documented CustomUserMessageAccountStatusException
1 parent 195ff25 commit 35d9c6a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

security/user_checkers.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ User checkers are classes that must implement the
1616
defines two methods called ``checkPreAuth()`` and ``checkPostAuth()`` to
1717
perform checks before and after user authentication. If one or more conditions
1818
are not met, an exception should be thrown which extends the
19+
:class:`Symfony\\Component\\Security\\Core\\Exception\\CustomUserMessageAccountStatusException`,
1920
:class:`Symfony\\Component\\Security\\Core\\Exception\\AccountStatusException`
2021
or :class:`Symfony\\Component\\Security\\Core\\Exception\\AuthenticationException`::
2122

2223
namespace App\Security;
2324

24-
use App\Exception\AccountDeletedException;
2525
use App\Security\User as AppUser;
2626
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
27+
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
2728
use Symfony\Component\Security\Core\User\UserCheckerInterface;
2829
use Symfony\Component\Security\Core\User\UserInterface;
2930

@@ -35,9 +36,8 @@ or :class:`Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExceptio
3536
return;
3637
}
3738

38-
// user is deleted, show a generic Account Not Found message.
3939
if ($user->isDeleted()) {
40-
throw new AccountDeletedException();
40+
throw new CustomUserMessageAccountStatusException('The user account was not found.');
4141
}
4242
}
4343

@@ -54,6 +54,10 @@ or :class:`Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExceptio
5454
}
5555
}
5656

57+
.. versionadded:: 5.1
58+
59+
The ``CustomUserMessageAccountStatusException`` class was introduced in Symfony 5.1.
60+
5761
Enabling the Custom User Checker
5862
--------------------------------
5963

0 commit comments

Comments
 (0)