| | | 1 | | using ArturRios.Util.Http; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Heimdall.Shared.Messages; |
| | | 4 | | |
| | | 5 | | /// <summary>Status codes for <c>ApplicationTokenController</c>'s messages (UC-56, UC-57).</summary> |
| | | 6 | | public static class ApplicationTokenMessageMap |
| | | 7 | | { |
| | 2 | 8 | | public static readonly IReadOnlyDictionary<string, int> StatusCodes = |
| | 2 | 9 | | DataAccessMessageMap.CombinedWith(new Dictionary<string, int> |
| | 2 | 10 | | { |
| | 2 | 11 | | // UC-56 main flow — token issued. |
| | 2 | 12 | | [ApplicationTokenMessages.TokenIssued] = HttpStatusCodes.Ok, |
| | 2 | 13 | | // AF-56a — a field is missing or the secret is over-long. |
| | 2 | 14 | | [ApplicationTokenMessages.ApplicationIdRequired] = HttpStatusCodes.BadRequest, |
| | 2 | 15 | | [ApplicationTokenMessages.ScopeIdRequired] = HttpStatusCodes.BadRequest, |
| | 2 | 16 | | [ApplicationTokenMessages.SecretRequired] = HttpStatusCodes.BadRequest, |
| | 2 | 17 | | [ApplicationTokenMessages.SecretTooLong] = HttpStatusCodes.BadRequest, |
| | 2 | 18 | | // AF-56b — any refusal: unknown, revoked or expired secret, another application's, a |
| | 2 | 19 | | // deleted application or scope, or the wrong scope. One status, one message. |
| | 2 | 20 | | [ApplicationTokenMessages.CredentialsNotAccepted] = HttpStatusCodes.Unauthorized, |
| | 2 | 21 | | // UC-57 main flow — the token stands. |
| | 2 | 22 | | [ApplicationTokenMessages.TokenAccepted] = HttpStatusCodes.Ok, |
| | 2 | 23 | | // AF-57a — any refusal: no or malformed token, wrong signature, issuer, audience or kind, |
| | 2 | 24 | | // expired, or an application, scope or credential no longer live. One status, one message. |
| | 2 | 25 | | [ApplicationTokenMessages.TokenNotAccepted] = HttpStatusCodes.Unauthorized |
| | 2 | 26 | | }); |
| | | 27 | | } |