Skip to content

Базовая аутентификация

Bases: IcebergRESTCatalogAuth, FrozenModel

Basic Authentication for Iceberg REST Catalog.

All requests to REST catalog are made with HTTP header Authorization: Basic {user}:{password}.

Added in 0.15.0

Parameters

user : str Username for authentication.

str

Password for authentication.

Examples

from onetl.connection import Iceberg

auth = Iceberg.RESTCatalog.BasicAuth(
    user="my_user",
    password="my_password",
)
Source code in onetl/connection/db_connection/iceberg/catalog/auth/basic.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class IcebergRESTCatalogBasicAuth(IcebergRESTCatalogAuth, FrozenModel):
    """Basic Authentication for Iceberg REST Catalog.

    All requests to REST catalog are made with HTTP header `Authorization: Basic {user}:{password}`.

    !!! success "Added in 0.15.0"

    Parameters
    ----------
    user : str
        Username for authentication.

    password : str
        Password for authentication.

    Examples
    --------

    ```python
    from onetl.connection import Iceberg

    auth = Iceberg.RESTCatalog.BasicAuth(
        user="my_user",
        password="my_password",
    )
    ```
    """

    # https://github.com/apache/iceberg/blob/720ef99720a1c59e4670db983c951243dffc4f3e/core/src/main/java/org/apache/iceberg/rest/auth/BasicAuthManager.java
    # https://github.com/apache/iceberg/blob/720ef99720a1c59e4670db983c951243dffc4f3e/core/src/main/java/org/apache/iceberg/rest/auth/AuthProperties.java#L44-L45
    user: str
    password: SecretStr

    def get_config(self) -> dict[str, str]:
        return {
            "rest.auth.type": "basic",
            "rest.auth.basic.username": self.user,
            "rest.auth.basic.password": self.password.get_secret_value(),
        }