What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi everyone, I think I have a pretty simple question, but still we were not able to resolve it with

UP58NR6BS
UP58NR6BS Posts: 19 🧑🏻‍🚀 - Cadet

Hi everyone,
I think I have a pretty simple question, but still we were not able to resolve it with a reasonable amount of investigation:

  • which controller or component handles the /login_check request in Yves?
  • How can I intercept a successful login event in Zed (CustomerFacade->tryAuthorizeCustomerByEmailAndPassword seems not to be called)?

Comments

  • ULL0N440J
    ULL0N440J Posts: 184 🧑🏻‍🚀 - Cadet
    edited December 2019

    Maybe this one is what you're looking for:
    project/src/Pyz/Yves/CustomerPage/Plugin/Provider/CustomerAuthenticationSuccessHandler.php :
    onAuthenticationSuccess(
    Request $request, TokenInterface $token)

  • UP58NR6BS
    UP58NR6BS Posts: 19 🧑🏻‍🚀 - Cadet

    thx for the ultra-quick response - but sadly: no, I cannot use this. I need to send a message to RabbitMQ, but Yves should not have any dependency to RabbitMQ (architecture anti-pattern).

  • ULL0N440J
    ULL0N440J Posts: 184 🧑🏻‍🚀 - Cadet

    You're welcome 🙂 Sorry, I missed the call of the CustomerFacade; can't tell you where the request goes in Zed 🤐 Only used this for logging successful logins.

  • UP58NR6BS
    UP58NR6BS Posts: 19 🧑🏻‍🚀 - Cadet

    as far as I can see it, the only point where Zed is called during Yves Login process is a GET on /customer/gateway/customer

  • Stanislav Matveyev
    Stanislav Matveyev Sprykee Posts: 211 🧑🏻‍🚀 - Cadet
    edited December 2019

    actually

    \Spryker\Client\Customer\CustomerClient::findCustomerWithEmailAndPassword()
    
    also see \Spryker\Client\Customer\CustomerClient::login()
    

    generates zed call to \Spryker\Zed\Customer\Communication\Controller\GatewayController

  • UP58NR6BS
    UP58NR6BS Posts: 19 🧑🏻‍🚀 - Cadet
    edited December 2019

    thanks Stanislav. Already saw that - seems to be unused during Yves login process. Do you see any usage of these methods anywhere? Maybe I missed that!

  • Stanislav Matveyev
    Stanislav Matveyev Sprykee Posts: 211 🧑🏻‍🚀 - Cadet

    \SprykerShop\Yves\CustomerPage\Plugin\Provider\CustomerUserProvider::loadUserByUsername() is used by authenticator,
    then received user
    is checked by \Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider::checkAuthentication() inside \Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider::authenticate()

  • Stanislav Matveyev
    Stanislav Matveyev Sprykee Posts: 211 🧑🏻‍🚀 - Cadet

    so as I see you need to check \Symfony\Component\Security\Core\User\UserProviderInterface and probably implement your provider instead of CustomerUserProvider

  • UP58NR6BS
    UP58NR6BS Posts: 19 🧑🏻‍🚀 - Cadet

    which actually means that the check happens in Symfony called by Yves, and there is no credentials check performed by Zed in this case . Right?

  • Stanislav Matveyev
    Stanislav Matveyev Sprykee Posts: 211 🧑🏻‍🚀 - Cadet

    right, Zed just provides a user by email which contains a password. And Symfony checks if password is correct

  • UP58NR6BS
    UP58NR6BS Posts: 19 🧑🏻‍🚀 - Cadet

    thanks for the confirmation. I‘ll then implement the interceptor for glue and yves separately.