Skip to content

Commit

Permalink
Merge branch 'main' of github.com:amun-ai/hypha
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Mar 2, 2024
2 parents 5c932db + 307716c commit 09d2ba5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
25 changes: 25 additions & 0 deletions hypha/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_pypi.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
setuptools==68.0.0
setuptools==69.0.3
twine==4.0.2
wheel==0.41.1

0 comments on commit 09d2ba5

Please sign in to comment.