Skip to content

Commit dffddaa

Browse files
committed
minor #10220 [Security] Fix wrong exception used in custom authentication provider example (norkunas)
This PR was submitted for the 4.0 branch but it was merged into the 4.1 branch instead (closes #10220). Discussion ---------- [Security] Fix wrong exception used in custom authentication provider example Closes #10217 <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- c36e7f0 Fix wrong exception used in custom authentication provider example
2 parents 127b35d + c36e7f0 commit dffddaa

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)