当前位置:Gxlcms > PHP教程 > security配置后,没有进行验证

security配置后,没有进行验证

时间:2021-07-01 10:21:17 帮助过:4人阅读

access_control:
           - { path: ^/site/admin/*, roles: ROLE_ADMIN }

                                    firewalls:
  config.yml               | 17         dev:
  config_dev.yml           | 18             pattern:  ^/(_(profiler|wdt)|css|images|js)/
  config_prod.yml          | 19             security: false
  config_test.yml          | 20 
  parameters.yml           | 21         login:
  parameters.yml.dist      | 22             pattern:  ^/site/admin/login$
  routing.yml              | 23             security: false
  routing_dev.yml          | 24 
  security.yml             | 25         secured_area:
                                        pattern:    ^/site/admin/
                                            form_login:
AppCache.php               | 28                 check_path: _admin_check
AppKernel.php              | 29                 login_path: _admin_login
autoload.php               | 30             logout: 
bootstrap.php.cache        | 31                 path:   _admin_logout
check.php                  | 32                 target: _site                                                                                                      
console*                   | 33             #anonymous: ~                                                                                                          
phpunit.xml.dist           | 34             #http_basic:                                                                                                           
SymfonyRequirements.php    | 35             #    realm: "Secured Demo Area"

我访问http://url/site/admin 没有跳转到指定的login页面....

回复内容:

access_control:
           - { path: ^/site/admin/*, roles: ROLE_ADMIN }

                                    firewalls:
  config.yml               | 17         dev:
  config_dev.yml           | 18             pattern:  ^/(_(profiler|wdt)|css|images|js)/
  config_prod.yml          | 19             security: false
  config_test.yml          | 20 
  parameters.yml           | 21         login:
  parameters.yml.dist      | 22             pattern:  ^/site/admin/login$
  routing.yml              | 23             security: false
  routing_dev.yml          | 24 
  security.yml             | 25         secured_area:
                                        pattern:    ^/site/admin/
                                            form_login:
AppCache.php               | 28                 check_path: _admin_check
AppKernel.php              | 29                 login_path: _admin_login
autoload.php               | 30             logout: 
bootstrap.php.cache        | 31                 path:   _admin_logout
check.php                  | 32                 target: _site                                                                                                      
console*                   | 33             #anonymous: ~                                                                                                          
phpunit.xml.dist           | 34             #http_basic:                                                                                                           
SymfonyRequirements.php    | 35             #    realm: "Secured Demo Area"

我访问http://url/site/admin 没有跳转到指定的login页面....

http://url/site/admin没有被firewall的pattern(^/site/admin/)包含。

人气教程排行