Class CapabilityGrantValidationResult
- Namespace
- AsiBackbone.Core.CapabilityGrants
- Assembly
- AsiBackbone.Core.dll
Represents the outcome of validating a capability grant, including the policy action the host should take.
public sealed class CapabilityGrantValidationResult
- Inheritance
-
CapabilityGrantValidationResult
- Inherited Members
Remarks
Hosts should gate execution on ShouldAllow rather than IsValid alone, and act on Action for failed results, because some failures defer or require acknowledgment instead of denying.
Properties
Action
Gets the policy action the host should take for this result.
public VerificationPolicyAction Action { get; }
Property Value
Category
Gets the validation category that describes why the grant passed or failed.
public CapabilityGrantValidationCategory Category { get; }
Property Value
FailureCode
Gets the machine-readable failure code, such as capability.expired, when validation failed.
public string? FailureCode { get; }
Property Value
FailureMessage
Gets the human-readable failure message, when one was supplied.
public string? FailureMessage { get; }
Property Value
IsValid
Gets a value indicating whether the grant satisfied every configured validation check.
public bool IsValid { get; }
Property Value
SafeMetadata
Gets non-secret grant and outcome metadata, such as issuer, audience, policy action, and failure code, that is safe to log or attach to audit records.
public IReadOnlyDictionary<string, string> SafeMetadata { get; }
Property Value
ShouldAllow
Gets a value indicating whether the host may proceed with the governed operation.
public bool ShouldAllow { get; }
Property Value
Status
Gets the result status, either Valid or Failed.
public string Status { get; }
Property Value
TokenId
Gets the token identifier of the validated grant.
public string TokenId { get; }
Property Value
Methods
Failed(CapabilityGrant, CapabilityGrantValidationCategory, VerificationPolicyAction, string, string?)
Creates a failed result with the category and policy action the host should apply.
public static CapabilityGrantValidationResult Failed(CapabilityGrant grant, CapabilityGrantValidationCategory category, VerificationPolicyAction action, string failureCode, string? failureMessage = null)
Parameters
grantCapabilityGrantThe grant that failed validation.
categoryCapabilityGrantValidationCategoryThe validation category that describes the failure.
actionVerificationPolicyActionThe policy action the host should take, such as deny, defer, or require acknowledgment.
failureCodestringThe machine-readable failure code.
failureMessagestringAn optional human-readable failure message.
Returns
- CapabilityGrantValidationResult
A failed result.
Exceptions
- ArgumentNullException
grantorfailureCodeis null.- ArgumentException
failureCodeis empty or whitespace.- ArgumentOutOfRangeException
categoryoractionis not a defined value.
Valid(CapabilityGrant)
Creates a successful result that allows the governed operation.
public static CapabilityGrantValidationResult Valid(CapabilityGrant grant)
Parameters
grantCapabilityGrantThe grant that passed validation.
Returns
- CapabilityGrantValidationResult
A valid result with Allow.
Exceptions
- ArgumentNullException
grantis null.