| | | 1 | | namespace AsiBackbone.Core.CapabilityGrants; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Provides authoritative subject and operation expectations for capability-grant execution validation. |
| | | 5 | | /// </summary> |
| | | 6 | | public sealed class CapabilityGrantBindingExpectations |
| | | 7 | | { |
| | 5 | 8 | | private CapabilityGrantBindingExpectations(string subjectId, string? operationName) |
| | | 9 | | { |
| | 5 | 10 | | SubjectId = subjectId.Trim(); |
| | 5 | 11 | | OperationName = string.IsNullOrWhiteSpace(operationName) ? null : operationName.Trim(); |
| | 5 | 12 | | } |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets the authenticated subject that must match the grant. |
| | | 16 | | /// </summary> |
| | | 17 | | public string SubjectId { get; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the requested operation that must match the grant, when required. |
| | | 21 | | /// </summary> |
| | | 22 | | public string? OperationName { get; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Creates execution-binding expectations from authoritative host context. |
| | | 26 | | /// </summary> |
| | | 27 | | public static CapabilityGrantBindingExpectations Create(string subjectId, string? operationName = null) |
| | | 28 | | { |
| | 8 | 29 | | ArgumentException.ThrowIfNullOrWhiteSpace(subjectId); |
| | 5 | 30 | | return new CapabilityGrantBindingExpectations(subjectId, operationName); |
| | | 31 | | } |
| | | 32 | | } |