Skip to content

Commit 6d6c1b0

Browse files
committed
minor #7215 Updated "Authentication System with Guard" Page (powerdan, Daniel Werner)
This PR was merged into the 2.8 branch. Discussion ---------- Updated "Authentication System with Guard" Page Added the (optional) createAuthenticatedToken() Method and dcoumented it. Also added the braces to the no-argument Method supportsRememberMe. Also removed the `` Operators in the FAQ section because the bacticks seems not to be resolved in a title on symfony.com Commits ------- d17b180 Accepted Suggestions cb3abf3 Accepted suggestions in the guard documentation b2f20f4 Accepted suggestions in the guard documentation 33c0d35 Accepted suggestions in the guard documentation f8e201f Update guard_authentication.rst
2 parents 0eae33b + d17b180 commit 6d6c1b0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

security/guard_authentication.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,18 @@ Each authenticator needs the following methods:
412412
:class:`Symfony\\Component\\HttpFoundation\\Response` object that helps
413413
the user authenticate (e.g. a 401 response that says "token is missing!").
414414

415-
**supportsRememberMe**
415+
**supportsRememberMe()**
416416
If you want to support "remember me" functionality, return true from this method.
417417
You will still need to active ``remember_me`` under your firewall for it to work.
418418
Since this is a stateless API, you do not want to support "remember me"
419419
functionality in this example.
420+
421+
**createAuthenticatedToken(UserInterface $user, string $providerKey)**
422+
If you are implementing the :class:`Symfony\\Component\\Security\\Guard\\GuardAuthenticatorInterface`
423+
instead of extending the :class:`Symfony\\Component\\Security\\Guard\\AbstractGuardAuthenticator`
424+
class, you have to implement this method. It will be called
425+
after a successful authentication to create and return the token
426+
for the user, who was supplied as the first argument.
420427

421428
.. _guard-customize-error:
422429

@@ -552,7 +559,7 @@ Frequently Asked Questions
552559
),
553560
));
554561
555-
**Can I use this with ``form_login``?**
562+
**Can I use this with form_login?**
556563
Yes! ``form_login`` is *one* way to authenticate a user, so you could use
557564
it *and* then add one or more authenticators. Using a guard authenticator doesn't
558565
collide with other ways to authenticate.

0 commit comments

Comments
 (0)