2016-04-15 70 views
-1

我無法從我的symfony項目訪問管理頁面。symfony訪問此資源需要完全身份驗證

如果我訪問XXX.XXX.XXX.XXX/admin我得到:

Full authentication is required to access this resource 

但是要XXX.XXX.XXX.XXX/security/login給我的登錄頁面。

我在做什麼錯?

security: 

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers 
providers: 
    in_memory: 
     memory: 
      users: 
       admin: 
        password: XXX 
        roles: 'ROLE_ADMIN' 

encoders: 
    Symfony\Component\Security\Core\User\User: 
     algorithm: bcrypt 



firewalls: 
    # disables authentication for assets and the profiler, adapt it according to your needs 
    dev: 
     pattern: ^/(_(profiler|wdt)|css|images|js)/ 
     security: false 
    secured_area: 
     pattern: ^/admin 
     anonymous: ~ 
    main: 
     anonymous: ~ 
     # activate different ways to authenticate 

     # http_basic: ~ 
     # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate 

     # form_login: ~ 
     # http://symfony.com/doc/current/cookbook/security/form_login_setup.html 
     form_login: 
      login_path: security_login 
      check_path: security_login 
      csrf_token_generator: security.csrf.token_manager 
      default_target_path: userRedirectAction 
     logout: 
      path: /logout 
      target: /blog 

access_control: 
# require ROLE_ADMIN for /admin* 
    - { path: ^/admin, roles: ROLE_ADMIN } 

回答

3

我覺得你的安全區域下你的防火牆需要指定認證方式,如http_basic: ~

0

安全區域應該是:

secured_area: 
    pattern: ^/blog/admin 

它的工作現在

相關問題