|
18 | 18 | from stac_fastapi.core.extensions import QueryExtension
|
19 | 19 |
|
20 | 20 | if os.getenv("BACKEND", "elasticsearch").lower() == "opensearch":
|
| 21 | + from stac_fastapi.opensearch.basic_auth import apply_basic_auth |
21 | 22 | from stac_fastapi.opensearch.config import AsyncOpensearchSettings as AsyncSettings
|
22 | 23 | from stac_fastapi.opensearch.config import OpensearchSettings as SearchSettings
|
23 | 24 | from stac_fastapi.opensearch.database_logic import (
|
24 | 25 | DatabaseLogic,
|
25 | 26 | create_collection_index,
|
26 | 27 | create_index_templates,
|
27 | 28 | )
|
28 |
| - from stac_fastapi.opensearch.basic_auth import apply_basic_auth |
29 | 29 | else:
|
30 | 30 | from stac_fastapi.elasticsearch.config import (
|
31 | 31 | ElasticsearchSettings as SearchSettings,
|
@@ -258,10 +258,34 @@ async def app_basic_auth():
|
258 | 258 | search_get_request_model=create_get_request_model(extensions),
|
259 | 259 | search_post_request_model=post_request_model,
|
260 | 260 | )
|
261 |
| - |
262 |
| - os.environ["BASIC_AUTH"] = '{"public_endpoints":[{"path":"/","method":"GET"},{"path":"/search","method":"GET"}],"users":[{"username":"admin","password":"admin","permissions":"*"},{"username":"reader","password":"reader","permissions":[{"path":"/conformance","method":["GET"]},{"path":"/collections/{collection_id}/items/{item_id}","method":["GET"]},{"path":"/search","method":["POST"]},{"path":"/collections","method":["GET"]},{"path":"/collections/{collection_id}","method":["GET"]},{"path":"/collections/{collection_id}/items","method":["GET"]},{"path":"/queryables","method":["GET"]},{"path":"/queryables/collections/{collection_id}/queryables","method":["GET"]},{"path":"/_mgmt/ping","method":["GET"]}]}]}' |
| 261 | + |
| 262 | + os.environ[ |
| 263 | + "BASIC_AUTH" |
| 264 | + ] = """{ |
| 265 | + "public_endpoints": [ |
| 266 | + {"path": "/", "method": "GET"}, |
| 267 | + {"path": "/search", "method": "GET"} |
| 268 | + ], |
| 269 | + "users": [ |
| 270 | + {"username": "admin", "password": "admin", "permissions": "*"}, |
| 271 | + { |
| 272 | + "username": "reader", "password": "reader", |
| 273 | + "permissions": [ |
| 274 | + {"path": "/conformance", "method": ["GET"]}, |
| 275 | + {"path": "/collections/{collection_id}/items/{item_id}", "method": ["GET"]}, |
| 276 | + {"path": "/search", "method": ["POST"]}, |
| 277 | + {"path": "/collections", "method": ["GET"]}, |
| 278 | + {"path": "/collections/{collection_id}", "method": ["GET"]}, |
| 279 | + {"path": "/collections/{collection_id}/items", "method": ["GET"]}, |
| 280 | + {"path": "/queryables", "method": ["GET"]}, |
| 281 | + {"path": "/queryables/collections/{collection_id}/queryables", "method": ["GET"]}, |
| 282 | + {"path": "/_mgmt/ping", "method": ["GET"]} |
| 283 | + ] |
| 284 | + } |
| 285 | + ] |
| 286 | + }""" |
263 | 287 | apply_basic_auth(stac_api)
|
264 |
| - |
| 288 | + |
265 | 289 | return stac_api.app
|
266 | 290 |
|
267 | 291 |
|
|
0 commit comments