|
9 | 9 | from httpx import HTTPStatusError |
10 | 10 | from pystac import Catalog, Collection, Item, StacIO |
11 | 11 |
|
12 | | -from worker.common.iam import IAMClient |
13 | 12 | from worker.common.log_utils import configure_logging, log_with_context |
14 | | -from worker.common.secrets import worker_secrets |
15 | 13 | from worker.common.task_handler import TaskHandler |
16 | 14 | from worker.common.types import ExternalJob, JobResult, JobResultBuilder |
17 | 15 |
|
18 | 16 | configure_logging() |
19 | 17 |
|
20 | | -iam_client_id = worker_secrets.get_secret("iam_client_id", None) |
21 | | -iam_client_secret = worker_secrets.get_secret("iam_client_secret", None) |
22 | | -iam_oidc_token_endpoint_url = "https://iam-auth.apx.develop.eoepca.org/realms/eoepca/protocol/openid-connect/token" |
23 | | -iam_client = IAMClient( |
24 | | - token_endpoint_url=iam_oidc_token_endpoint_url, client_id=iam_client_id, client_secret=iam_client_secret |
25 | | -) |
26 | | - |
27 | 18 |
|
28 | 19 | class StacCatalogHandler(TaskHandler): |
29 | 20 | def execute(self, job: ExternalJob, result: JobResultBuilder, config: dict) -> JobResult: |
@@ -218,7 +209,7 @@ def execute(self, job: ExternalJob, result: JobResultBuilder, config: dict) -> J |
218 | 209 | return result.failure() |
219 | 210 |
|
220 | 211 | # Get token to access protected endpoints of catalog |
221 | | - token = iam_client.get_access_token() |
| 212 | + token = self.iam_client.get_access_token() |
222 | 213 | headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} |
223 | 214 |
|
224 | 215 | # Publish stac collection |
@@ -348,7 +339,7 @@ def execute(self, job: ExternalJob, result: JobResultBuilder, config: dict) -> J |
348 | 339 | return result.failure() |
349 | 340 |
|
350 | 341 | # Get token to access protected endpoints of catalog |
351 | | - token = iam_client.get_access_token() |
| 342 | + token = self.iam_client.get_access_token() |
352 | 343 | headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"} |
353 | 344 |
|
354 | 345 | # Publish STAC item |
|
0 commit comments