Skip to content

Commit 9da82dc

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: [Authenticator] Improve the first example
2 parents 07e39a5 + 53fb35b commit 9da82dc

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 looking up a user in the database using 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)