new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

FastAPI · Reference · all subjects

security

11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Security tools import from fastapi.security

The following security tools can be imported from fastapi.security: APIKeyCookie, APIKeyHeader, APIKeyQuery, HTTPAuthorizationCredentials, HTTPBasic, HTTPBasicCredentials, HTTPBearer, HTTPDigest, OAuth2, OAuth2AuthorizationCodeBearer, OAuth2PasswordBearer, OAuth2PasswordRequestForm, OAuth2PasswordRequestFormStrict, OpenIdConnect, and SecurityScopes.

Security() function for OAuth2 scopes dependencies

When you need to declare dependencies with OAuth2 scopes, you use Security(). Security() is similar to Depends() but specifically handles OAuth2 scope declarations.

Security dependables integrate with OpenAPI

Security tools create dependables that integrate into OpenAPI, making them visible in automatic documentation UI and available for automatically generated clients and SDKs.

API Key security schemes available

FastAPI provides three API Key security schemes: APIKeyCookie (for cookie-based API keys), APIKeyHeader (for header-based API keys), and APIKeyQuery (for query parameter-based API keys).

HTTP authentication schemes in FastAPI

FastAPI provides three HTTP authentication schemes: HTTPBasic (for basic authentication), HTTPBearer (for bearer token authentication), and HTTPDigest (for digest authentication).

HTTP credentials classes

FastAPI provides HTTPAuthorizationCredentials for handling bearer and other HTTP authorization credentials, and HTTPBasicCredentials for handling basic authentication credentials.

OAuth2 authentication schemes in FastAPI

FastAPI provides three main OAuth2 schemes: OAuth2 (base OAuth2 scheme), OAuth2AuthorizationCodeBearer (for authorization code flow), and OAuth2PasswordBearer (for password bearer token flow).

OAuth2 password request form classes

FastAPI provides OAuth2PasswordRequestForm for flexible OAuth2 password form requests and OAuth2PasswordRequestFormStrict for stricter OAuth2 password form validation.

SecurityScopes for OAuth2 scope dependencies

SecurityScopes is used to handle OAuth2 security scopes in dependency functions.

OpenID Connect support in FastAPI

FastAPI provides OpenIdConnect for implementing OpenID Connect authentication.

FastAPI supports OAuth2 and JWT

FastAPI includes security and authentication support with OAuth2 with JWT tokens and HTTP Basic auth.

Give your agent this brain