A
A
Alexander Vladimirovich2018-05-15 15:11:36
symfony
Alexander Vladimirovich, 2018-05-15 15:11:36

Is it possible to implement two independent user entities with authorization and authentication?

Good afternoon.
The system should have two independent non-intersecting user entities, which are even stored in different database tables. Each type has its own login form. You can log on to the system with one or the other type of user at the same time. Two different entity classes. Is it possible to implement this with standard security tools in symfony? If yes, then approximately in which direction to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
voronkovich, 2018-05-15
@polyanin

Yes it is possible. You just need to create one firewall per user entity. See the documentation for how to create a login form: https://symfony.com/doc/current/security/form_logi...

# config/packages/security.yaml
security:
    # ...

    firewalls:
        # Для каждой сущности создать свой файерволл
        user1:
            anonymous: ~
            form_login:
                login_path: login
                check_path: login
        user2:
            anonymous: ~
            form_login:
                login_path: login
                check_path: login

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question