- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 31 for get_current_active_user (0.25 seconds)
-
docs/ja/docs/tutorial/security/simple-oauth2.md
それ以外は **FastAPI** が面倒を見てくれます。 /// ## 依存関係の更新 { #update-the-dependencies } ここで依存関係を更新します。 アクティブなユーザーの場合にのみ `current_user` を取得したいとします。 そこで、`get_current_active_user` を依存関係として利用する追加の依存関係 `get_current_active_user` を作成します。 これら2つの依存関係は、ユーザーが存在しない、または非アクティブである場合に、HTTPエラーを返すだけです。 したがって、エンドポイントでは、ユーザーが存在し、正しく認証され、かつアクティブである場合にのみ、ユーザーを取得します:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 12.1K bytes - Click Count (0) -
docs/en/docs/tutorial/security/simple-oauth2.md
## Update the dependencies { #update-the-dependencies } Now we are going to update our dependencies. We want to get the `current_user` *only* if this user is active. So, we create an additional dependency `get_current_active_user` that in turn uses `get_current_user` as a dependency. Both of these dependencies will just return an HTTP error if the user doesn't exist, or if is inactive.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 9.4K bytes - Click Count (0) -
docs/zh/docs/tutorial/security/simple-oauth2.md
这几乎是唯一需要开发者牢记在心,并按规范要求正确执行的事。 **FastAPI** 则负责处理其它的工作。 /// ## 更新依赖项 { #update-the-dependencies } 接下来,更新依赖项。 使之仅在当前用户为激活状态时,才能获取 `current_user`。 为此,要再创建一个依赖项 `get_current_active_user`,此依赖项以 `get_current_user` 依赖项为基础。 如果用户不存在,或状态为未激活,这两个依赖项都会返回 HTTP 错误。 因此,在端点中,只有当用户存在、通过身份验证、且状态为激活时,才能获得该用户: {* ../../docs_src/security/tutorial003_an_py310.py hl[58:66,69:74,94] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 9K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/security/simple-oauth2.md
這幾乎是你為了符合規範而必須自行記得正確處理的唯一事情。 其餘的 **FastAPI** 都會幫你處理。 /// ## 更新依賴項 { #update-the-dependencies } 接著我們要更新依賴項。 我們只想在使用者為啟用狀態時取得 `current_user`。 所以,我們新增一個依賴 `get_current_active_user`,而它本身又依賴 `get_current_user`。 這兩個依賴會在使用者不存在或未啟用時回傳 HTTP 錯誤。 因此,在端點中,只有在使用者存在、已正確驗證且為啟用狀態時,我們才會取得使用者: {* ../../docs_src/security/tutorial003_an_py310.py hl[58:66,69:74,94] *} /// infoCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 9.1K bytes - Click Count (0) -
docs/tr/docs/advanced/security/oauth2-scopes.md
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 07:53:17 GMT 2026 - 14.7K bytes - Click Count (0) -
docs/ru/docs/advanced/security/oauth2-scopes.md
В этом случае мы передаём функцию‑зависимость `get_current_active_user` в `Security` (точно так же, как сделали бы с `Depends`). Но мы также передаём `list` scopes — в данном случае только один scope: `items` (их могло быть больше).
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 17:56:20 GMT 2026 - 20.6K bytes - Click Count (0) -
docs/uk/docs/advanced/security/oauth2-scopes.md
У цьому випадку ми передаємо функцію-залежність `get_current_active_user` до `Security` (так само, як зробили б із `Depends`). А також передаємо `list` scopes, у цьому випадку лише один scope: `items` (їх могло б бути більше).
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:27:41 GMT 2026 - 20.2K bytes - Click Count (0) -
docs/pt/docs/advanced/security/oauth2-scopes.md
Neste caso, nós passamos a função `get_current_active_user` como dependência para `Security` (da mesma forma que nós faríamos com `Depends`). Mas nós também passamos uma `list` de escopos, neste caso com apenas um escopo: `items` (poderia ter mais).
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:20:43 GMT 2026 - 14.9K bytes - Click Count (0) -
fastapi/param_functions.py
from fastapi import Security, FastAPI from .db import User from .security import get_current_active_user app = FastAPI() @app.get("/users/me/items/") async def read_own_items( current_user: Annotated[User, Security(get_current_active_user, scopes=["items"])] ): return [{"item_id": "Foo", "owner": current_user.username}] ``` """Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 68K bytes - Click Count (0) -
docs/ko/docs/advanced/security/oauth2-scopes.md
`Security`는 (`Depends`처럼) 의존성을 선언하는 데 사용할 수 있지만, `Security`는 스코프(문자열) 목록을 받는 `scopes` 매개변수도 받습니다. 이 경우, 의존성 함수 `get_current_active_user`를 `Security`에 전달합니다(`Depends`로 할 때와 같은 방식). 하지만 스코프 `list`도 함께 전달합니다. 여기서는 스코프 하나만: `items`(더 많을 수도 있습니다). 또한 의존성 함수 `get_current_active_user`는 `Depends`뿐 아니라 `Security`로도 하위 의존성을 선언할 수 있습니다. 자체 하위 의존성 함수(`get_current_user`)와 추가 스코프 요구사항을 선언합니다.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:06:26 GMT 2026 - 15.7K bytes - Click Count (0)