Skip to content

Commit bd58134

Browse files
[Authenticator] Improve the first example
1 parent e886b53 commit bd58134

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

security/custom_authenticator.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ method that fits most use-cases::
4949
throw new CustomUserMessageAuthenticationException('No API token provided');
5050
}
5151

52-
return new SelfValidatingPassport(new UserBadge($apiToken));
52+
// implement your own logic to get the user identifier from `$apiToken`
53+
// e.g. by finding one user in database by its API key
54+
$userIdentifier = /** ... */;
55+
56+
return new SelfValidatingPassport(new UserBadge($userIdentifier));
5357
}
5458

5559
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response

0 commit comments

Comments
 (0)