8000 Authenticator class example - adjusting solution from feedback · symfony/symfony-docs@90de243 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90de243

Browse files
committed
Authenticator class example - adjusting solution from feedback
1 parent df4266e commit 90de243

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

security/guard_authentication.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ This requires you to implement six methods::
171171
public function getCredentials(Request $request)
172172
{
173173
if (!$token = $request->headers->get('X-AUTH-TOKEN')) {
174-
// No token?
175-
$token = '';
174+
// No token?
175+
// Throwing an exception will cause authentication
176+
// to fail and prevent other authenticators from
177+
// attempting to authenticate.
178+
throw new AuthenticationException('No token provided.');
176179
}
177180

178181
// What you return here will be passed to getUser() as $credentials

0 commit comments

Comments
 (0)
0