@@ -80,6 +80,10 @@ Each part will be explained in the next section.
80
80
algorithm : plaintext
81
81
ignore_case : false
82
82
83
+ # Argon2i encoder
84
+ Acme\DemoBundle\Entity\User6 :
85
+ algorithm : argon2i
86
+
83
87
providers : # Required
84
88
# Examples:
85
89
my_in_memory_provider :
@@ -609,10 +613,66 @@ persisting the encoded password alone is enough.
609
613
610
614
.. note ::
611
615
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
613
617
allocate enough space for them to be persisted.
614
618
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 :
616
676
617
677
Firewall Context
618
678
----------------
@@ -737,3 +797,4 @@ To use HTTP-Digest authentication you need to provide a realm and a secret:
737
797
738
798
.. _`PBKDF2` : https://en.wikipedia.org/wiki/PBKDF2
739
799
.. _`ircmaxell/password-compat` : https://packagist.org/packages/ircmaxell/password-compat
800
+ .. _`libsodium` : https://pecl.php.net/package/libsodium
0 commit comments