@@ -80,6 +80,10 @@ Each part will be explained in the next section.
8080 algorithm : plaintext
8181 ignore_case : false
8282
83+ # Argon2i encoder
84+ Acme\DemoBundle\Entity\User6 :
85+ algorithm : argon2i
86+
8387 providers : # Required
8488 # Examples:
8589 my_in_memory_provider :
@@ -609,10 +613,66 @@ persisting the encoded password alone is enough.
609613
610614.. note ::
611615
612- All the encoded passwords are ``60 `` characters long, so make sure to
616+ BCrypt encoded passwords are ``60 `` characters long, so make sure to
613617 allocate enough space for them to be persisted.
614618
615- .. _reference-security-firewall-context :
619+ .. _reference-security-argon2i :
620+
621+ Using the Argon2i Password Encoder
622+ ----------------------------------
623+
624+ .. caution ::
625+
626+ To use this encoder, you either need to use PHP version 7.2 or install
627+ the `libsodium `_ extension.
628+
629+ .. configuration-block ::
630+
631+ .. code-block :: yaml
632+
633+ # app/config/security.yml
634+ security :
635+ # ...
636+
637+ encoders :
638+ Symfony\Component\Security\Core\User\User :
639+ algorithm : argon2i
640+
641+ .. code-block :: xml
642+
643+ <!-- app/config/security.xml -->
644+ <config >
645+ <!-- ... -->
646+ <encoder
647+ class =" Symfony\Component\Security\Core\User\User"
648+ algorithm =" argon2i"
649+ />
650+ </config >
651+
652+ .. code-block :: php
653+
654+ // app/config/security.php
655+ use Symfony\Component\Security\Core\User\User;
656+
657+ $container->loadFromExtension('security', array(
658+ // ...
659+ 'encoders' => array(
660+ User::class => array(
661+ 'algorithm' => 'argon2i',
662+ ),
663+ ),
664+ ));
665+
666+ A salt for each new password is generated automatically and need not be
667+ persisted. Since an encoded password contains the salt used to encode it,
668+ persisting the encoded password alone is enough.
669+
670+ .. note ::
671+
672+ Argon2i encoded passwords are ``96 `` characters long, but due to the hashing
673+ requirements saved in the resulting hash this may change in the future.
674+
675+ .. _reference-security-firewall-context :
616676
617677Firewall Context
618678----------------
@@ -737,3 +797,4 @@ To use HTTP-Digest authentication you need to provide a realm and a secret:
737797
738798 .. _`PBKDF2` : https://en.wikipedia.org/wiki/PBKDF2
739799.. _`ircmaxell/password-compat` : https://packagist.org/packages/ircmaxell/password-compat
800+ .. _`libsodium` : https://pecl.php.net/package/libsodium
0 commit comments