@@ -82,6 +82,10 @@ Each part will be explained in the next section.
82
82
algorithm : plaintext
83
83
ignore_case : false
84
84
85
+ # Argon2i encoder
86
+ Acme\DemoBundle\Entity\User6 :
87
+ algorithm : argon2i
88
+
85
89
providers : # Required
86
90
# Examples:
87
91
my_in_memory_provider :
@@ -611,7 +615,7 @@ persisting the encoded password alone is enough.
611
615
612
616
.. note ::
613
617
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
615
619
allocate enough space for them to be persisted.
616
620
617
621
.. tip ::
@@ -622,6 +626,64 @@ persisting the encoded password alone is enough.
622
626
623
627
.. _reference-security-firewall-context :
624
628
629
+ .. _reference-security-argon2i :
630
+
631
+ Using the Argon2i Password Encoder
632
+ ----------------------------------
633
+
634
+ .. caution ::
635
+
636
+ To use this encoder, you either need to use PHP version 7.2 or install
637
+ the `libsodium `_ extension.
638
+
639
+ .. configuration-block ::
640
+
641
+ .. code-block :: yaml
642
+
643
+ # app/config/security.yml
644
+ security :
645
+ # ...
646
+
647
+ encoders :
648
+ Symfony\Component\Security\Core\User\User :
649
+ algorithm : argon2i
650
+
651
+ .. code-block :: xml
652
+
653
+ <!-- app/config/security.xml -->
654
+ <config >
655
+ <!-- ... -->
656
+ <encoder
657
+ class =" Symfony\Component\Security\Core\User\User"
658
+ algorithm =" argon2i"
659
+ />
660
+ </config >
661
+
662
+ .. code-block :: php
663
+
664
+ // app/config/security.php
665
+ use Symfony\Component\Security\Core\User\User;
666
+
667
+ $container->loadFromExtension('security', array(
668
+ // ...
669
+ 'encoders' => array(
670
+ User::class => array(
671
+ 'algorithm' => 'argon2i',
672
+ ),
673
+ ),
674
+ ));
675
+
676
+ A salt for each new password is generated automatically and need not be
677
+ persisted. Since an encoded password contains the salt used to encode it,
678
+ persisting the encoded password alone is enough.
679
+
680
+ .. note ::
681
+
682
+ Argon2i encoded passwords are ``96 `` characters long, but due to the hashing
683
+ requirements saved in the resulting hash this may change in the future.
684
+
685
+ .. _reference-security-firewall-context :
686
+
625
687
Firewall Context
626
688
----------------
627
689
@@ -749,3 +811,4 @@ To use HTTP-Digest authentication you need to provide a realm and a secret:
749
811
750
812
.. _`PBKDF2` : https://en.wikipedia.org/wiki/PBKDF2
751
813
.. _`ircmaxell/password-compat` : https://packagist.org/packages/ircmaxell/password-compat
814
+ .. _`libsodium` : https://pecl.php.net/package/libsodium
0 commit comments