| | | 1 | | using AsiBackbone.Core.Handshakes; |
| | | 2 | | |
| | | 3 | | namespace AsiBackbone.AspNetCore.Handshakes; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Provides host-overridable defaults for building acknowledgment challenges from Core governance decisions. |
| | | 7 | | /// </summary> |
| | | 8 | | public sealed class AsiBackboneAcknowledgmentChallengeOptions |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets or sets the default acknowledgment code required before continuing. |
| | | 12 | | /// </summary> |
| | 271 | 13 | | public string RequiredAcknowledgmentCode { get; set; } = "ACKNOWLEDGE_RESPONSIBILITY"; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets or sets the default acknowledgment text shown by host applications. |
| | | 17 | | /// </summary> |
| | 170 | 18 | | public string RequiredAcknowledgmentText { get; set; } = |
| | 83 | 19 | | "I understand the responsibility notice and acknowledge that this operation may continue."; |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Gets or sets the default risk level associated with acknowledgment challenges. |
| | | 23 | | /// </summary> |
| | 40 | 24 | | public LiabilityHandshakeRiskLevel RiskLevel { get; set; } = LiabilityHandshakeRiskLevel.Unspecified; |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Gets or sets the optional host-defined default risk category. |
| | | 28 | | /// </summary> |
| | 40 | 29 | | public string? RiskCategory { get; set; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Gets or sets a value indicating whether the challenge should expose the Core reason message. |
| | | 33 | | /// </summary> |
| | 133 | 34 | | public bool IncludeReasonMessage { get; set; } = true; |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Gets or sets a value indicating whether trace identifiers may be exposed in challenge payloads. |
| | | 38 | | /// </summary> |
| | 50 | 39 | | public bool IncludeTraceId { get; set; } |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Gets or sets a value indicating whether policy version and policy hash values may be exposed in challenge payloa |
| | | 43 | | /// </summary> |
| | 94 | 44 | | public bool IncludePolicyMetadata { get; set; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Validates the configured challenge options. |
| | | 48 | | /// </summary> |
| | | 49 | | /// <exception cref="InvalidOperationException">Thrown when a required challenge option is invalid.</exception> |
| | | 50 | | public void Validate() |
| | | 51 | | { |
| | 132 | 52 | | if (string.IsNullOrWhiteSpace(RequiredAcknowledgmentCode)) |
| | | 53 | | { |
| | 10 | 54 | | throw new InvalidOperationException("A required acknowledgment code must be configured."); |
| | | 55 | | } |
| | | 56 | | |
| | 122 | 57 | | if (string.IsNullOrWhiteSpace(RequiredAcknowledgmentText)) |
| | | 58 | | { |
| | 8 | 59 | | throw new InvalidOperationException("Required acknowledgment text must be configured."); |
| | | 60 | | } |
| | 114 | 61 | | } |
| | | 62 | | } |