Symfony2 and Uploadify : security token is not kept

久未见 提交于 2019-12-10 17:23:36

问题


I'm trying to make Symfony2 and Uploadify working together in a secured area. (Uploadify is a flash/javascript component used to upload multiple files)

My uploadify component is working fine when the back-end script route is out of the secure area, but when in this area, I get a 302 HTTP error.

The log message is :

security.INFO: Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.)  

While searching for an answer, I found that passing the PHPSESSID to the back-end script as a post parameter should work on "non-framework php" but with the Symfony Security Component, it seems that this script is not even reached.

Does anyone know if there is a way to send that token to the back-end script while keeping this script in the secure area ?


回答1:


After having a read around the Symfony website, it's possible that this solution may work (haven't tested it). In your security.yml file, change your access_contol config option to something like this...

access_control:
        - { path: ^/path/to/flash_component, roles: IS_AUTHENTICATED_ANONYMOUSLY }

Where /path/to/flash_component is the URL you are uploading to in Uploadify. Let me know if that works.



来源:https://stackoverflow.com/questions/8078482/symfony2-and-uploadify-security-token-is-not-kept

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!