| | | 1 | | using ArturRios.Util.Http; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Heimdall.Shared.Messages; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Maps each <see cref="ErasureMessages" /> value to its HTTP status code, following UC-42's |
| | | 7 | | /// flows. Passed to the response resolver. |
| | | 8 | | /// </summary> |
| | | 9 | | public static class ErasureMessageMap |
| | | 10 | | { |
| | 1 | 11 | | public static readonly IReadOnlyDictionary<string, int> StatusCodes = |
| | 1 | 12 | | DataAccessMessageMap.CombinedWith(new Dictionary<string, int> |
| | 1 | 13 | | { |
| | 1 | 14 | | // UC-42 main flow — request recorded, identity suspended. |
| | 1 | 15 | | [ErasureMessages.ErasureRequested] = HttpStatusCodes.Ok, |
| | 1 | 16 | | // AF-42d — recorded and running, but blocked. Still a success: the request was accepted, |
| | 1 | 17 | | // and answering 4xx would tell the subject their right had been refused when it has not. |
| | 1 | 18 | | [ErasureMessages.ErasureRequestedButBlocked] = HttpStatusCodes.Ok, |
| | 1 | 19 | | // AF-42a — the re-authentication credential failed: a Google User's ID token, and a |
| | 1 | 20 | | // person's password, which shares every re-authentication's refusal (FR-AU-13). |
| | 1 | 21 | | [ErasureMessages.CredentialNotAccepted] = HttpStatusCodes.Unauthorized, |
| | 1 | 22 | | [AuthMessages.PasswordOrCodeIncorrect] = HttpStatusCodes.Unauthorized, |
| | 1 | 23 | | // AF-42b — the token names no identity this endpoint can act for. |
| | 1 | 24 | | [ErasureMessages.NotEligible] = HttpStatusCodes.Forbidden, |
| | 1 | 25 | | // AF-42c — already requested. |
| | 1 | 26 | | [ErasureMessages.ErasureAlreadyRequested] = HttpStatusCodes.Conflict, |
| | 1 | 27 | | // UC-41 — the copy was produced. |
| | 1 | 28 | | [ErasureMessages.DataExported] = HttpStatusCodes.Ok, |
| | 1 | 29 | | // UC-44 — restriction imposed. |
| | 1 | 30 | | [ErasureMessages.ProcessingRestricted] = HttpStatusCodes.Ok, |
| | 1 | 31 | | [ErasureMessages.ProcessingAlreadyRestricted] = HttpStatusCodes.Conflict, |
| | 1 | 32 | | [ErasureMessages.RestrictionGroundUnknown] = HttpStatusCodes.BadRequest, |
| | 1 | 33 | | // UC-45 — restriction lifted. |
| | 1 | 34 | | [ErasureMessages.RestrictionLifted] = HttpStatusCodes.Ok, |
| | 1 | 35 | | [ErasureMessages.NotRestricted] = HttpStatusCodes.NotFound, |
| | 1 | 36 | | // Art. 18(3) makes the notification a precondition, so a delivery failure is a refusal |
| | 1 | 37 | | // rather than something to swallow. |
| | 1 | 38 | | [ErasureMessages.RestrictionLiftNotificationFailed] = HttpStatusCodes.ServiceUnavailable, |
| | 1 | 39 | | // NFR-25 — restore reconciliation. |
| | 1 | 40 | | [ErasureMessages.ErasuresReapplied] = HttpStatusCodes.Ok, |
| | 1 | 41 | | [ErasureMessages.NoSubjectsToReapply] = HttpStatusCodes.BadRequest, |
| | 1 | 42 | | // UC-43 read. |
| | 1 | 43 | | [ErasureMessages.ErasureRequestsRetrieved] = HttpStatusCodes.Ok |
| | 1 | 44 | | }); |
| | | 45 | | } |