8000 Authenticator class example - adjusting solution. · symfony/symfony-docs@a5832a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit a5832a2

Browse files
committed
Authenticator class example - adjusting solution.
1 parent 234d537 commit a5832a2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

security/guard_authentication.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,15 @@ This requires you to implement six methods::
164164
class TokenAuthenticator extends AbstractGuardAuthenticator
165165
{
166166
/**
167-
* Called on every request. Return whatever credentials you want, which
168-
* will be passed to getUser(). Returning null skips all other authentication
169-
* steps. Throwing an AuthenticationException will cause authentication to fail,
170-
* calling onAuthenticationFailure().
167+
* Called on every request. Return whatever credentials you want to
168+
* be passed to getUser(). Returning null will cause authentication
169+
* to be successful, skipping the rest of the authentication process.
171170
*/
172171
public function getCredentials(Request $request)
173172
{
174173
if (!$token = $request->headers->get('X-AUTH-TOKEN')) {
175-
// No token? Cause authentication to fail.
176-
throw new AuthenticationException();
174+
// No token?
175+
$token = null;
177176
}
178177

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

0 commit comments

Comments
 (0)
0