Firewall pattern with Symfony

0 投票
最新提问 用户: (120 分)

I have an API with Oauth2 authentication developed with Symfony framework. I use the security mechanism provided by Symfony and my security.yml is as follows :

        pattern: ^/users
        methods: [POST]
        pattern: ^/
        fos_oauth: true
        stateless: true

As you can see, a new user is registered by the POST request /users. But my problem is that another POST request with URL like /users/xxxx matches the rule too. Is it possible to reject URLs with the same root ? Thanks for help.

发表于 用户: (140 分)
add $ sign at the end, pattern: ^/users$
发表于 用户: (120 分)
It works. Thanks for your help.
发表于 用户: (140 分)
accept my answer please, thank you.


0 投票
最新回答 用户: (140 分)

Please add $ sign at the end, pattern: ^/users$ should work.

欢迎来到 Security Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。