I've been working on making an api that accepts api keys and followed the instructions on http://symfony.com/doc/current/cookbook/security/api_key_authentication.html using a database table to hold the api keys. Is there a better way to handle this strictly using silex's firewall settings?
相关问题
- “Zero out” sensitive String data in Swift
- Symfony2 Set Controller in the kernelControllerEve
- Webpack Encore: cannot import local dependencies
- Google places autocomplete suggestion without coun
- High cost encryption but less cost decryption
相关文章
- 我用scrapy写了一个蛮简单的爬虫怎么封装成一个api啊
- 后端给前端的API接口是怎么用代码写的
- Warning : HTML 1300 Navigation occured?
- Convert C# Object to Json Object
- Android camera2 API get focus distance in AF mode
- Symfony : Doctrine data fixture : how to handle la
- Symfony is linked to the wrong PHP version
- Security concerns about CORS
Symfony does not come with an API key authenticator out of the box, but you can create one (not easily, especially for beginers) following the cookbook entry you've posted.
So the short answer to your questions is that no, there is no better way if you want to use the security library. But, there is some on-going work to ease the use and customization of security, you can try to hook this library into Silex and create an api key authenticator.
On the other hand, you can always not use the security component and create your own listener for kernel.request that checks for the credentials using an API token (if credentials are invalid just set a Response in the event):
PS: This is not tested code, and my advice is that you spent a little effor trying to use the security component which, in the long run, will be worth it.