Skip to content

Commit 52d56f4

Browse files
thtroyerxabbuh
authored andcommitted
Fix Authenticator Class (getCredentials) example
1 parent 54b2054 commit 52d56f4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

security/guard_authentication.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,15 @@ This requires you to implement six methods::
165165
class TokenAuthenticator extends AbstractGuardAuthenticator
166166
{
167167
/**
168-
* Called on every request. Return whatever credentials you want,
169-
* or null to stop authentication.
168+
* Called on every request. Return whatever credentials you want to
169+
* be passed to getUser(). Returning null will cause this authenticator
170+
* to be skipped.
170171
*/
171172
public function getCredentials(Request $request)
172173
{
173174
if (!$token = $request->headers->get('X-AUTH-TOKEN')) {
174-
// no token? Return null and no other methods will be called
175-
return;
175+
// No token?
176+
$token = null;
176177
}
177178

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

0 commit comments

Comments
 (0)