Innovabit.DotNet.Interceptors.Authorization.Abstractions
2.0.117
dotnet add package Innovabit.DotNet.Interceptors.Authorization.Abstractions --version 2.0.117
NuGet\Install-Package Innovabit.DotNet.Interceptors.Authorization.Abstractions -Version 2.0.117
<PackageReference Include="Innovabit.DotNet.Interceptors.Authorization.Abstractions" Version="2.0.117" />
<PackageVersion Include="Innovabit.DotNet.Interceptors.Authorization.Abstractions" Version="2.0.117" />
<PackageReference Include="Innovabit.DotNet.Interceptors.Authorization.Abstractions" />
paket add Innovabit.DotNet.Interceptors.Authorization.Abstractions --version 2.0.117
#r "nuget: Innovabit.DotNet.Interceptors.Authorization.Abstractions, 2.0.117"
#:package Innovabit.DotNet.Interceptors.Authorization.Abstractions@2.0.117
#addin nuget:?package=Innovabit.DotNet.Interceptors.Authorization.Abstractions&version=2.0.117
#tool nuget:?package=Innovabit.DotNet.Interceptors.Authorization.Abstractions&version=2.0.117
Innovabit.DotNet.Interceptors.Authorization.Abstractions
Declarative authorization for Innovabit.DotNet.Interceptors
via [Authorized] and [RequirePermission]. This is the provider-agnostic base: it ships the
interceptor, the attributes and the IAuthorizationEvaluator abstraction. Pick a provider — or write
one — to decide how a caller is checked:
Innovabit.DotNet.Interceptors.Authorization.AspNetCore—HttpContext.User, policies, roles and permission claims.
Why on the service and not only the controller
A rule on a controller action holds for calls that arrive over HTTP. Put it on the service and it holds for all of them: the same operation invoked from a background job, a message handler, a gRPC endpoint or another service is checked the same way, and the rule lives next to the thing it protects.
Usage
services
.AddInterceptors()
.AddAspNetCoreAuthorization(); // or .AddAuthorizationEvaluator<MyEvaluator>()
services.AddScopedWithInterception<IRefundService, RefundService>();
public class RefundService : IRefundService
{
[Authorized(Policy = "finance")]
[RequirePermission("orders.refund")]
public Task<Refund> RefundAsync(Guid orderId, CancellationToken cancellationToken) { ... }
}
The attributes
| Meaning | |
|---|---|
[Authorized] |
The caller must be authenticated. Policy and Roles narrow it further; the caller needs any one of the roles. |
[RequirePermission("x")] |
The caller must hold that permission. Apply it more than once to require all of them. |
Both work on a method and on a class, where they apply to every method. A method-level
[Authorized] replaces the class's, so a method can pick its own policy; [RequirePermission]
accumulates, so a method can never shed a permission the class demands. Put them on the
implementation, not the interface — the interceptor reads the concrete method the proxy stands in
front of.
Named
[Authorized], not[Authorize], on purpose: a web application usually hasMicrosoft.AspNetCore.Authorizationin scope too, and two attributes with the same short name in one file is an ambiguity nobody needs.
What a refusal looks like
| Exception | When | HTTP equivalent |
|---|---|---|
AuthenticationRequiredException |
There is no identified caller at all | 401 — signing in may fix it |
AuthorizationDeniedException |
The caller is known and does not qualify | 403 — signing in again will not |
Both derive from AuthorizationException, so you can catch either the distinction or the family.
The message names the operation and what it required. The method is never reached on a refusal.
Ordering
The interceptor runs at InterceptorOrders.Authorization (75): inside auditing (50) and outside
validation (100). Both positions are deliberate — a refused call is still recorded as an attempt,
and the answer to "may you call this" never depends on whether the arguments happen to be valid.
Writing an evaluator
Only your application knows where the caller comes from, so that is what a provider supplies:
public sealed class WorkerAuthorizationEvaluator : IAuthorizationEvaluator
{
public ValueTask<AuthorizationOutcome> EvaluateAsync(
AuthorizationRequirement requirement, CancellationToken cancellationToken = default)
=> new(requirement.Permissions.All(CurrentJob.Grants.Contains)
? AuthorizationOutcome.Allow()
: AuthorizationOutcome.Deny("the job does not grant that permission"));
}
services.AddInterceptors().AddAuthorizationEvaluator<WorkerAuthorizationEvaluator>();
Return an outcome rather than throwing: the interceptor turns it into the exception, so the message
reads the same whichever evaluator produced it. Unauthenticated and Deny are separate precisely
so the caller can tell the two apart.
Registering the interceptor without an evaluator makes resolving an intercepted service fail. That is on purpose: a security check that silently does nothing is worse than no check at all.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.117)
-
net8.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.117)
-
net9.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.117)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Innovabit.DotNet.Interceptors.Authorization.Abstractions:
| Package | Downloads |
|---|---|
|
Innovabit.DotNet.Interceptors.All
Meta-package: every interceptor concern in the suite (logging, validation, caching, notifications, telemetry, audit, authorization, rate limiting, coordination, feature gates, transactions, retry/timeout/circuit breaker/fallback) in one reference. Providers are separate packages — pick the ones you use. |
|
|
Innovabit.DotNet.Interceptors.Authorization.AspNetCore
ASP.NET Core authorization provider for interceptor-based [Authorized] and [RequirePermission] methods. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.117 | 0 | 10/31/2026 |
| 2.0.116 | 105 | 10/26/2026 |
| 2.0.115 | 125 | 10/17/2026 |
| 2.0.114 | 126 | 10/10/2026 |
| 2.0.113 | 138 | 10/3/2026 |
| 2.0.112 | 137 | 9/28/2026 |
| 2.0.111 | 125 | 9/28/2026 |
| 2.0.110 | 130 | 9/27/2026 |
| 2.0.109 | 132 | 9/26/2026 |
| 2.0.108 | 126 | 9/26/2026 |
| 2.0.107 | 135 | 9/26/2026 |
| 2.0.106 | 121 | 9/25/2026 |
| 2.0.105 | 134 | 9/25/2026 |
| 1.0.0.104 | 108 | 9/25/2026 |
| 1.0.0.103 | 104 | 9/25/2026 |