Skip to content

Commit

Permalink
Got the authorization working
Browse files Browse the repository at this point in the history
  • Loading branch information
DillonOLeary committed Jan 24, 2025
1 parent e7c0729 commit 649533a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data-pipeline/data_pipeline/aisr.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _get_access_token_using_response_code(
payload = {
"grant_type": "authorization_code",
"code": code,
# "redirect_uri": "https://aisr.web.health.state.mn.us/home", # Unclear if this is needed
"redirect_uri": "https://aisr.web.health.state.mn.us/home",
"client_id": "aisr-app",
}

Expand Down
8 changes: 6 additions & 2 deletions data-pipeline/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def authenticate(username: str = Form(...), password: str = Form(...)):
httponly=True,
secure=True,
)
response.headers["Location"] = "http://127.0.0.1:8000?code=test_code"
response.headers["Location"] = "http://127.0.0.1:8000#code=test_code"
return response
return JSONResponse(
content={"message": "Invalid credentials", "is_successful": False},
Expand Down Expand Up @@ -124,13 +124,17 @@ async def logout(client_id: str):

@app.post("/auth/realms/idepc-aisr-realm/protocol/openid-connect/token")
async def get_access_token(
grant_type: str = Form(...), code: str = Form(...), client_id: str = Form(...)
grant_type: str = Form(...),
redirect_uri: str = Form(...),
code: str = Form(...),
client_id: str = Form(...),
):
"""
Simulates the token endpoint. Returns a mock access token if the request is valid.
"""
if (
grant_type == "authorization_code"
and redirect_uri == "https://aisr.web.health.state.mn.us/home"
and code == "test_code"
and client_id == "aisr-app"
):
Expand Down

0 comments on commit 649533a

Please sign in to comment.