Securing data communication between microservices
We can also use JWT to implement east-west security for safe collaboration between the match address and send email workers:
Figure 9.4 – Securing east-west access between microservices
This way, we ensure that an authorized co-worker can only call the send email worker. We build on the modifications we made in the previous subsection for controlling access to microservices, so if you still need to make these modifications, you should process them first.
Basically, the JTW-based east-west security is similar to the north-south implementation and takes these steps:
- In the
tasks.py
file, replace thesend_email_task
function with this version:57 ... 58 @shared_task 59 def send_email_task(name, street, email, token): 60 calling_producer = decode_token(token, 'service')['service_producer'...