diff --git a/Dockerfile b/Dockerfile index bbb10d05..f04d457e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /home RUN mkdir /home/bin && \ cd /home/bin && wget https://dl.min.io/server/minio/release/linux-amd64/minio && \ wget https://dl.min.io/client/mc/release/linux-amd64/mc && \ - chmod -R 777 /home/bin + chmod -R 777 /home RUN mkdir /.mc && \ chmod -R 777 /.mc RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/hypha/http.py b/hypha/http.py index 1e523f57..d83fc0f7 100644 --- a/hypha/http.py +++ b/hypha/http.py @@ -217,6 +217,31 @@ def __init__(self, store: RedisStore) -> None: router = APIRouter() router.route_class = GzipRoute self.store = store + + @router.get("/authorize") + async def auth_proxy(request: Request): + # Construct the full URL for the Auth0 authorize endpoint with the query parameters + auth0_authorize_url = f"https://{AUTH0_DOMAIN}/authorize?{request.query_params}" + + # Redirect the client to the constructed URL + return RedirectResponse(url=auth0_authorize_url) + + + @router.post("/oauth/token") + async def token_proxy(request: Request): + form_data = await request.form() + async with httpx.AsyncClient() as client: + auth0_response = await client.post( + f"https://{AUTH0_DOMAIN}/oauth/token", + data=form_data, + headers={"Content-Type": "application/x-www-form-urlencoded"} + ) + + return JSONResponse( + status_code=200, + content=auth0_response.json() + ) + @router.get("/authorize") async def auth_proxy(request: Request): diff --git a/requirements.txt b/requirements.txt index cf7fd6d6..ec7f3225 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ pyyaml==6.0.1 requests==2.31.0 shortuuid==1.0.11 uvicorn==0.23.2 -httpx==0.24.1 +httpx==0.26.0 pyotritonclient==0.2.6 fakeredis==2.20.0 redis==4.6.0 diff --git a/requirements_pypi.txt b/requirements_pypi.txt index 0b861b17..c421496c 100644 --- a/requirements_pypi.txt +++ b/requirements_pypi.txt @@ -1,3 +1,3 @@ -setuptools==68.0.0 +setuptools==69.0.3 twine==4.0.2 wheel==0.41.1