Restructure project requirements and design documentation
This commit is contained in:
1 parent
fa5e20f4d6
commit
ebf50827d6
32 files changed
+2078
-485
No files matched your search
@@ -0,0 +1,84 @@
|
||||
Prototype authentication and access-control design
|
||||
Date: 2026-10-01
|
||||
System: Personal Health Measurement System
|
||||
Related requirements: US-01, US-13 and US-14
|
||||
1. Status and purpose
|
||||
This document records the authentication and access-control decisions agreed for the thesis prototype. It replaces the proposed HTTP Basic mechanism in replaceable-prototype-authentication.md with token-based authentication and clarifies initial patient-profile creation.
|
||||
The token format is deliberately undecided. This document does not select JWT, a particular identity provider, or an additional service or database. Open implementation decisions are listed in Section 10 and must not be treated as already approved.
|
||||
The purpose is to provide credible patient and healthcare-professional access restrictions without turning the prototype into a production identity-management project. The system uses synthetic patient data and pre-created test accounts. No production-readiness or regulatory-compliance claim is made.
|
||||
Reconciliation update (2026-10-04): account/profile lifecycle and access wording have been aligned with the consolidated US-01, US-13, US-14, and public general guidance in US-15. Open token, persistence ownership, and deployment choices in Section 10 remain open; this requirements reconciliation does not select them.
|
||||
2. Decision summary
|
||||
Topic Decision
|
||||
Authentication Validate account credentials at login; issue a time-limited authentication token for subsequent requests.
|
||||
Token format Open; a concrete mechanism and library must be proposed separately.
|
||||
Framework integration Use ASP.NET Core authentication handlers, authenticated identities (ClaimsPrincipal) and authorization policies.
|
||||
Enforcement point The API gateway handles client authentication and authorization. Protected service APIs must not allow clients to bypass it.
|
||||
Account provisioning Use pre-created patient and healthcare-professional test accounts.
|
||||
Patient association A patient account may initially have no profile. It can create its own profile once; the generated patient identifier is persistently associated with that account.
|
||||
Patient access Existing story-defined operations on the patient's own information only.
|
||||
Professional access Read-only access to assigned patients and access to the professional's own assignment list.
|
||||
Assignments Predefined; assignment-management functionality is outside scope.
|
||||
Replacement Keep credential validation and token handling separate from application access policies.
|
||||
|
||||
|
||||
3. Authentication flow and token boundary
|
||||
1. A client submits credentials to a login endpoint over HTTPS.
|
||||
2. The gateway validates them against trusted pre-created account data using an established password-hashing facility.
|
||||
3. Successful login issues a time-limited token. Invalid credentials do not issue a token, and the rejection does not identify which credential component was incorrect.
|
||||
4. The client presents its token on subsequent protected requests.
|
||||
5. The gateway validates the token using the selected standard framework/library mechanism and establishes the application account identifier and role.
|
||||
6. The gateway applies the relevant authorization policy before returning or changing patient information.
|
||||
7. Missing, invalid or expired tokens are rejected. On expiration, the client authenticates again. Refresh tokens are outside scope.
|
||||
Credential verification must not be repeated for every protected operation. Token validation and authorization still occur on every protected request.
|
||||
The chosen mechanism must protect against token forgery and enforce expiration and the intended trust boundary. If signed self-contained tokens are selected, validation must include signature, trusted issuer and intended audience. Equivalent checks must be specified for any alternative mechanism. Custom cryptography or a custom authentication framework is outside the design.
|
||||
The normalized authenticated identity contains a stable application account identifier and a trusted role: Patient or HealthcareProfessional. The token either carries this validated identity or securely references it, depending on the selected format. Client-supplied role values are never authoritative.
|
||||
Patient health information must not be included in tokens. Patient ownership and professional assignments remain application access data, separate from token contents, and are evaluated by authorization policies.
|
||||
4. Access policy
|
||||
Actor and state Permitted access Restriction
|
||||
Unauthenticated client Submit credentials to the login endpoint and read general US-15 measurement guidance. No patient information or professional assignment lists.
|
||||
Patient account without a profile Create its own initial profile under US-01. Cannot select another patient's identity or access another patient's data.
|
||||
Patient account with a profile Perform operations permitted by the existing stories on its own profile, observations, insights and overview. Cannot create a second profile or use professional-only operations.
|
||||
Healthcare professional List its own assigned patients; read their profiles, observations, insights and overviews. Cannot access unassigned patients or create, modify or delete patient information.
|
||||
|
||||
|
||||
An authenticated identity alone is not sufficient for access. The requested operation and the actual patient associated with the resource must also be checked.
|
||||
For requests addressed by an observation identifier or another resource identifier, the gateway must establish the actual owning patient through documented service APIs. A patient identifier supplied by the client is not proof of ownership. No direct access to another service's database or reliance on shared process memory is permitted.
|
||||
Rejected requests must not return protected patient information or change patient data. Existing retrieval requirements continue to govern genuinely missing information after access has been established. An empty professional assignment list must not expose other patients.
|
||||
5. Initial profile creation and persistent association
|
||||
A patient account and a patient profile are distinct concepts. A pre-created patient account may exist before its profile. Once profile creation succeeds, that account is associated with exactly one generated patient identifier.
|
||||
The association must derive from the authenticated account, not an account identifier chosen by the caller. An account with an existing profile cannot create another profile or replace its association through profile creation.
|
||||
The association must survive process restarts. Repeated or concurrent creation attempts must not result in multiple profiles associated with the same account. The implementation proposal must explain recovery if profile creation succeeds but recording the association fails, so retries do not silently create duplicate or inaccessible profiles.
|
||||
These are required outcomes, not a choice of persistence technology or cross-service coordination mechanism. The owning component, persistence location and recovery mechanism remain open. Static external mappings alone do not satisfy the complete creation lifecycle.
|
||||
US-01 and US-13 now define zero profiles before initial creation and exactly one afterwards. US-14 defines professional assignments. See the consolidated numbered files in Docs/Requirements. Retries after completed creation report the existing-profile condition; interrupted operations must recover without duplicate or inaccessible profiles.
|
||||
6. Responsibility and deployment boundaries
|
||||
Use standard ASP.NET Core extension points so controllers and access policies consume normalized identities rather than passwords or token-format details. This decision does not introduce a new identity microservice or shared authentication implementation library across services.
|
||||
Services remain independently runnable processes and may be deployed on separate machines. The deployment must prevent untrusted clients from reaching protected service operations through a route that bypasses gateway authorization. Arbitrary client-supplied identity headers must not establish trusted identity.
|
||||
The concrete protection of gateway-to-service access is an open deployment decision. It must be documented before claiming that gateway-only enforcement satisfies the access requirements. It must preserve the established independent-service boundaries.
|
||||
Actual credentials, signing or protection keys, tokens and authorization headers must not be committed to the repository or written to logs. Provide safe example configuration and load operational secrets externally. Use HTTPS for client login and authenticated requests. Document any additional transport requirements in the deployment decision.
|
||||
7. Replaceability
|
||||
A future identity provider should replace credential validation and token integration without requiring a redesign of patient ownership or professional-assignment policies.
|
||||
Map the provider's validated identity explicitly to the stable application account identifier and trusted application role. Do not assume a provider subject automatically equals an application account identifier.
|
||||
Provider replacement may change the client's login flow and credential transport. Replaceability does not promise an unchanged client. A replacement must not silently enable the prototype mechanism as a fallback.
|
||||
8. Thesis measurement implications
|
||||
Authentication and authorization are part of the implemented system and its measured workload. Using login followed by token validation avoids deliberately repeating password verification for every business operation. This is a design rationale, not evidence of an energy reduction; any energy effect remains to be measured.
|
||||
Before baseline measurement, record the authentication implementation, token lifetime, validation settings, account and role mix, patient assignments, login frequency and treatment of expiration. State whether login is included in the measured workload or occurs during setup. Account for re-authentication if tokens expire during a run.
|
||||
Keep these factors consistent across compared architectural variants unless an explicitly scoped experimental change concerns them. Preserve equivalent access behaviour in all variants. Do not substitute a test authentication handler in measured runs while describing results as those of the implemented authentication mechanism.
|
||||
Authentication-related work can affect bottlenecks and measured energy, even when configuration is identical. Interpret results in the context of the selected workload; lower authentication latency or CPU use alone does not demonstrate lower energy consumption.
|
||||
9. Verification and exclusions
|
||||
Automated verification must cover the US-13 and US-14 acceptance criteria, including valid login, invalid credentials, missing/invalid/expired tokens, cross-patient access attempts, professional assignment restrictions and prohibited professional writes. Include resource-identifier ownership checks and verify that rejected operations do not disclose or modify patient data.
|
||||
Verify initial profile creation, rejection of subsequent creation, persistence of the account association, and the agreed retry/concurrency behaviour. Verify gateway-bypass protection in the intended deployment. Check that authorization policies behave equivalently when a test handler supplies the same normalized identity; this is a replaceability test, not a measurement configuration.
|
||||
Outside scope: public registration, password recovery, multifactor authentication, account-administration interfaces, refresh tokens, professional credential verification, assignment-management interfaces, consent workflows, emergency access and professional editing of patient information. No full production identity-provider integration is required.
|
||||
10. Open implementation decisions
|
||||
Decision Required follow-up
|
||||
Token format and library Propose a standard implementation, validation rules, client transport and necessary key or state management. JWT is not preselected.
|
||||
Token lifetime Select and document a lifetime together with experimental login and expiration behaviour.
|
||||
Account-to-patient persistence Identify the owning component and persistent storage without silently adding a service or violating database ownership.
|
||||
Profile creation consistency Specify duplicate prevention and recovery across profile creation and association recording.
|
||||
Gateway-to-service protection Specify a concrete deployment control that works across separate machines.
|
||||
API contract details Reconcile endpoint contracts and rejection responses with the repository's existing conventions and acceptance criteria.
|
||||
|
||||
|
||||
The agent may propose these details, but this decision record does not approve an unselected token format or undocumented architectural additions. Update the relevant requirements and architecture records when the remaining choices are accepted.
|
||||
|
||||
|
||||
The prototype shall implement the minimum authentication, ownership, profile-creation consistency, and deployment protection needed to satisfy US-01, US-13, and US-14. The implementation may select and document simple, established mechanisms within the agreed architecture. Production hardening and capabilities outside these user stories are deferred until a decision is made to develop the system further.
|
||||
Reference in new issue
Block a user