-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1166 from govuk-one-login/pyic-7785
PYIC-7785: Add option to use enqueue handler to just fetch oauth state
- Loading branch information
Showing
7 changed files
with
184 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
di-ipv-dcmaw-async-stub/lambdas/src/handlers/managementCleanupSessionHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from "aws-lambda"; | ||
import { buildApiResponse } from "../common/apiResponse"; | ||
import getErrorMessage from "../common/errorReporting"; | ||
import { deleteState } from "../services/userStateService"; | ||
|
||
export async function handler( | ||
event: APIGatewayProxyEventV2, | ||
): Promise<APIGatewayProxyResultV2> { | ||
try { | ||
if (event.body === undefined) { | ||
return buildApiResponse({ errorMessage: "No request body" }, 400); | ||
} | ||
|
||
const requestBody = JSON.parse(event.body); | ||
|
||
if (!requestBody.user_id) { | ||
return buildApiResponse( | ||
{ errorMessage: "Missing user_id in request body" }, | ||
400, | ||
); | ||
} | ||
|
||
await deleteState(requestBody.user_id); | ||
|
||
return buildApiResponse( | ||
{ | ||
result: "success", | ||
}, | ||
200, | ||
); | ||
} catch (error) { | ||
return buildApiResponse( | ||
{ errorMessage: "Unexpected error: " + getErrorMessage(error) }, | ||
500, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters