Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions pyiceberg/catalog/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
from pyiceberg.typedef import EMPTY_DICT, UTF8, IcebergBaseModel, Identifier, Properties
from pyiceberg.types import transform_dict_value_to_str
from pyiceberg.utils.deprecated import deprecation_message
from pyiceberg.utils.properties import get_first_property_value, get_header_properties, property_as_bool
from pyiceberg.utils.properties import get_header_properties, property_as_bool

if TYPE_CHECKING:
import pyarrow as pa
Expand Down Expand Up @@ -137,7 +137,6 @@ class IdentifierKind(Enum):
SIGV4 = "rest.sigv4-enabled"
SIGV4_REGION = "rest.signing-region"
SIGV4_SERVICE = "rest.signing-name"
AUTH_URL = "rest.authorization-url"
OAUTH2_SERVER_URI = "oauth2-server-uri"

NAMESPACE_SEPARATOR = b"\x1f".decode(UTF8)
Expand Down Expand Up @@ -318,16 +317,9 @@ def url(self, endpoint: str, prefixed: bool = True, **kwargs: Any) -> str:

@property
def auth_url(self) -> str:
if self.properties.get(AUTH_URL):
deprecation_message(
deprecated_in="0.8.0",
removed_in="0.9.0",
help_message=f"The property {AUTH_URL} is deprecated. Please use {OAUTH2_SERVER_URI} instead",
)

self._warn_oauth_tokens_deprecation()

if url := get_first_property_value(self.properties, AUTH_URL, OAUTH2_SERVER_URI):
if url := self.properties.get(OAUTH2_SERVER_URI):
return url
else:
return self.url(Endpoints.get_token, prefixed=False)
Expand Down
8 changes: 4 additions & 4 deletions tests/catalog/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

TEST_URI = "https://iceberg-test-catalog/"
TEST_CREDENTIALS = "client:secret"
TEST_AUTH_URL = "https://auth-endpoint/"
TEST_OAUTH2_SERVER_URI = "https://auth-endpoint/"
TEST_TOKEN = "some_jwt_token"
TEST_SCOPE = "openid_offline_corpds_ds_profile"
TEST_AUDIENCE = "test_audience"
Expand Down Expand Up @@ -257,9 +257,9 @@ def test_token_with_custom_scope(rest_mock: Mocker) -> None:
@pytest.mark.filterwarnings(
"ignore:Deprecated in 0.8.0, will be removed in 1.0.0. Iceberg REST client is missing the OAuth2 server URI:DeprecationWarning"
)
def test_token_200_w_auth_url(rest_mock: Mocker) -> None:
def test_token_200_w_oauth2_server_uri(rest_mock: Mocker) -> None:
rest_mock.post(
TEST_AUTH_URL,
TEST_OAUTH2_SERVER_URI,
json={
"access_token": TEST_TOKEN,
"token_type": "Bearer",
Expand All @@ -271,7 +271,7 @@ def test_token_200_w_auth_url(rest_mock: Mocker) -> None:
)
# pylint: disable=W0212
assert (
RestCatalog("rest", uri=TEST_URI, credential=TEST_CREDENTIALS, **{OAUTH2_SERVER_URI: TEST_AUTH_URL})._session.headers[
RestCatalog("rest", uri=TEST_URI, credential=TEST_CREDENTIALS, **{OAUTH2_SERVER_URI: OAUTH2_SERVER_URI})._session.headers[
"Authorization"
]
== f"Bearer {TEST_TOKEN}"
Expand Down