symfony-security

Authenticate multiple symfony2 firewalls with one login form

我是研究僧i 提交于 2019-11-26 15:58:46
问题 I have two firewalls: api (for API calls) main (for everything else) My client app login happens via the main firewall. However, it does interact with endpoints under the api firewall to fetch data. The problem here is that I don't want to force the user to log in a second time for authenticating against the second firewall. How can I authenticate against both firewalls with just a single login form? 回答1: Perhaps you could try the 'context' firewall property. Say you have a configuration

How to programmatically login/authenticate a user?

痞子三分冷 提交于 2019-11-26 15:06:44
I'd like to log the user in right after the registration process, without passing by the login form. Is this possible ? I've found a solution with FOSUserBundle , but I'm not using it on the project I'm actually working on. Here is my security.yml, I'm working with two firewalls. The plain text encoder is just for testing. security: encoders: Symfony\Component\Security\Core\User\User: plaintext Ray\CentralBundle\Entity\Client: md5 role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: in_memory: users: admin: { password: admin, roles: