Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple entity same identity #1158

Open
langziyang opened this issue Sep 21, 2023 · 0 comments
Open

multiple entity same identity #1158

langziyang opened this issue Sep 21, 2023 · 0 comments

Comments

@langziyang
Copy link

symfony 6.3

#config/packages/security.yaml
    providers:
        # used to reload user from session & other features (e.g. switch_user)
        app_employee_provider:
            entity:
                class: App\Entity\Employee
                property: mobile
        # used to reload user from session & other features (e.g. switch_user)
        app_company_provider:
            entity:
                class: App\Entity\Company
                property: societyCode
        chain_provider:
            chain:
                providers: ['app_employee_provider','app_company_provider']
firewalls:
       api:
            pattern: ^/api
            stateless: true
            provider: chain_provider
            jwt: ~
#[Route('/test')]
    public function formRender(EntityManagerInterface $em, JWTTokenManagerInterface $tokenManager,AuthenticationSuccessHandler $authenticationSuccessHandler)
    {
        $user = $em->getRepository(Company::class)->findOneBy(['societyCode'=>123456789]);
        return $authenticationSuccessHandler->handleAuthenticationSuccess($user);
    }

if the employee user mobile is 123456789 too. when i request api router i will get employee user not company user,how to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant