8000 minor #18928 [Security] [Authenticator] Improve the first example (al… · symfony/symfony-docs@f436ae5 · GitHub
[go: up one dir, main page]

Skip to content

Commit f436ae5

Browse files
committed
minor #18928 [Security] [Authenticator] Improve the first example (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] [Authenticator] Improve the first example Fix #15886, part of #15908 Commits ------- bd58134 [Authenticator] Improve the first example
2 parents 86580e7 + bd58134 commit f436ae5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

security/custom_authenticator.rst

Lines changed: 5 additions & 1 deletion
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)
0