{"id":306192,"date":"2020-06-30T15:00:49","date_gmt":"2020-06-30T15:00:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306192"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306192","title":{"rendered":"[Symfony 5] \u0420\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u043e\u0432 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u0432\u0445\u043e\u0434\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508936\/\">\n<h3><b>\u0426\u0435\u043b\u044c<\/b><\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0432 Symfony 5 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u2014 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <u><i>Admin<\/i><\/u>, url \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 <b>\/admin\/login<\/b><\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u2014 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <u><i>User<\/i><\/u>, url \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 <b>\/login<\/b><\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c\u0441\u044f, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a User \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <b>\/admin\/login<\/b><\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 Entities<\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0438 \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 Security<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f User \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u043b\u0438 email\/password, \u0430 \u0434\u043b\u044f Admin \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0434\u043e\u043f. \u0437\u0430\u0449\u0438\u0442\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c Uuid<\/li>\n<\/ul>\n<p>  <\/p>\n<h3><b>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u044d\u0442\u043e\u0442 \u0433\u0430\u0439\u0434?<\/b><\/h3>\n<p>  \u0423 \u043c\u0435\u043d\u044f \u0441\u0442\u043e\u044f\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0432\u0445\u043e\u0434\u0430 \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e User \u043d\u0430 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u2014 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (entity User) \u0438 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 (entity Admin) \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u0438 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 EasyAdmin). <\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u044f \u0440\u0430\u0441\u043f\u0438\u0448\u0443 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3><b>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438<\/b><\/h3>\n<p>  <\/p>\n<ul>\n<li>Windows 10<\/li>\n<li>OpenServer 5.3.7<\/li>\n<li>PHP 7.4<\/li>\n<li>MariaDB-10.2.12<\/li>\n<li>Symfony 5.1<\/li>\n<\/ul>\n<p>  \u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d \u043d\u0430 \u043a\u043e\u043d\u0435\u0446 \u0438\u044e\u043d\u044f 2020 \u0433\u043e\u0434\u0430.<\/p>\n<h3><b>\u0428\u0430\u0433 0 \u2014 \u0441\u0442\u0430\u0432\u0438\u043c Symfony 5<\/b><\/h3>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f Composer \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 OpenServer (&#8230;\/domains).<\/p>\n<pre><code class=\"bash\">composer create-project symfony\/website-skeleton auth_project<\/code><\/pre>\n<h3><b>\u0428\u0430\u0433 1 \u2014 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0431\u0434<\/b><\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0411\u0414, \u043d\u0430\u0437\u043e\u0432\u0451\u043c auth_project, \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 mysql. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 .env<\/p>\n<p>  <b>\u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u0430\u043a:<\/b><\/p>\n<pre><code class=\"bash\"> # In all environments, the following files are loaded if they exist, # the latter taking precedence over the former: # #  * .env                contains default values for the environment variables needed by the app #  * .env.local          uncommitted file with local overrides #  * .env.$APP_ENV       committed environment-specific defaults #  * .env.$APP_ENV.local uncommitted environment-specific overrides # # Real environment variables win over .env files. # # DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. # # Run &quot;composer dump-env prod&quot; to compile .env files for production use (requires symfony\/flex &gt;=1.2). # https:\/\/symfony.com\/doc\/current\/best_practices.html#use-environment-variables-for-infrastructure-configuration  ###&gt; symfony\/framework-bundle ### APP_ENV=dev APP_SECRET=16cbb669c87ff9259c522ee2846cb397 #TRUSTED_PROXIES=127.0.0.0\/8,10.0.0.0\/8,172.16.0.0\/12,192.168.0.0\/16 #TRUSTED_HOSTS='^(localhost|example\\.com)$' ###&lt; symfony\/framework-bundle ###  ###&gt; symfony\/mailer ### # MAILER_DSN=smtp:\/\/localhost ###&lt; symfony\/mailer ###  ###&gt; doctrine\/doctrine-bundle ### # Format described at https:\/\/www.doctrine-project.org\/projects\/doctrine-dbal\/en\/latest\/reference\/configuration.html#connecting-using-a-url # For an SQLite database, use: &quot;sqlite:\/\/\/%kernel.project_dir%\/var\/data.db&quot; # For a PostgreSQL database, use: &quot;postgresql:\/\/db_user:db_password@127.0.0.1:5432\/db_name?serverVersion=11&charset=utf8&quot; # IMPORTANT: You MUST configure your server version, either here or in config\/packages\/doctrine.yaml DATABASE_URL=mysql:\/\/mysql:mysql@127.0.0.1:3306\/auth_project?serverVersion=mariadb-10.2.12 ###&lt; doctrine\/doctrine-bundle ###  <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 2 \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c User<\/b><\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c User, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c email<\/p>\n<pre><code class=\"bash\">php bin\/console make:user<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/85EfLAE.png\" alt=\"image\"\/><\/p>\n<h3><b>\u0428\u0430\u0433 3 \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c Admin<\/b><\/h3>\n<p>  \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0432\u0441\u0451 \u0442\u043e, \u0447\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435, \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 User \u0441\u0442\u0430\u0432\u0438\u043c Admin<\/p>\n<h3><b>\u0428\u0430\u0433 4 \u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c Fixtures<\/b><\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c 2 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430, \u043e\u0434\u0438\u043d \u0434\u043b\u044f User, \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f Admin. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f DoctrineFixturesBundle<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c<\/p>\n<pre><code class=\"bash\">composer require --dev orm-fixtures<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \/src \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u0430 DataFixtures, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0444\u0430\u0439\u043b AppFixtures.php<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0435\u0433\u043e \u0432 UserFixtures.php \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\DataFixtures;  use App\\Entity\\User; use Doctrine\\Bundle\\FixturesBundle\\Fixture; use Doctrine\\ORM\\EntityManagerInterface; use Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;  class UserFixtures extends Fixture {     private $encoder;      private $em;      public function __construct(UserPasswordEncoderInterface $encoder, EntityManagerInterface $entityManager)     {         $this-&gt;encoder = $encoder;         $this-&gt;em = $entityManager;     }      public function load(\\Doctrine\\Persistence\\ObjectManager $manager)     {         $usersData = [               0 =&gt; [                   'email' =&gt; 'user@example.com',                   'role' =&gt; ['ROLE_USER'],                   'password' =&gt; 123654               ]         ];          foreach ($usersData as $user) {             $newUser = new User();             $newUser-&gt;setEmail($user['email']);             $newUser-&gt;setPassword($this-&gt;encoder-&gt;encodePassword($newUser, $user['password']));             $newUser-&gt;setRoles($user['role']);             $this-&gt;em-&gt;persist($newUser);         }          $this-&gt;em-&gt;flush();     } } <\/code><\/pre>\n<p>  <b>\u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0430 \u2014 \u0441\u043e\u0437\u0434\u0430\u0451\u043c AdminFixtures.php<\/b><\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\DataFixtures;  use App\\Entity\\Admin; use Doctrine\\Bundle\\FixturesBundle\\Fixture; use Doctrine\\ORM\\EntityManagerInterface; use Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;  class AdminFixtures extends Fixture {     private $encoder;      private $em;      public function __construct(UserPasswordEncoderInterface $encoder, EntityManagerInterface $entityManager)     {         $this-&gt;encoder = $encoder;         $this-&gt;em = $entityManager;     }      public function load(\\Doctrine\\Persistence\\ObjectManager $manager)     {         $adminsData = [               0 =&gt; [                   'email' =&gt; 'admin@example.com',                   'role' =&gt; ['ROLE_ADMIN'],                   'password' =&gt; 123654               ]         ];          foreach ($adminsData as $admin) {             $newAdmin = new Admin();             $newAdmin-&gt;setEmail($admin['email']);             $newAdmin-&gt;setPassword($this-&gt;encoder-&gt;encodePassword($newAdmin, $admin['password']));             $newAdmin-&gt;setRoles($admin['role']);             $this-&gt;em-&gt;persist($newAdmin);         }          $this-&gt;em-&gt;flush();     } } <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 5 \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 fixtures \u0432 \u0431\u0434<\/b><\/h3>\n<p>  \u0421\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b, fixtures \u043c\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b\u0438, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u044d\u0442\u043e \u0437\u0430\u043b\u0438\u0442\u044c \u0432 \u0431\u0434, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u044f \u043f\u0440\u043e\u0432\u043e\u0436\u0443 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438\u043b\u0438 fixtures<\/p>\n<pre><code class=\"bash\"> php bin\/console doctrine:schema:drop --full-database --force # \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0431\u0430\u0437\u0443, \u0443\u0434\u0430\u043b\u0438\u0432 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b  php bin\/console doctrine:migrations:diff # \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e. \u041f\u0415\u0420\u0415\u0414 \u042d\u0422\u0418\u041c \u041d\u0423\u0416\u041d\u041e \u0423\u0414\u0410\u041b\u0418\u0422\u042c \u0412\u0421\u0415 \u0421\u0422\u0410\u0420\u042b\u0415 \u041c\u0418\u0413\u0420\u0410\u0426\u0418\u0418!  php bin\/console doctrine:migrations:migrate # \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0432 \u0431\u0430\u0437\u0443 php bin\/console doctrine:fixtures:load # \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0444\u0435\u0439\u043a\u043e\u0432\u044b\u0435 \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 6 \u2014 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e<\/b><\/h3>\n<p>  \u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c<\/p>\n<pre><code class=\"bash\">php bin\/console make:auth<\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0438\u0435:<\/p>\n<pre><code class=\"bash\"> # php bin\/console make:auth   What style of authentication do you want? [Empty authenticator]:   [0] Empty authenticator   [1] Login form authenticator  &gt; 1   The class name of the authenticator to create (e.g. AppCustomAuthenticator):  &gt; UserAuthenticator   Choose a name for the controller class (e.g. SecurityController) [SecurityController]:  &gt; UserAuthSecurityController   Do you want to generate a '\/logout' URL? (yes\/no) [yes]:  &gt;   created: src\/Security\/UserAuthenticator.php  updated: config\/packages\/security.yaml  created: src\/Controller\/UserAuthSecurityController.php  created: templates\/security\/login.html.twig    Success!   Next:  - Customize your new authenticator.  - Finish the redirect &quot;TODO&quot; in the App\\Security\\UserAuthenticator::onAuthenticationSuccess() method.  - Review & adapt the login template: templates\/security\/login.html.twig. <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043d\u0430\u0441 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f security.yaml \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0443\u0442\u0441\u044f 3 \u0444\u0430\u0439\u043b\u0430<\/p>\n<h3><b>\u0428\u0430\u0433 7 \u2014 \u043f\u0440\u0430\u0432\u0438\u043c security.yaml<\/b><\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 security.yaml \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\"> security:     encoders:         App\\Entity\\User:             algorithm: auto         App\\Entity\\Admin:             algorithm: auto       # https:\/\/symfony.com\/doc\/current\/security.html#where-do-users-come-from-user-providers     providers:         # used to reload user from session & other features (e.g. switch_user)         app_user_provider:             entity:                 class: App\\Entity\\Admin                 property: email         # used to reload user from session & other features (e.g. switch_user)     firewalls:         dev:             pattern: ^\/(_(profiler|wdt)|css|images|js)\/             security: false         main:             anonymous: true             lazy: true             provider: app_user_provider             guard:                 authenticators:                     - App\\Security\\UserAuthenticator             logout:                 path: app_logout                 # where to redirect after logout                 # target: app_any_route              # activate different ways to authenticate             # https:\/\/symfony.com\/doc\/current\/security.html#firewalls-authentication              # https:\/\/symfony.com\/doc\/current\/security\/impersonating_user.html             # switch_user: true      # Easy way to control access for large sections of your site     # Note: Only the *first* access control that matches will be used     access_control:         # - { path: ^\/admin, roles: ROLE_ADMIN }         # - { path: ^\/profile, roles: ROLE_USER }  <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 provider <b>admin_user_provider<\/b> \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0443 <b>firewalls<\/b>.<\/p>\n<p>  <b>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u043e<\/b>, \u0444\u0430\u0439\u043b security.yaml \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\"> security:     encoders:         App\\Entity\\User:             algorithm: auto         App\\Entity\\Admin:             algorithm: auto       # https:\/\/symfony.com\/doc\/current\/security.html#where-do-users-come-from-user-providers     providers:         # used to reload user from session & other features (e.g. switch_user)         app_user_provider:             entity:                 class: App\\Entity\\User                 property: email         app_admin_provider:             entity:                 class: App\\Entity\\Admin                 property: email         # used to reload user from session & other features (e.g. switch_user)     firewalls:         dev:             pattern: ^\/(_(profiler|wdt)|css|images|js)\/             security: false          admin_secured_area:             pattern:   ^\/admin             anonymous: ~             provider: app_admin_provider             form_login:                 login_path: \/admin\/login                 check_path: \/admin\/login_check                 default_target_path: \/admin\/login                 username_parameter: email                 password_parameter: password             guard:                 authenticators:                     - App\\Security\\AdminAuthenticator             logout:                 path: app_logout                 # where to redirect after logout                 target: \/admin\/login          user_secured_area:             pattern:   ^\/             anonymous: ~             provider: app_user_provider             form_login:                 login_path: \/login                 check_path: \/login_check                 default_target_path: \/login                 username_parameter: email                 password_parameter: password             logout:                 path: app_logout                 # where to redirect after logout                 target: \/login                      # Easy way to control access for large sections of your site     # Note: Only the *first* access control that matches will be used     access_control:         # - { path: ^\/admin, roles: ROLE_ADMIN }         # - { path: ^\/profile, roles: ROLE_USER }  <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 8 \u2014 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d login.html.twig<\/b><\/h3>\n<p>  \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 make:auth.<br \/>  \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b.<\/p>\n<h3><b>\u0428\u0430\u0433 9 \u2014 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c UserAuthSecurityController<\/b><\/h3>\n<p>  \u0424\u0430\u0439\u043b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0443\u0442\u0438 App\\Controller, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<p>  \u041a\u0430\u043a\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<pre><code class=\"php\"> &lt;?php  namespace App\\Controller;  use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController; use Symfony\\Component\\HttpFoundation\\Response; use Symfony\\Component\\Routing\\Annotation\\Route; use Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationUtils;  class UserAuthSecurityController extends AbstractController {     \/**      * @Route(&quot;\/login&quot;, name=&quot;app_login&quot;)      *\/     public function login(AuthenticationUtils $authenticationUtils): Response     {         \/\/ if ($this-&gt;getUser()) {         \/\/     return $this-&gt;redirectToRoute('target_path');         \/\/ }          \/\/ get the login error if there is one         $error = $authenticationUtils-&gt;getLastAuthenticationError();         \/\/ last username entered by the user         $lastUsername = $authenticationUtils-&gt;getLastUsername();          return $this-&gt;render('security\/user-login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);     }      \/**      * @Route(&quot;\/logout&quot;, name=&quot;app_logout&quot;)      *\/     public function logout()     {         throw new \\LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');     } } <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 10 \u2014 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e<\/b><\/h3>\n<p>  \u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c:<\/p>\n<pre><code class=\"bash\"> php bin\/console make:auth <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 <b>app_admin_provider <\/b> \u2014 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0430\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 firewall \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c: <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/6lS0EZq.png\" alt=\"image\"\/><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 firewall \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0430\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u0442\u044c Entity, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \\App\\Entity\\Admin:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/hc96sQF.png\" alt=\"image\"\/><\/p>\n<h3><b>\u0428\u0430\u0433 11 \u2014 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 login.html.twig<\/b><\/h3>\n<p>  \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 login.html.twig \u043d\u0430 admin-login.html.twig<\/p>\n<h3><b>\u0428\u0430\u0433 12 \u2014 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 AdminAuthController<\/b><\/h3>\n<p>  \u041c\u0435\u043d\u044f\u0435\u043c route \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<pre><code class=\"php\"> &lt;?php  namespace App\\Controller;  use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController; use Symfony\\Component\\HttpFoundation\\Response; use Symfony\\Component\\Routing\\Annotation\\Route; use Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationUtils;  class AdminAuthController extends AbstractController {     \/**      * @Route(&quot;\/admin\/login&quot;, name=&quot;app_admin_login&quot;)      *\/     public function adminLogin(AuthenticationUtils $authenticationUtils): Response     {         \/\/ if ($this-&gt;getUser()) {         \/\/     return $this-&gt;redirectToRoute('target_path');         \/\/ }          \/\/ get the login error if there is one         $error = $authenticationUtils-&gt;getLastAuthenticationError();         \/\/ last username entered by the user         $lastUsername = $authenticationUtils-&gt;getLastUsername();          return $this-&gt;render('security\/admin-login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);     }      \/**      * @Route(&quot;\/logout&quot;, name=&quot;app_logout&quot;)      *\/     public function logout()     {        throw new \\LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');     } } <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 13 \u2014 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b config\/routes.yaml<\/b><\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c login_check \u0438 admin_login_check, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 firewall \u0432 \u0444\u0430\u0439\u043b\u0435 config\/packages\/security.yaml<\/p>\n<p>  \u041a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0444\u0430\u0439\u043b config\/routes.yaml:<\/p>\n<pre><code class=\"bash\"> #index: #    path: \/ #    controller: App\\Controller\\DefaultController::index login_check:   path: \/login_check admin_login_check:   path: \/admin\/login_check  <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 14 \u2014 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b templates\/secutiry\/user-login.html.twig<\/b><\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0442\u0435\u0433  \u0430\u0442\u0440\u0438\u0431\u0443\u0442 action:<\/p>\n<pre><code class=\"xml\">{% extends 'base.html.twig' %}  {% block title %}Log in!{% endblock %}  {% block body %} &lt;form action=&quot;{{ path('login_check') }}&quot; method=&quot;post&quot;&gt;     {% if error %}         &lt;div class=&quot;alert alert-danger&quot;&gt;{{ error.messageKey|trans(error.messageData, 'security') }}&lt;\/div&gt;     {% endif %}      {% if app.user %}         &lt;div class=&quot;mb-3&quot;&gt;             You are logged in as {{ app.user.username }}, &lt;a href=&quot;{{ path('app_logout') }}&quot;&gt;Logout&lt;\/a&gt;         &lt;\/div&gt;     {% endif %}      &lt;h1 class=&quot;h3 mb-3 font-weight-normal&quot;&gt;Please sign in&lt;\/h1&gt;     &lt;label for=&quot;inputEmail&quot;&gt;Email&lt;\/label&gt;     &lt;input type=&quot;email&quot; value=&quot;{{ last_username }}&quot; name=&quot;email&quot; id=&quot;inputEmail&quot; class=&quot;form-control&quot; required autofocus&gt;     &lt;label for=&quot;inputPassword&quot;&gt;Password&lt;\/label&gt;     &lt;input type=&quot;password&quot; name=&quot;password&quot; id=&quot;inputPassword&quot; class=&quot;form-control&quot; required&gt;      &lt;input type=&quot;hidden&quot; name=&quot;_csrf_token&quot;            value=&quot;{{ csrf_token('authenticate') }}&quot;     &gt;      {#         Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.         See https:\/\/symfony.com\/doc\/current\/security\/remember_me.html          &lt;div class=&quot;checkbox mb-3&quot;&gt;             &lt;label&gt;                 &lt;input type=&quot;checkbox&quot; name=&quot;_remember_me&quot;&gt; Remember me             &lt;\/label&gt;         &lt;\/div&gt;     #}      &lt;button class=&quot;btn btn-lg btn-primary&quot; type=&quot;submit&quot;&gt;         Sign in     &lt;\/button&gt; &lt;\/form&gt; {% endblock %}  <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 15 \u2014 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b templates\/secutiry\/admin-login.html.twig<\/b><\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0442\u0435\u0433  \u0430\u0442\u0440\u0438\u0431\u0443\u0442 action:<\/p>\n<pre><code class=\"xml\">{% extends 'base.html.twig' %}  {% block title %}Log in!{% endblock %}  {% block body %} &lt;form action=&quot;{{ path('admin_login_check') }}&quot; method=&quot;post&quot;&gt;     {% if error %}         &lt;div class=&quot;alert alert-danger&quot;&gt;{{ error.messageKey|trans(error.messageData, 'security') }}&lt;\/div&gt;     {% endif %}      {% if app.user %}         &lt;div class=&quot;mb-3&quot;&gt;             You are logged in as {{ app.user.username }}, &lt;a href=&quot;{{ path('app_logout') }}&quot;&gt;Logout&lt;\/a&gt;         &lt;\/div&gt;     {% endif %}      &lt;h1 class=&quot;h3 mb-3 font-weight-normal&quot;&gt;Please sign in&lt;\/h1&gt;     &lt;label for=&quot;inputEmail&quot;&gt;Email&lt;\/label&gt;     &lt;input type=&quot;email&quot; value=&quot;{{ last_username }}&quot; name=&quot;email&quot; id=&quot;inputEmail&quot; class=&quot;form-control&quot; required autofocus&gt;     &lt;label for=&quot;inputPassword&quot;&gt;Password&lt;\/label&gt;     &lt;input type=&quot;password&quot; name=&quot;password&quot; id=&quot;inputPassword&quot; class=&quot;form-control&quot; required&gt;      &lt;input type=&quot;hidden&quot; name=&quot;_csrf_token&quot;            value=&quot;{{ csrf_token('authenticate') }}&quot;     &gt;      {#         Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.         See https:\/\/symfony.com\/doc\/current\/security\/remember_me.html          &lt;div class=&quot;checkbox mb-3&quot;&gt;             &lt;label&gt;                 &lt;input type=&quot;checkbox&quot; name=&quot;_remember_me&quot;&gt; Remember me             &lt;\/label&gt;         &lt;\/div&gt;     #}      &lt;button class=&quot;btn btn-lg btn-primary&quot; type=&quot;submit&quot;&gt;         Sign in     &lt;\/button&gt; &lt;\/form&gt; {% endblock %}  <\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 16 \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0430\u0439\u0442<\/b><\/h3>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0430\u0439\u0442\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0430\u0432\u0438\u043c web-server-bundle:<\/p>\n<pre><code class=\"bash\">composer require symfony\/web-server-bundle --dev ^4.4.2<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0430\u0439\u0442:<\/p>\n<pre><code class=\"bash\">php bin\/console server:run<\/code><\/pre>\n<p>  <\/p>\n<h3><b>\u0428\u0430\u0433 17 \u2014 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f User<\/b><\/h3>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <a href=\"http:\/\/127.0.0.1\">127.0.0.1<\/a>:8000\/login<\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c \u044d\u0442\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/yCrnQmU.png\" alt=\"image\"\/><\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u043c\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f email user@example.com \u0438 \u043f\u0430\u0440\u043e\u043b\u044c 123654.<\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/RSZPiLr.png\" alt=\"image\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u044b\u0431\u044c\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 Invalid credentials.<\/p>\n<h3><b>\u0428\u0430\u0433 18 \u2014 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f Admin<\/b><\/h3>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <a href=\"http:\/\/127.0.0.1\">127.0.0.1<\/a>:8000\/admin\/login<\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c \u044d\u0442\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/LhPeMy4.png\" alt=\"image\"\/><\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u043c\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f email admin@example.com \u0438 \u043f\u0430\u0440\u043e\u043b\u044c 123654.<\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c\u043e, \u0447\u0442\u043e \u0432\u0441\u0451 \u0443\u0441\u043f\u0435\u0448\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/i.imgur.com\/PULrt5w.png\" alt=\"image\"\/><\/p>\n<p>  \u041f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0432\u0435\u0434\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 User \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \/admin\/login \u2014 \u0432\u044b\u043b\u0435\u0442\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u0447\u0442\u043e Invalid credentials. \u0414\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \/login \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u2014 \u0432\u0432\u0435\u0434\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 Admin \u2014 \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<h3><b>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/b><\/h3>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0430\u0439\u0434, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0433 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435.<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0433\u0430\u0439\u0434\u0430\u0445 \u0438\u043b\u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f\u0445, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436\u0435 \u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/508936\/\"> https:\/\/habr.com\/ru\/post\/508936\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508936\/\">\n<h3><b>\u0426\u0435\u043b\u044c<\/b><\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0432 Symfony 5 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u2014 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <u><i>Admin<\/i><\/u>, url \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 <b>\/admin\/login<\/b><\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u2014 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c <u><i>User<\/i><\/u>, url \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 <b>\/login<\/b><\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c\u0441\u044f, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a User \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <b>\/admin\/login<\/b><\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 Entities<\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0438 \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 Security<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f User \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u043b\u0438 email\/password, \u0430 \u0434\u043b\u044f Admin \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0434\u043e\u043f. \u0437\u0430\u0449\u0438\u0442\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c Uuid<\/li>\n<\/ul>\n<p>  <\/p>\n<h3><b>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u044d\u0442\u043e\u0442 \u0433\u0430\u0439\u0434?<\/b><\/h3>\n<p>  \u0423 \u043c\u0435\u043d\u044f \u0441\u0442\u043e\u044f\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0432\u0445\u043e\u0434\u0430 \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e User \u043d\u0430 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u2014 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (entity User) \u0438 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 (entity Admin) \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u0438 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 EasyAdmin). <\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u044f \u0440\u0430\u0441\u043f\u0438\u0448\u0443 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-306192","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306192"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306192\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}