Scalable Access token based Authentication
Monolithic Applications
For monolithic applications using a simple middleware to check for authentication via correct access token is enough to have our private routes secured
We can use symmetric encryption techniques like AES(advanced encryption standard)
Microservices based Applications
For microservices based applications we can have a separate service for authentication which will use asymmetric encryption algorithm for the encryption
The private key by the the auth service can be used to sign the tokens.
The public key can be used by other services for verifying the user in order to give access to the protected routes.
The public key can be shared by auth service via it’s own API for other services to access it.
The public key can be cached by other services also in order to reduce latency
However asymmetric encryption algorithms like RSA are slow in the relation with that of symmetric encryption algorithms, they provide us a secured system to build a scalable microservice based system.
image credits to Coder’s Gyan on yt
##