简体   繁体   中英

Symfony2: Securing a route with 2 methods at same time

I have an admin area, that i am protecting with ROLE, in security.yml :

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/addrating, role: IS_AUTHENTICATED_FULLY }
    - { path: ^/admin/, role: ROLE_ADMIN }

I want an extra pasword for all of us admin, that i would communicate over phone...so i thought to use http passwords....can i change my security.yml in a way that is enabled?

If you just want HTTP basic auth as an additional layer, you can just add this in your web server configuration without touching your Symfony security configuration.

For example in Apache, you could add this to /admin in the applicable vhost or a .htaccess file in web/admin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM