Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 798 for http (0.16 sec)

  1. fastapi/security/http.py

    from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
    from typing_extensions import Annotated, Doc
    
    
    class HTTPBasicCredentials(BaseModel):
        """
        The HTTP Basic credentials given as the result of using `HTTPBasic` in a
        dependency.
    
        Read more about it in the
        [FastAPI docs for HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/security/http-basic-auth/).
        """
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  2. docs/de/docs/advanced/security/http-basic-auth.md

    # HTTP Basic Auth
    
    Für die einfachsten Fälle können Sie <abbr title="HTTP-Basisauthentifizierung">HTTP Basic Auth</abbr> verwenden.
    
    Bei HTTP Basic Auth erwartet die Anwendung einen Header, der einen Benutzernamen und ein Passwort enthält.
    
    Wenn sie diesen nicht empfängt, gibt sie den HTTP-Error 401 „Unauthorized“ zurück.
    
    Und gibt einen Header `WWW-Authenticate` mit dem Wert `Basic` und einem optionalen `realm`-Parameter („Bereich“) zurück.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:28:08 GMT 2024
    - 6.9K bytes
    - Viewed (0)
  3. tests/test_security_http_base.py

        response = client.get("/users/me", headers={"Authorization": "Other foobar"})
        assert response.status_code == 200, response.text
        assert response.json() == {"scheme": "Other", "credentials": "foobar"}
    
    
    def test_security_http_base_no_credentials():
        response = client.get("/users/me")
        assert response.status_code == 403, response.text
        assert response.json() == {"detail": "Not authenticated"}
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  4. tests/test_security_http_bearer.py

    
    client = TestClient(app)
    
    
    def test_security_http_bearer():
        response = client.get("/users/me", headers={"Authorization": "Bearer foobar"})
        assert response.status_code == 200, response.text
        assert response.json() == {"scheme": "Bearer", "credentials": "foobar"}
    
    
    def test_security_http_bearer_no_credentials():
        response = client.get("/users/me")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2K bytes
    - Viewed (0)
  5. docs/zh/docs/advanced/security/http-basic-auth.md

    # HTTP 基础授权
    
    最简单的用例是使用 HTTP 基础授权(HTTP Basic Auth)。
    
    在 HTTP 基础授权中,应用需要请求头包含用户名与密码。
    
    如果没有接收到 HTTP 基础授权,就返回 HTTP 401 `"Unauthorized"` 错误。
    
    并返回含 `Basic` 值的请求头 `WWW-Authenticate`以及可选的 `realm` 参数。
    
    HTTP 基础授权让浏览器显示内置的用户名与密码提示。
    
    输入用户名与密码后,浏览器会把它们自动发送至请求头。
    
    ## 简单的 HTTP 基础授权
    
    * 导入 `HTTPBsic` 与 `HTTPBasicCredentials`
    * 使用 `HTTPBsic` 创建**安全概图**
    * 在*路径操作*的依赖项中使用 `security`
    * 返回类型为 `HTTPBasicCredentials` 的对象:
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 22:43:48 GMT 2024
    - 3.9K bytes
    - Viewed (0)
  6. tests/test_security_http_bearer_description.py

    app = FastAPI()
    
    security = HTTPBearer(description="HTTP Bearer token scheme")
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)):
        return {"scheme": credentials.scheme, "credentials": credentials.credentials}
    
    
    client = TestClient(app)
    
    
    def test_security_http_bearer():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  7. tests/test_security_http_digest_description.py

    
    client = TestClient(app)
    
    
    def test_security_http_digest():
        response = client.get("/users/me", headers={"Authorization": "Digest foobar"})
        assert response.status_code == 200, response.text
        assert response.json() == {"scheme": "Digest", "credentials": "foobar"}
    
    
    def test_security_http_digest_no_credentials():
        response = client.get("/users/me")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  8. tests/test_security_http_base_optional.py

    
    client = TestClient(app)
    
    
    def test_security_http_base():
        response = client.get("/users/me", headers={"Authorization": "Other foobar"})
        assert response.status_code == 200, response.text
        assert response.json() == {"scheme": "Other", "credentials": "foobar"}
    
    
    def test_security_http_base_no_credentials():
        response = client.get("/users/me")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  9. tests/test_security_http_basic_optional.py

    
    client = TestClient(app)
    
    
    def test_security_http_basic():
        response = client.get("/users/me", auth=("john", "secret"))
        assert response.status_code == 200, response.text
        assert response.json() == {"username": "john", "password": "secret"}
    
    
    def test_security_http_basic_no_credentials():
        response = client.get("/users/me")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  10. tests/test_security_http_basic_realm.py

    
    client = TestClient(app)
    
    
    def test_security_http_basic():
        response = client.get("/users/me", auth=("john", "secret"))
        assert response.status_code == 200, response.text
        assert response.json() == {"username": "john", "password": "secret"}
    
    
    def test_security_http_basic_no_credentials():
        response = client.get("/users/me")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.6K bytes
    - Viewed (0)
Back to top