8000 Fix wrong exception used in custom authentication provider example · symfony/symfony-docs@c36e7f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit c36e7f0

Browse files
norkunasxabbuh
authored andcommitted
Fix wrong exception used in custom authentication provider example
1 parent 127b35d commit c36e7f0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

security/custom_authentication_provider.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ the ``PasswordDigest`` header value matches with the user's password::
206206
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
207207
use Symfony\Component\Security\Core\User\UserProviderInterface;
208208
use Symfony\Component\Security\Core\Exception\AuthenticationException;
209-
use Symfony\Component\Security\Core\Exception\NonceExpiredException;
210209
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
211210
use App\Security\Authentication\Token\WsseUserToken;
212211

@@ -259,7 +258,9 @@ the ``PasswordDigest`` header value matches with the user's password::
259258
// Validate that the nonce is *not* in cache
260259
// if it is, this could be a replay attack
261260
if ($cacheItem->isHit()) {
262-
throw new NonceExpiredException('Previously used nonce detected');
261+
// In a real world application you should throw a custom
262+
// exception extending the AuthenticationException
263+
throw new AuthenticationException('Previously used nonce detected');
263264
}
264265

265266
// Store the item in cache for 5 minutes

0 commit comments

Comments
 (0)
0