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 leyendo una vista previa.
Inicia sesión con Google para leer la página completa. Una cuenta de Google incluye 5 páginas gratuitas en total; el alumnado y el profesorado leen las páginas de su curso sin límite.
Iniciar sesión