پرش به محتویات

ویوها

تمدید یک نشست، تمام کردنش، و دادن توکن CSRF به فرانت‌اندی روی سایت دیگر.

از خود کد خوانده می‌شود، پس هیچ‌وقت از آن عقب نمی‌ماند. توضیح‌ها مال خود کد هستند، به انگلیسی.

RefreshView

Bases: APIView

A new pair for the refresh token presented, which is blacklisted.

SignOutView

Bases: APIView

The refresh token presented is blacklisted, and both cookies cleared.

CsrfTokenView

Bases: APIView

GET: the CSRF token, for a frontend on another site, which cannot read the API's cookie.

Only needed with CSRF = True. The answer is {"csrf_token": "..."}, and the CSRF cookie it belongs with is set on the same response.

enforce_csrf

enforce_csrf(request: Any) -> None

Refuse request with 403 when the CSRF mode is on and its token is missing or wrong.

presented

presented(request: Request) -> tuple[str, bool]

The refresh token this request presents, and whether it came in the cookie.

readable

readable(raw: str) -> RefreshToken | None

raw as a refresh token still good - not expired, garbled or blacklisted.

blacklist

blacklist(refresh: RefreshToken) -> None

Blacklist refresh - when the project runs the blacklist at all.