All!
I’d like to secure my application with security system together.
Below security.yml file
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/{_locale}/demo/secured/login$
security: false
secured_area:
pattern: ^/{_locale}/demo/secured/
form_login:
check_path: /{_locale}/demo/secured/login_check
login_path: /{_locale}/demo/secured/login
logout:
path: /{_locale}/demo/secured/logout
target: /{_locale}/demo/
The problem:
logout->target return desn’t work.
Could anybody help me ?
PS: Any examples would be appreciated!
Thx
Just make sure you define routes for them all that do use the locale variable and security seems to pick it up automatically. No need to have the locale accounted for in the security config.
Here’s an example from my project.
Excerpt from
security.yml:Excerpt from
routing.yml:The above config works for me. It’s also worth noting that the
_admin_loginand_game_loginroutes are defined in annotations on mySecurityControllerclass.