Consent before login
- Consent before login
- Requirements
- Use cases
- Handling installation id
- Link user with a device
- Agreements synchronization
- Register an agreement
- Get list of latest agreements
- Get missing agreements
- Check if a consent has been agreed
- Tracking before login
- Integrity check
- Data deletion (consent expiry)
- Support tools : specificities
- Edge cases
- FAQ
v4 Changelog
- Update components overview diagram to reflect data flow
- Add section regarding responsibility isolation and fault tolerance
- Specify ordering of synchronizations (anon to user, multi-devices, user to anon)
- Add info regarding "get missing agreements" algorithm at post-login
- Update table diagrams, move link with hash table to installation_agreement, remove "sync_enabled" flag
- Improve multi-device synchronization to handle all possible logout cases
- Add installation_hash and user_hash
Glossary
Consent : Description of data collection and usage by a specific feature in the app. A consent typically has a title, a content. A consent can be plugin specific.
Agreement, Agreement : The approval or denial decided by the user regarding a specific consent.
Installation id : Previously named installation ID. Instance within the app is ready to handle one specific user on a specific device. This time includes before effective login. When a new user is logged into the app and actively resets the device, the installation identifier must be reset.
Context
NAVIDA should comply with mandatory regulations regarding data collection and tracking consent. While these topics are already handled when logged in, AOK also needs to collect consent before login.
The approach described here would merge consent before and after login into one unified solution to record agreements from the user, or from a device.
- Consent given before login is anonymous and should be recorded. At some point, when the user actually logged in, reconciliation should be performed between pre-login and post-login consents.
- The most recent consent overtake previous ones. Even if the consent has actually been declined.
- AOKs need to prove when the consent has been proposed, when it has been accepted and also what has been accepted.
- A consent can not, in no possible ways, be deleted. Soft deletion should be a rule of thumb and considered as a consent revocation.
More details regarding requirements can be found here (German) : https://confluence-extern.plus.aok.de/display/PLATT/Requirements+Tracking+and+Consent+before+login
About installation identifier
Previous documentation mentionned an INSTALLATION_ID
. In practice, this ID is closer to a installation identifier, since it might be reset while keeping the app installed (when another user try to login after a preceding one on the same device, for instance)
Components overview
Domain model and global diagrams
Entity relation model
Database model suggestion for consent microservice
Important: AGREEMENT and INSTALLATION_AGREEMENTS must have specific read/write permissions :
- DELETE is impossible. The only exception is when the consent expires. This should be handled in an isolated service/database user.
- UPDATE is impossible
- Only INSERT is possible
For non-anon databases
For anon database
Requirements
Core
- Users can accept or reject a consent. Such process is called agreement.
- The CMT must give the support employee the same options for creating and processing the consent texts before login as the current Navida consent texts.
- The agreement must be stored in a logged, timestamped, audit-proof and unchangeable manner.
- The agreement must have a signature that prooves it has been signed from a specific content, and prooves if this consent has been changed subsequently.
- The signature (or hash) must be as unchangeable as the agreement itself.
Anonymous consents / consents before login
- Consents made before login should be stored in a dedicated database schema.
- They should follow the same access restrictions as consents after login.
- These consents must be linked to an installation/installation identifier.
- They must not be linked directly with a User ID.
- The installation ID is kept until a new user tries to log inside the app. When this happen, the app data should be reset and the installation id renewed.
Login
- Consents provided before login (in anonymous mode) should be copied to user consents.
Multi-device
- For the same user, consent should be synced with all logged in devices.
- Multi-device works only when user is linked with the app, which means the user is authed inside the app, with successful biometrics.
- If user is unable to authenticate/validate its biometrics, user should be considered as anon and device should be excluded from synchronization.
Logout
- When logging out, the installation id is preseved.
- At logout, the device should have the latest consents provided by the user.
- Once logged out, the device is no longer in sync with user consents.
- When logging back again, the device is re-synced with all device from users.
Support agents
- Support agents can view user agreements.
- They can reject consent on behalf of a user. However, it does not mean they can delete a previous agreement. --> They can only create a new reject agreement on behalf of a user.
- They can also view agreements for a specific installation ID
- They can create a rejection agreement for a given installation ID. They can not create acception agreements
User Consent Management
- User can view approved/rejected consents inside App > Settings > Consents
- User can give a new agreement on consents in Consents settings (i.e. : provide a new agreement, not updating the previous one)
Data transparency
- If user agreed on tracking, User can view Adobe Analytics tracking ID in Consents settings
- User can view Installation ID in the same screen.
- User can view User ID in the same screen.
Agreement revocation
- Revocation does not mean delete consent. It does mean we create a new rejected agreement.
Content update on consent
- When the content of a consent is updated, its version should be incremented.
- When a new version of a consent is available, a new agreement should be asked to the user if and only if they haven't rejected the previous version.
- You can check following use case : Get missing consents
Installation identifier
- The installation identifier should be a unique identifier (UUID-v7)
- This installation id must be persisted on device.
- Installation id must be first set on first app launch.
- The installation id must be renewed when another user tries to log inside an app already linked to a previous user (Deduced from The CMT/App must ensure that only a new user who has freshly installed NAVIDA for the app installation first lands on the Navida generic onboarding screen and then on the consent before login page. Users who have already viewed the Navida Intro Page in the past and/or have been logged in will not see the consent in front of the login screen)
Safety
- Any public endpoints must be secured in ways to prevent attacks and data tampering.
Data hosting
- Anonymous-only agreements (so agreements proceeded before login) should be stored on AOK PLUS side, inside a specific schema common for all AOKs.
- Agreements after login are stored depending on the user region : BaWü has its own database, PLUS has its own.
- Link between user ids and installation ids should be stored on the user region's database.
Responsibility isolation and fault tolerance
Anonymous consents should always be handled by the anonymous consent microservice, while user consents are handled by the user consent microservice.
When synchronization occurs between anon and user agreements, the two microservices are able to provide to each other the information. To do so, they should use a dedicated Kafka consumer group.
This use of Kafka preserves isolation between anonland and userland. But it also improves fault tolerance and horizontal scaling by acting as a queue.
Kafka messaging diagram
Use cases
Handling installation id
- Generated on client side.
- Should be a UUIDv7
- Stored on device, in keychain
- First generation on app boot. Then regenerated when a new user logs in and uses the reset feature.
Link user with a device
The idea is simple : after login, we register the user id associated with the current installation id. It should also calculate the latest agreements for all consents, and reference them in all installations of the user.
The endpoint proposing this linking should absolutely be private.
To do so, we should trigger a post-login request to the consent microservice, which will store this link in a dedicated database.
Notice: Our proposal process does not add a user id on the existing agreements. It only provides a way to re-link anonymous agreements with the user after they have logged in.
It could also be thinkable to update agreement and set user id. However, since integrity of this agreement is valuable, we prefer to keep agreement unchanged and have this link made in another table. This process would be compatible with insert-only permissions on agreements table.
Example with BaWü user :
Details of "Link user with device"
Agreements synchronization
Agreements can divided according :
- The login status of the user (Anon/User).
- The device the agreement has been provided on, for the same user (Multi-device).
These two criterias have direct consequences on data storage :
- When user is anonymous, agreement is handled by AOK PLUS. When logged-in, agreement is handled by the user's Krankenkasse.
- Consents that applies on anonymous also applies when logged-in, and vice versa: Agreements should be copied from anonymous namespace to the appropriate region, depending on user region.
- Once logged in, the user shares the same agreements over all their devices.
To solve these multi-DB, multi-device solution, we propose three different types of synchronization, trigerred on two specific events :
On login :
- Link device with user
- Import anon agreements to user database (anon ➡️ user)
- Synchronize device agreements
- Push device agreements to anon database (user ➡️ anon)
On providing new agreement :
- Push device agreements to anon database (user ➡️ anon)
Ordering of synchronizations on login
The order defined above should be respected to stay up-to-date with the latest agreements provided, especially when :
A device is no longer logged-in (including failure in providing biometrics).
In this case, the device should be considered anon again, and still have the latest agreements on anon consents.
User logs in with a brand new device.
This device will create new agreements on consents required before login. Therefore, these consents should be imported as the latest agreements of the user while logging in.
User provided new anon consent on logged-in device A, log in device B
In such scenario, device B should import agreement from device A, then push this agreement in the anonymous database to make sure the device still has the agreement when the user logs out (volontarily or not).
Anon ↔️ User sync
Login status can change on two occasions : while logging in or while user is providing new consent agreements. For both events we should synchronize agreements between anon and non-anon databases.
This synchronization is based on the installation ID of the device and not the user ID, since this concept does not exists on anon database.
Important : Agreements are copied but all their attributes should be kept unchanged. Even the author type, even the timestamp. Data should still be capable of generating the agreement hash.
Anon ➡️ User (used only on login)
User ➡️ Anon
Multi-device sync
As you may have guessed, providing consent before login makes the agreements "device-centric". However, agreements should still be user-centric.
That means, if users have multiple devices, they expect the agreements to be mutualized across devices. If a user is no longer authenticated on a device, mutualization should stop right away.
Also, agreements are be immutable. That means you should not copy them from a device to another, you should not update them either. Otherwise, we might lose our ability to proove their origin/authenticity.
To fit these constraints, we decided to create a many-to-many relationship between devices/installations and agreements. That means an agreement can be referenced by one or multiple devices, which belongs to a user (or not, yet).
When the user logs inside the app on a specific device (A) (including providing biometrics or refreshing the access token), the agreements from all other devices should be imported. If there is a device (B) with later agreements, these agreements should be linked to the device (A) when user logs in device (A).
Also, and first of all : a synchronization request can only come from an authenticated device. The id of this device should be provided, in order to re-enable sync to this device if it has been disabled before (because of a logout for instance).
Register an agreement
NB: AOK should keep an integrity proof of this consent.
Agreements are the most sensitive information in this concept. To make them as immutable as possible, we must clearly distinguish :
- The author of an agreement, which could be anon, user or support. Author type and identifier is part of the agreement itself and must be stored.
- The devices referencing an agreement. These devices will rely on the agreements while not necessarily be the one on which the decision has been made.
When we talk about registering an agreement, we are refering to topic no. 2.
The endpoint registering agreement should be a semi-public endpoint. That means auth is optinal and will provide additional info on user. If not, we fallback to an anonymous user..
- If the user is authenticated and consent cannot be anonymous, author type will be USER.
- If not, author type will be ANON.
In both cases, agreement will be saved and referenced by at least one device : the one we just used. If user is connected, agreements synchronization should occur just after.
Sequence diagram
Please note this sequence diagram could occur before or after login. The process would be the same. The differences would rely in data :
- Consent before login would not have any user ID provided.
- Consent after login would have both user and sesion ID.