# US-13 — Authenticate and access own health information The [common requirements](00-common-requirements.md) apply to this story. **As a patient,** I want to authenticate using my credentials and access only my own health information, so that I can use the system while access to my information is restricted to me and healthcare professionals assigned to me. ## Functional requirements The thesis prototype uses pre-created test accounts and synthetic patient data. A patient account has zero profiles before initial creation and exactly one afterwards, as defined in US-01. Healthcare professional accounts use predefined patient assignments under US-14. Authentication is required for all patient profile, observation, insight, trend and health overview operations. General US-15 guidance is available without authentication. Patients may perform the operations defined by the existing user stories only on their own information. ## Acceptance criteria ```gherkin Scenario: Successful authentication Given I have a pre-created account When I authenticate using valid credentials Then the system recognises my account and Patient role And recognises its associated patient profile if one has been created ``` ```gherkin Scenario: Access to my own information Given I am authenticated When I request an available operation on my own health information Then access is permitted And the operation follows its existing acceptance criteria ``` ```gherkin Scenario: Invalid credentials Given I am not authenticated When I attempt to authenticate using an incorrect account identifier or incorrect secret Then authentication is rejected And the response does not reveal which part of the credentials was incorrect ``` ```gherkin Scenario: Missing authentication Given I have not authenticated When I request an operation involving patient information Then the request is rejected And no patient information is returned or changed ``` ```gherkin Scenario: Invalid authentication information Given my request contains authentication information that the system cannot validate When I request an operation involving patient information Then the request is rejected And no patient information is returned or changed ``` ```gherkin Scenario: Access to another patient’s information Given I am authenticated as one patient When I attempt to view or change another patient’s information Then access is rejected And none of that patient’s information is returned or changed ``` ```gherkin Scenario: Own information does not yet exist Given I am authenticated And the requested information does not yet exist for my patient account When I request that information Then the system follows the existing behaviour for missing information And does not return another patient’s information ``` ```gherkin Scenario: Login before profile creation Given I have a pre-created patient account with no associated profile When I authenticate using valid credentials Then authentication succeeds and recognises my account and Patient role And I may create my initial profile under US-01 And I gain no access to another patient’s information ``` ```gherkin Scenario: Expired authentication Given my authentication information has expired When I request protected patient information Then the request is rejected And no patient information is returned or changed ``` ## Prototype limitations Account registration, password recovery, multifactor authentication, account administration, access by unassigned third parties, and writes by healthcare professionals are outside scope. Assigned healthcare professionals have the read-only access defined in US-14. These criteria apply to every applicable API operation. The authentication mechanism and internal implementation are separate design decisions. The prototype does not claim production readiness.