Security
FastAPI provides several tools to help you deal with Security easily, rapidly, in a standard way, without having to study and learn all the security specifications.
Introducció
Hash password
Argon2 is a modern, secure password hashing algorithm and winner of the 2015 Password Hashing Competition. It’s memory-hard and resists brute-force, side-channel, and precomputation attacks, making it the top choice for securing passwords in modern systems.
uv add argon2-cffi
=
=
To check whether a user-entered password matches the stored hash:
=
=
Bearer authentication
Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources:
Authorization: Bearer <token>Estàs llegint una vista prèvia.
Inicia sessió amb Google per llegir la pàgina completa. Un compte de Google inclou 5 pàgines gratuïtes en total; l'alumnat i el professorat llegeixen les pàgines del seu curs sense límit.
Inicia sessió