Skip to content
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

[DCMAW-10830] update session state in /async/biometricToken #340

Merged
merged 15 commits into from
Jan 21, 2025

Conversation

chris-cooksley-gds
Copy link
Contributor

@chris-cooksley-gds chris-cooksley-gds commented Jan 16, 2025

DCMAW-10830

What changed

  • Introduces new updateSession method on the DynamoDB adapter.
    • This method is defined as part of a generic SessionRegistry interface.
    • It expects an UpdateSessionOperation, and uses the methods on that object to get the appropriate update/condition expressions for the UpdateItemCommand to DynamoDB. This isolates the logic for different types of update, facilitating testing and keeping the adapter logic simple.
    • It logs the attempt/success of the call to DynamoDB at debug level, as per the new pattern.
    • It logs conditional check failures separately to other failures, to help us identify when a session doesn't exist or is in the wrong state.
  • Defines a BiometricTokenIssued update operation. It requires the session in question to exist, to (implicitly) not have expired, and to be in the ASYNC_AUTH_SESSION_CREATED state. It updates the state to ASYNC_BIOMETRIC_TOKEN_ISSUED and adds the passed document type and opaque ID.
  • Updates handler to generate opaque ID and update the session using the above pattern. Conditional check failures elicit an unauthorized response, server errors elicit a server error response.
  • Adds necessary permission to update session to the Lambda execution role
  • Updates API tests for /async/biometricToken happy path, as the sessionId of a valid, current session is now required.

Why did it change

  • Our user session follows a forward-only state machine. Updating the session state - in tandem with conditional checks made on the current session state - ensures that the user's document type and opaque ID are 'locked in' and cannot be changed on subsequent requests.

Evidence

image
image

@chris-cooksley-gds chris-cooksley-gds changed the title [DCMAW-10830] Draft PR for early feedback [DCMAW-10830] update session state in /async/biometricToken Jan 20, 2025
@chris-cooksley-gds chris-cooksley-gds marked this pull request as ready for review January 20, 2025 15:18
@chris-cooksley-gds chris-cooksley-gds requested review from a team as code owners January 20, 2025 15:18
jmooney-dd
jmooney-dd previously approved these changes Jan 20, 2025
@chris-cooksley-gds chris-cooksley-gds merged commit 4067279 into main Jan 21, 2025
2 checks passed
@chris-cooksley-gds chris-cooksley-gds deleted the DCMAW-10830 branch January 21, 2025 08:52
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

Successfully merging this pull request may close these issues.

3 participants