Class EndpointCapabilityGrantValidatorContract
Reusable contract fixture for IEndpointCapabilityGrantValidator implementations.
public abstract class EndpointCapabilityGrantValidatorContract
- Inheritance
-
EndpointCapabilityGrantValidatorContract
- Inherited Members
Methods
ConfigureKnownInvalidCapabilityGrant(HttpContext, EndpointGovernanceDescriptor)
Allows derived contracts to place a known-invalid grant, token, header, or request state into the context.
protected virtual void ConfigureKnownInvalidCapabilityGrant(HttpContext httpContext, EndpointGovernanceDescriptor descriptor)
Parameters
httpContextHttpContextThe HTTP context supplied to the validator.
descriptorEndpointGovernanceDescriptorThe endpoint governance descriptor supplied to the validator.
CreateCapabilityDescriptor()
Creates a descriptor containing a capability requirement for the invalid-grant contract path.
protected virtual EndpointGovernanceDescriptor CreateCapabilityDescriptor()
Returns
- EndpointGovernanceDescriptor
The descriptor supplied to the validator implementation under test.
CreateCurrentDecision()
Creates the current decision supplied to the validator implementation under test.
protected virtual GovernanceDecision CreateCurrentDecision()
Returns
- GovernanceDecision
The current governance decision.
CreateHttpContext()
Creates the HTTP context supplied to the validator implementation under test.
protected virtual HttpContext CreateHttpContext()
Returns
- HttpContext
The HTTP context to validate with.
CreateValidator()
Creates the capability-grant validator implementation under test.
protected abstract IEndpointCapabilityGrantValidator CreateValidator()
Returns
- IEndpointCapabilityGrantValidator
The capability-grant validator implementation to validate.
VerifyKnownInvalidCapabilityGrantDoesNotAllowAsync(CancellationToken)
Verifies that a known invalid capability-grant scenario does not produce an allow decision.
public ValueTask<GovernanceDecision> VerifyKnownInvalidCapabilityGrantDoesNotAllowAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token that can cancel the contract validation.
Returns
- ValueTask<GovernanceDecision>
The verified governance decision.