我将 FOSRestbundle 与 mopa/wsse-authentication-bundle(WSSE 身份验证)一起使用。
一切正常(身份验证和 RESTful api)。但我想公开 1 个特定路径(无需身份验证)。
我要公开的路径:^/api/users
我尝试了以下设置,但我仍然得到 api/users 路径的 403 Forbidden 状态。(安全.yml)
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
***\UserBundle\Entity\User: plaintext
role_hierarchy:
ROLE_USER: [ROLE_API_USER]
providers:
***_users:
entity: { class: UserBundle:User }
firewalls:
wsse_secured:
pattern: ^/api
anonymous: true
stateless: true
wsse:
nonce_dir: null
lifetime: 300
provider: ***_users
access_control:
- { path: ^/api/users, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/(css|js), roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/(_wdt|_profiler)