Implement custom login logic which requires the access to the password entered by the user

I develop an e-commerce product with multiple layers in it:

  1. I store my users (and other entities like carts, orders, etc) in a specific platform, which not only serves as a repository, but also performs some business logic
  2. I have an abstraction layer of microservices (backend for frontend)on top of that platform. They expose rest api, which will be consumed by the frontend clients
  3. All kinds of frondend apps consuming the rest provided my the BFF layer, described above

The goal is to implement oauth2.0 for frontend clients to access the rest endpoints provided by the microservices. The jwt issued by the keycloak should contain user data to be able to access it in microservices.

Problem #1: The thing is that I cannot simply implement UserLookupService to authenticate my users.
I need to call the login endpoint on the backend platform storing the users (which expects username and password in request body). This endpoint validated the credentials, and performs some business logic in case authentication is successful. How do I get the credentials (including password) entered by the user in Keycloak?

Problem #2: For my ecommerce website I also need to support guest users (for guest carts and orders). I already have backend implementation of it, which creates a guestId, which then should be passed to the login endpoint described above, to assign all the guest cart with the guestId, to the authenticated user. Is there a way I could implement the guest flow with Keycloak?