@@ -82,6 +82,10 @@ Each part will be explained in the next section.
8282 algorithm : plaintext
8383 ignore_case : false
8484
85+ # Argon2i encoder
86+ Acme\DemoBundle\Entity\User6 :
87+ algorithm : argon2i
88+
8589 providers : # Required
8690 # Examples:
8791 my_in_memory_provider :
@@ -611,7 +615,7 @@ persisting the encoded password alone is enough.
611615
612616.. note ::
613617
614- All the encoded passwords are ``60 `` characters long, so make sure to
618+ BCrypt encoded passwords are ``60 `` characters long, so make sure to
615619 allocate enough space for them to be persisted.
616620
617621.. tip ::
@@ -620,7 +624,63 @@ persisting the encoded password alone is enough.
620624 the cost to ``4 ``, which is the minimum value allowed, in the ``test ``
621625 environment configuration.
622626
623- .. _reference-security-firewall-context :
627+ .. _reference-security-argon2i :
628+
629+ Using the Argon2i Password Encoder
630+ ----------------------------------
631+
632+ .. caution ::
633+
634+ To use this encoder, you either need to use PHP version 7.2 or install
635+ the `libsodium `_ extension.
636+
637+ .. configuration-block ::
638+
639+ .. code-block :: yaml
640+
641+ # app/config/security.yml
642+ security :
643+ # ...
644+
645+ encoders :
646+ Symfony\Component\Security\Core\User\User :
647+ algorithm : argon2i
648+
649+ .. code-block :: xml
650+
651+ <!-- app/config/security.xml -->
652+ <config >
653+ <!-- ... -->
654+ <encoder
655+ class =" Symfony\Component\Security\Core\User\User"
656+ algorithm =" argon2i"
657+ />
658+ </config >
659+
660+ .. code-block :: php
661+
662+ // app/config/security.php
663+ use Symfony\Component\Security\Core\User\User;
664+
665+ $container->loadFromExtension('security', array(
666+ // ...
667+ 'encoders' => array(
668+ User::class => array(
669+ 'algorithm' => 'argon2i',
670+ ),
671+ ),
672+ ));
673+
674+ A salt for each new password is generated automatically and need not be
675+ persisted. Since an encoded password contains the salt used to encode it,
676+ persisting the encoded password alone is enough.
677+
678+ .. note ::
679+
680+ Argon2i encoded passwords are ``96 `` characters long, but due to the hashing
681+ requirements saved in the resulting hash this may change in the future.
682+
683+ .. _reference-security-firewall-context :
624684
625685Firewall Context
626686----------------
@@ -749,3 +809,4 @@ To use HTTP-Digest authentication you need to provide a realm and a secret:
749809
750810 .. _`PBKDF2` : https://en.wikipedia.org/wiki/PBKDF2
751811.. _`ircmaxell/password-compat` : https://packagist.org/packages/ircmaxell/password-compat
812+ .. _`libsodium` : https://pecl.php.net/package/libsodium
0 commit comments