Skip to content

Commit f6eec74

Browse files
committed
Merge pull request symfony#2835 from alcaeus/ticket_8226
[WCM] Fix example code to reflect changes for symfony#8226
2 parents 3d1f59f + 13f57a2 commit f6eec74

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cookbook/security/custom_authentication_provider.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ set an authenticated token in the security context if successful.
144144
// ... you might log something here
145145
146146
// To deny the authentication clear the token. This will redirect to the login page.
147-
// $this->securityContext->setToken(null);
147+
// Make sure to only clear your token, not those of other authentication listeners.
148+
// $token = $this->securityContext->getToken();
149+
// if ($token instanceof WsseUserToken && $this->providerKey === $token->getProviderKey()) {
150+
// $this->securityContext->setToken(null);
151+
// }
148152
// return;
149153
150154
// Deny authentication with a '403 Forbidden' HTTP response

0 commit comments

Comments
 (0)