Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for passlib (0.78 sec)

  1. docs/zh/docs/tutorial/security/oauth2-jwt.md

    这样一来,窃贼就无法在其它应用中使用窃取的密码(要知道,很多用户在所有系统中都使用相同的密码,风险超大)。
    
    ## 安装 `passlib`
    
    Passlib 是处理密码哈希的 Python 包。
    
    它支持很多安全哈希算法及配套工具。
    
    本教程推荐的算法是 **Bcrypt**。
    
    因此,请先安装附带 Bcrypt 的 PassLib:
    
    <div class="termy">
    
    ```console
    $ pip install passlib[bcrypt]
    
    ---> 100%
    ```
    
    </div>
    
    /// tip | 提示
    
    `passlib` 甚至可以读取 Django、Flask 的安全插件等工具创建的密码。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  2. docs/ja/docs/how-to/conditional-openapi.md

    もしあなたのAPIのセキュリティを強化したいなら、いくつかのよりよい方法があります。例を示すと、
    
    * リクエストボディとレスポンスのためのPydanticモデルの定義を見直す。
    * 依存関係に基づきすべての必要なパーミッションとロールを設定する。
    * パスワードを絶対に平文で保存しない。パスワードハッシュのみを保存する。
    * PasslibやJWTトークンに代表される、よく知られた暗号化ツールを使って実装する。
    * そして必要なところでは、もっと細かいパーミッション制御をOAuth2スコープを使って行う。
    * など
    
    それでも、例えば本番環境のような特定の環境のみで、あるいは環境変数の設定によってAPIドキュメントをどうしても無効にしたいという、非常に特殊なユースケースがあるかもしれません。
    
    ## 設定と環境変数による条件付き OpenAPI
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_generate_clients/test_tutorial004.py

    import importlib
    import json
    import pathlib
    from unittest.mock import patch
    
    from docs_src.generate_clients import tutorial003_py39
    
    
    def test_remove_tags(tmp_path: pathlib.Path):
        tmp_file = tmp_path / "openapi.json"
        openapi_json = tutorial003_py39.app.openapi()
        tmp_file.write_text(json.dumps(openapi_json))
    
        with patch("pathlib.Path", return_value=tmp_file):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 8.3K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_background_tasks/test_tutorial001.py

    import os
    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.background_tasks.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test():
        log = Path("log.txt")
        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 583 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_custom_response/test_tutorial009.py

    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.custom_response import tutorial009_py39
    from docs_src.custom_response.tutorial009_py39 import app
    
    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial009_py39.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 502 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_static_files/test_tutorial001.py

    import os
    from pathlib import Path
    
    import pytest
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(scope="module")
    def client():
        static_dir: Path = Path(os.getcwd()) / "static"
        static_dir.mkdir(exist_ok=True)
        sample_file = static_dir / "sample.txt"
        sample_file.write_text("This is a sample static file.")
        from docs_src.static_files.tutorial001_py39 import app
    
        with TestClient(app) as client:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/generate_clients/tutorial004_py39.py

    import json
    from pathlib import Path
    
    file_path = Path("./openapi.json")
    openapi_content = json.loads(file_path.read_text())
    
    for path_data in openapi_content["paths"].values():
        for operation in path_data.values():
            tag = operation["tags"][0]
            operation_id = operation["operationId"]
            to_remove = f"{tag}-"
            new_operation_id = operation_id[len(to_remove) :]
            operation["operationId"] = new_operation_id
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 493 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_custom_response/test_tutorial009b.py

    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.custom_response import tutorial009b_py39
    from docs_src.custom_response.tutorial009b_py39 import app
    
    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial009b_py39.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 505 bytes
    - Viewed (0)
  9. docs/ko/docs/how-to/conditional-openapi.md

    API를 보호하고 싶다면, 예를 들어 다음과 같은 더 나은 방법들이 있습니다:
    
    * 요청 본문과 응답에 대해 잘 정의된 Pydantic 모델을 사용하도록 하세요.
    
    * 종속성을 사용하여 필요한 권한과 역할을 구성하세요.
    
    * 평문 비밀번호를 절대 저장하지 말고, 오직 암호화된 비밀번호만 저장하세요.
    
    * Passlib과 JWT 토큰과 같은 잘 알려진 암호화 도구들을 구현하고 사용하세요.
    
    * 필요한 곳에 OAuth2 범위를 사용하여 더 세분화된 권한 제어를 추가하세요.
    
    * 등등....
    
    그럼에도 불구하고, 특정 환경(예: 프로덕션)에서 또는 환경 변수의 설정에 따라 API 문서를 비활성화해야 하는 매우 특정한 사용 사례가 있을 수 있습니다.
    
    ## 설정 및 환경변수의 조건부 OpenAPI
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Nov 07 20:41:38 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_custom_response/test_tutorial008.py

    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from docs_src.custom_response import tutorial008_py39
    from docs_src.custom_response.tutorial008_py39 import app
    
    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial008_py39.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 502 bytes
    - Viewed (0)
Back to top