Repository: CS-SI/eodag

Issue:
eodag-authenticated and origin raw assets both available in server mode
In server mode, once #721 is done, make available both eodag-authenticated and origin raw assets using https://github.com/stac-extensions/alternate-assets:
```json
{
  "features": [
    {
      "id": "some-product",
      "assets": {
        "B01": {
          "title": "Download link",
          "href": "http://127.0.0.1:5000/collections/some-collection/items/some-product/download/B01",
          "alternate": {
            "origin": {
              "title": "Origin asset link",
              "href": "s3://path/to/B01-asset"
            }
          }
        }
      }
    }
  ]
}
```


Discussion:
github-actions[bot]: ## Test Results
    2 files   - 1      2 suites   - 1   1m 30s [:stopwatch:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "duration of all tests") -1s
440 tests ±0  436 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "passed tests") ±0    3 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "skipped / disabled tests") ±0  1 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "failed tests") ±0 
689 runs  +7  653 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "passed tests") +7  35 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "skipped / disabled tests") ±0  1 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v2.11.0/README.md#the-symbols "failed tests") ±0 

For more details on these failures, see [this check](https://github.com/CS-SI/eodag/runs/19599283533).

Results for commit b4f3f2a5. ± Comparison against base commit 0dcc36d2.

[test-results]:data:application/gzip;base64,H4sIALqveWUC/03MSw7CIBSF4a00jB0ob9yM4XUTYlsMhZFx715Mix3+30nOm0Ca40buE71MZGupjgit2Jryimmu2LjUvnE+6rE17zsx+adneiGxAWDTjHAbEEvJBaXflLb2T6nNHselFGzI/igOOD3++nzo87KkikEcBwbUCqeilY55CBAsZYKCj0oHZcArG4Mmny/gD4/6BQEAAA==


Patch:
diff --git a/eodag/rest/stac.py b/eodag/rest/stac.py
index 4114e3c5..8f84ddea 100644
--- a/eodag/rest/stac.py
+++ b/eodag/rest/stac.py
@@ -275,20 +275,28 @@ class StacItem(StacCommon):
                     "href"
                 ] = f"{without_arg_url}?{urlencode(query_dict, doseq=True)}"
 
-            # add origin assets to product assets
-            origin_assets = product_item["assets"].pop("origin_assets")
+            # move origin asset urls to alternate links and replace with eodag-server ones
+            origin_assets = product_item["assets"].pop("origin_assets", {})
             if getattr(product, "assets", False):
                 # replace origin asset urls with eodag-server ones
                 for asset_key, asset_value in origin_assets.items():
-                    origin_assets[asset_key]["href"] = without_arg_url
+                    # use origin asset as default
+                    product_item["assets"][asset_key] = asset_value
+                    # origin assets as alternate link
+                    product_item["assets"][asset_key]["alternate"] = {
+                        "origin": {
+                            "title": "Origin asset link",
+                            "href": asset_value["href"],
+                        }
+                    }
+                    # use server-mode assets download links
+                    asset_value["href"] = without_arg_url
                     if query_dict:
-                        origin_assets[asset_key][
+                        product_item["assets"][asset_key][
                             "href"
                         ] += f"/{asset_key}?{urlencode(query_dict, doseq=True)}"
                     else:
-                        origin_assets[asset_key]["href"] += f"/{asset_key}"
-
-                product_item["assets"] = dict(product_item["assets"], **origin_assets)
+                        product_item["assets"][asset_key]["href"] += f"/{asset_key}"
 
             # apply conversion if needed
             for prop_key, prop_val in need_conversion.items():


Test patch:
diff --git a/tests/units/test_stac_utils.py b/tests/units/test_stac_utils.py
index 6b3fd0f1..7e03f4ab 100644
--- a/tests/units/test_stac_utils.py
+++ b/tests/units/test_stac_utils.py
@@ -453,10 +453,16 @@ class TestStacUtils(unittest.TestCase):
             "assets"
         ].items():
             self.assertIn(k, response["features"][0]["assets"].keys())
+            # check asset server-mode download link
             self.assertEqual(
                 response["features"][0]["assets"][k]["href"],
                 f"http://foo/collections/S2_MSI_L2A/items/{product_id}/download/{k}?provider=earth_search",
             )
+            # check asset origin download link
+            self.assertEqual(
+                response["features"][0]["assets"][k]["alternate"]["origin"]["href"],
+                self.earth_search_resp_search_json["features"][0]["assets"][k]["href"],
+            )
         # preferred provider should not be changed
         self.assertEqual("peps", self.rest_utils.eodag_api.get_preferred_provider()[0])