Symfony4 authentication debugging

I am trying to create a traditional registration form and registration form following the symfony 4 documentation .

Using the registration form, I seem to be able to correctly register users in the mariaDB database on arch linux.


I am using symfony development server. When I try to log in with a registered user, I get this HTML code on the login page

The authentication request could not be processed due to a system problem.

If the user or password is bad or I do not fill in the fields, I get the same error.

Starting symphony 4 development with -vvv verboses displays

2018-01-26T16:10:26+00:00 [info] Matched route "login".
2018-01-26T16:10:26+00:00 [info] Authentication request failed.
2018-01-26T16:10:26+00:00 [debug] Authentication failure, redirect triggered.
[Fri Jan 26 17:10:26 2018] 127.0.0.1:52250 [302]: /login
2018-01-26T16:10:26+00:00 [info] Matched route "login".
2018-01-26T16:10:26+00:00 [info] Populated the TokenStorage with an anonymous Token.
[Fri Jan 26 17:10:26 2018] 127.0.0.1:52252 [200]: /login

Firefox , loggin 302. , , .


security.yaml

# config/packages/security.yaml                                                                           
security:                                                                                                 
  encoders:                                                                                               
    App\Entity\User:                                                                                      
      algorithm: bcrypt                                                                                   
  providers:                                                                                              
    our_db_provider:                                                                                      
      entity:                                                                                             
        class: App\Entity\User                                                                            
        property: username                                                                                
  firewalls:                                                                                              
    main:                                                                                                 
      provider: our_db_provider                                                                           
      pattern: ^/                                                                                         
      anonymous: ~                                                                                        
      form_login:                                                                                         
        login_path: login                                                                                 
        check_path: login                                                                                 
  access_control:                                                                                         
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }                                              
    - { path: ^/register$, role: IS_AUTHENTICATED_ANONYMOUSLY }                                           
    - { path: ^/, role: ROLE_USER }                                                                       

, User Register Controller user.getUsername , .

+4
1

:

property: username

security yaml , .

, -, , 302.

+3

Source: https://habr.com/ru/post/1692773/


All Articles