preface
-
SSL/TLS : gRPC integrates SSL/TLS and advocates the use of SSL/TLS to authenticate the server and encrypt all data exchanged between the client and the server. At the same time, the client can optionally provide a certificate for mutual verification -
Token based authentication GRPC provides a mechanism for attaching metadata based credentials to requests and responses This mechanism must be used together with SSL/TLS to provide complete authentication and encrypted communication -
ATLS : Google's own two-way authentication and transmission security system is usually used to build services on Google's platform
Protocol Buffers
What is JWT
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
aaaaaaaaaaaa.bbbbbbbbbbbb.cccccccccccc
What is Dependency Injection {lang="zh CN"}
What is "Dependency Injection" {lang="en"}
Dependency injection in programming is a way to declare the "dependencies" needed or to be used by the code (path operation function in this article) to run.
Then, the system (FastAPI in this article) is responsible for executing any required logic and providing the code with these dependencies ("injection" dependencies).
Dependency injection is commonly used in the following scenarios:
Share business logic (reuse the same code logic) Shared database connection Implement security, authentication, role permissions, etc
The above scenarios can use dependency injection to minimize code duplication.:::
"Dependency Injection" means, in programming, that there is a way for your code (in this case, your path operation functions) to declare things that it requires to work and use: "dependencies".
And then, that system (in this case FastAPI) will take care of doing whatever is needed to provide your code with those needed dependencies ("inject" the dependencies).
This is very useful when you need to:
Have shared logic (the same code logic again and again). Share database connections. Enforce security, authentication, role requirements, etc. And many other things...
All these, while minimizing code repetition. :::