- Sort Score
- Result 10 results
- Languages All
Results 31 - 40 of 59 for get_current_user (0.11 sec)
-
docs/ko/docs/tutorial/security/get-current-user.md
```Python hl_lines="3 10-14" {!> ../../docs_src/security/tutorial002_py310.py!} ``` //// ## `get_current_user` 의존성 생성하기 의존성 `get_current_user`를 만들어 봅시다. 의존성이 하위 의존성을 가질 수 있다는 것을 기억하십니까? `get_current_user`는 이전에 생성한 것과 동일한 `oauth2_scheme`과 종속성을 갖게 됩니다. 이전에 *경로 작동*에서 직접 수행했던 것과 동일하게 새 종속성 `get_current_user`는 하위 종속성 `oauth2_scheme`에서 `str`로 `token`을 수신합니다. //// tab | 파이썬 3.7 이상 ```Python hl_lines="25"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.6K bytes - Viewed (0) -
docs_src/security/tutorial002_py310.py
username=token + "fakedecoded", email="******@****.***", full_name="John Doe" ) async def get_current_user(token: str = Depends(oauth2_scheme)): user = fake_decode_token(token) return user @app.get("/users/me") async def read_users_me(current_user: User = Depends(get_current_user)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jan 07 14:11:31 UTC 2022 - 711 bytes - Viewed (0) -
docs/en/docs/tutorial/security/get-current-user.md
``` //// ## Create a `get_current_user` dependency Let's create a dependency `get_current_user`. Remember that dependencies can have sub-dependencies? `get_current_user` will have a dependency with the same `oauth2_scheme` we created before.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 7.4K bytes - Viewed (0) -
docs_src/security/tutorial002_an_py310.py
username=token + "fakedecoded", email="******@****.***", full_name="John Doe" ) async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]): user = fake_decode_token(token) return user @app.get("/users/me") async def read_users_me(current_user: Annotated[User, Depends(get_current_user)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 761 bytes - Viewed (0) -
docs_src/security/tutorial002.py
username=token + "fakedecoded", email="******@****.***", full_name="John Doe" ) async def get_current_user(token: str = Depends(oauth2_scheme)): user = fake_decode_token(token) return user @app.get("/users/me") async def read_users_me(current_user: User = Depends(get_current_user)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 755 bytes - Viewed (0) -
docs_src/security/tutorial002_an.py
username=token + "fakedecoded", email="******@****.***", full_name="John Doe" ) async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]): user = fake_decode_token(token) return user @app.get("/users/me") async def read_users_me(current_user: Annotated[User, Depends(get_current_user)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 815 bytes - Viewed (0) -
docs_src/security/tutorial004_an_py39.py
expire = datetime.now(timezone.utc) + timedelta(minutes=15) to_encode.update({"exp": expire}) encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM) return encoded_jwt async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]): credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4.2K bytes - Viewed (0) -
docs/en/docs/advanced/security/oauth2-scopes.md
As the `get_current_active_user` dependency has as a sub-dependency on `get_current_user`, the scope `"me"` declared at `get_current_active_user` will be included in the list of required scopes in the `security_scopes.scopes` passed to `get_current_user`. The *path operation* itself also declares a scope, `"items"`, so this will also be in the list of `security_scopes.scopes` passed to `get_current_user`. Here's how the hierarchy of dependencies and scopes looks like:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 29 11:02:16 UTC 2024 - 13.1K bytes - Viewed (0) -
tests/test_security_api_key_header.py
app = FastAPI() api_key = APIKeyHeader(name="key") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: User = Depends(get_current_user)): return current_user client = TestClient(app) def test_security_api_key():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.8K bytes - Viewed (0) -
tests/test_security_api_key_header_description.py
class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: User = Depends(get_current_user)): return current_user client = TestClient(app) def test_security_api_key():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2K bytes - Viewed (0)