Skip to content

Commit de28943

Browse files
committed
decouple api_version and jwt_conformance
1 parent 63d607a commit de28943

3 files changed

Lines changed: 149 additions & 120 deletions

File tree

openeo/rest/_testing.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,13 +432,14 @@ def build_conformance(
432432
*,
433433
api_version: str = "1.0.0",
434434
stac_version: str = "1.1.0",
435+
jwt_auth: bool = False, # may be more dynamic to pass auth-strings in the future
435436
) -> list[str]:
436437
conformance = [
437438
"https://api.openeo.org/{api_version}",
438439
"https://api.stacspec.org/v{stac_version}/core",
439440
"https://api.stacspec.org/v{stac_version}/collections"
440441
]
441-
if ComparableVersion(api_version) >= ComparableVersion("1.3.0"):
442+
if jwt_auth:
442443
conformance.append(f"https://api.openeo.org/{api_version}/authentication/jwt")
443444
return conformance
444445

@@ -454,6 +455,7 @@ def build_capabilities(
454455
processes: bool = True,
455456
sync_processing: bool = True,
456457
validation: bool = False,
458+
token_type: str = "legacy",
457459
batch_jobs: bool = True,
458460
udp: bool = False,
459461
) -> dict:
@@ -495,10 +497,7 @@ def build_capabilities(
495497
]
496498
)
497499

498-
conformance = build_conformance(
499-
api_version=api_version,
500-
stac_version=stac_version,
501-
)
500+
conformance = build_conformance(api_version=api_version, stac_version=stac_version, jwt_auth=(token_type == "jwt"))
502501

503502
capabilities = {
504503
"api_version": api_version,

openeo/rest/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def try_access_token_refresh(self, *, reason: Optional[str] = None) -> bool:
748748
Returns whether a new access token was obtained.
749749
"""
750750
reason = f" Reason: {reason}" if reason else ""
751-
if isinstance(self.auth, BearerAuth) and self.auth.origin == "oidc" and self._oidc_auth_renewer:
751+
if self._oidc_auth_renewer:
752752
try:
753753
self._authenticate_oidc(
754754
authenticator=self._oidc_auth_renewer,

0 commit comments

Comments
 (0)