Interface IAuthorizationResult
Represents the result of an authorization check for a message.
public interface IAuthorizationResult
- Extension Methods
Remarks
Authorization results indicate whether the current user or context has permission to process a specific message. This is used by the authorization middleware to enforce security policies before message handlers are invoked. Key features include:
- Boolean authorization status indicator
- Failure message for unauthorized access attempts
- Integration with ASP.NET Core authorization policies
- Support for role-based and claims-based authorization
Implementations should provide meaningful failure messages that help with debugging while avoiding sensitive information disclosure in production environments.
Properties
FailureMessage
Gets the failure message when authorization is denied.
string? FailureMessage { get; }
Property Value
Remarks
Contains a human-readable description of why authorization failed. Should be null when IsAuthorized is true. In production environments, consider limiting the detail in failure messages to prevent information disclosure that could aid attackers.
IsAuthorized
Gets a value indicating whether the authorization check passed.
bool IsAuthorized { get; }
Property Value
Remarks
When true, the current security context has permission to process the message and processing can continue. When false, the message should be rejected and the FailureMessage should provide details about the denial.