gpt4 book ai didi

symfony 需要完全身份验证才能访问此资源

转载 作者:行者123 更新时间:2023-12-02 17:28:27 24 4
gpt4 key购买 nike

我无法从我的 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 }

最佳答案

我认为在您的安全区域防火墙下,您需要指定身份验证类型,例如 http_basic: ~

关于symfony 需要完全身份验证才能访问此资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36656154/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com