Skip to content

Add the option to include basic Auth #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonhealy1 opened this issue Apr 11, 2024 · 3 comments
Closed

Add the option to include basic Auth #225

jonhealy1 opened this issue Apr 11, 2024 · 3 comments

Comments

@jonhealy1
Copy link
Collaborator

jonhealy1 commented Apr 11, 2024

I think this would be a good first step. It's definitely imperative that Users can turn on and off the option for their own deployment as Users may want to implement their own solution or use services provided by their cloud-provider.

@rhysrevans3
Copy link
Collaborator

The stac-fastapi base allows you too add route-dependencies at app creation:

routes = [
    {"path": "/collections", "method": "POST"},
    {"path": "/collections/{collectionId}", "method": "PUT"},
    {"path": "/collections/{collectionId}", "method": "DELETE"},
    {"path": "/collections/{collectionId}/items", "method": "POST"},
    {"path": "/collections/{collectionId}/items/{itemId}", "method": "PUT"},
    {"path": "/collections/{collectionId}/items/{itemId}", "method": "DELETE"},
]
dependencies = [Depends(must_be_bob)]
StacApi(
    title=os.getenv("STAC_FASTAPI_TITLE", "stac-fastapi-elasticsearch"),
    description=os.getenv("STAC_FASTAPI_DESCRIPTION", "stac-fastapi-elasticsearch"),
    api_version=os.getenv("STAC_FASTAPI_VERSION", "2.1"),
    settings=settings,
    extensions=extensions,
    client=CoreClient(
        database=database_logic, session=session, post_request_model=post_request_model
    ),
    search_get_request_model=create_get_request_model(extensions),
    search_post_request_model=post_request_model,
    route_dependencies=[(routes, dependencies)]
)

Or after the apps been created:

api.add_route_dependencies(scopes=routes, dependencies=[Depends(must_be_bob)])

I'm not sure the best way to include this in the current workflows. I've been overwriting the whole app.py.

@jonhealy1
Copy link
Collaborator Author

Hi @rhysrevans3. Can you look at this pr Healy-Hyperspatial/stac-fastapi-mongo#13? We are thinking about adding this here also.

@pedro-cf pedro-cf mentioned this issue Apr 26, 2024
4 tasks
@pedro-cf
Copy link
Collaborator

@jonhealy1 this can be closed now :)

This was referenced May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants