@@ -954,6 +954,60 @@ a ``user_checker`` option to define the service used to perform those checks.
954954
955955Learn more about user checkers in :doc: `/security/user_checkers `.
956956
957+ Required Badges
958+ ~~~~~~~~~~~~~~~ 
959+ 
960+ Firewalls can configure a list of required badges that must be present on the authenticated passport:
961+ 
962+ .. configuration-block ::
963+ 
964+  .. code-block :: yaml 
965+ 
966+  #  config/packages/security.yaml 
967+  security : 
968+  #  ... 
969+ 
970+  firewalls : 
971+  main : 
972+  #  ... 
973+  required_badges : ['CsrfTokenBadge', 'My\Badge']  
974+ 
975+ code-block :: xml 
976+ 
977+  <!--  config/packages/security.xml -->  
978+  <?xml  version =" 1.0"  encoding =" UTF-8"  
979+  <srv : container  xmlns =" http://symfony.com/schema/dic/security"  
980+  xmlns : srv =" http://symfony.com/schema/dic/services"  
981+  xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"  
982+  xsi : schemaLocation =" http://symfony.com/schema/dic/services 
983+  https://symfony.com/schema/dic/services/services-1.0.xsd 
984+  http://symfony.com/schema/dic/security 
985+  https://symfony.com/schema/dic/security/security-1.0.xsd"  >
986+ 
987+  <config > 
988+  <firewall  name =" main"  
989+  <!--  ... -->  
990+  <required_badge >CsrfTokenBadge</required_badge > 
991+  <required_badge >My\Badge</required_badge > 
992+  </firewall > 
993+  </config > 
994+  </srv : container > 
995+ 
996+ code-block :: php 
997+ 
998+  // config/packages/security.php 
999+  use Symfony\Config\SecurityConfig; 
1000+ 
1001+  return static function (SecurityConfig $security) { 
1002+  $mainFirewall = $security->firewall('main'); 
1003+  $mainFirewall->requiredBadges(['CsrfTokenBadge', 'My\Badge']); 
1004+  // ... 
1005+  }; 
1006+ 
1007+ versionadded :: 5.3 
1008+ 
1009+  The ``required_badges `` option was introduced in Symfony 5.3.
1010+ 
9571011providers
9581012--------- 
9591013
0 commit comments