- Hands-On Docker for Microservices with Python
- Jaime Buelta
- 311字
- 2021-06-24 12:35:49
Understanding the security layer
As the Thoughts Backend is going to be available externally, we need to implement a security layer. That means we need to identify the user producing the actions and verify their validity. For this service example, we will create a new thought from the logged in user, and we will retrieve my thoughts, thoughts created by the currently logged user.
This security layer will come in the shape of a header. This header will contain information that is signed by the user backend, verifying its origin. It will take the form of a JSON Web Token (JWT), https://jwt.io/introduction/, which is a standard for this purpose.
A JWT is not the only possibility for the token, and there are other alternatives such as storing the equivalent data in a session cookie or in more secure environments using similar modules such as PASETO ( https://github.com/paragonie/paseto). Be sure that you review the security implications of your system, which are beyond the scope of this book.
This method should be handled by the Users Backend team, and get packaged so that the other microservices can use it. For this chapter, we will include the code in this microservice, but we'll see later how to create it so it's related to the Users Backend.
If the requests don't have a valid header, the API will return a 401 Unauthorized status code.
With an understanding of how the authentication system is going to work, we can start designing the API interface.
- 物聯(lián)網(wǎng)標(biāo)準(zhǔn)化指南
- Force.com Development Blueprints
- 新一代物聯(lián)網(wǎng)架構(gòu)技術(shù):分層算力網(wǎng)絡(luò)
- SD-WAN架構(gòu)與技術(shù)(第2版)
- Wireshark網(wǎng)絡(luò)分析就這么簡(jiǎn)單
- 計(jì)算機(jī)網(wǎng)絡(luò)原理與應(yīng)用技術(shù)
- Unity Artificial Intelligence Programming
- Echo Quick Start Guide
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)及應(yīng)用
- 高級(jí)網(wǎng)絡(luò)技術(shù)
- 設(shè)備監(jiān)控技術(shù)詳解
- 互聯(lián)網(wǎng)安全的40個(gè)智慧洞見(jiàn)(2016)
- Building RESTful Web Services with .NET Core
- 數(shù)字王國(guó)里的虛擬人:技術(shù)、商業(yè)與法律解讀
- 人際網(wǎng)絡(luò)