欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

security 配置后,没有进行验证

程序员文章站 2022-05-15 07:57:06
...
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/)包含。

相关标签: php symfony