How to put authentication microservice behind Kong gateway

I want to use Kong for an enterprise project and want to use JWT authentication. Could you please let me know if the scenario below is possible in Kong Community or Kong Enterprise?

All the microservices and authentication microservice are behind Kong Proxy.

If any microservice, let’s say “microservice-a” is requested by consumer and that doesn’t contain JWT (instead contains id/password) then JWT authentication would fail. Is there any provision to redirect it to authentication microservice which would authenticate on id/password and on successful authentication generates JWT token by the help of Kong admin API, and then forward to actual requested microservice i.e “microservice-a”.

If any microserice is requested by consumer and that does contain JWT then it would do usual authentication using JWT and forward to actual requested microservice.