当我转到 project/web/ 时,应用程序将我重定向到 te web/login,其中是用于登录的表单。
但是当我获得授权时,在提交表单后,我回到了项目/web/路径,但访问被拒绝异常。我的设置有什么问题,我无法弄清楚。
路由.yml
my_backend:
resource: "@MyBackendBundle/Controller/"
type: annotation
prefix: /
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
安全.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
login_path: /login
use_forward: false
check_path: /login_check
post_only: true
always_use_default_target_path: false
default_target_path: /
target_path_parameter: _target_path
use_referer: false
failure_path: null
failure_forward: false
username_parameter: _username
password_parameter: _password
csrf_parameter: _csrf_token
intention: authenticate
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, role: ROLE_ADMIN }