I'm designing a microservices-based architecture. The architecture should support multiple devices accessing the API.
In order to secure the internal Resource APIs, I wanted to implement authentication and authorization based on JWTs and Refresh Tokens.
My requirements are:
- Preventing an attacker from using XSS to steal the user's token
- Preventing CSRF attacks
- In-bounds security: even if the attacker can send requests to the internal Resource APIs, he can't do anything without a signed JWT
- Managing users (Authentication and Permissions) via a single internal Users API
- The tokens can be revoked at any time
- Support Multi-Factor Authentication via TOPT
This is what I came with:
Few details:
- The JWTs are really short-lived (30 seconds)
- The Internal API Gateway will include an endpoint (login) for converting username, password, and TOPT passcode to a new refresh token via the Users API.
Will this architecture actually work? will it be secure? Thank you very much!