Fast.JwtBearer
Reference source version 3.5.51; targets: net8.0;net9.0;net10.0. Depends on Fast.Runtime 3.5.37 and centrally managed ASP.NET Core JwtBearer 8.0.33 / 9.0.22 / 10.0.14 respectively.
When upgrading code that uses platform flags, see the Runtime H5 migration guide and the dependency history.
Registration and authentication
AddJwtBearerSetting configures utilities. AddJwtBearerAuthentication retains its authentication-only contract. Full AddJwtBearer retains the original Bearer handler, authorization-time refresh and application callbacks. Endpoint authorization and MVC global authorization filters select Challenge for identity failure and Forbid for permission denial at the final response stage. This works without UnifyResult and does not redesign the underlying JWT authentication cache.
Register the application's IJwtBearerHandle and call AddJwtBearer. Use Routing → Authentication → Authorization → endpoints. Read signing credentials from secure application configuration. No new refresh store registration or refresh endpoint is required.
Session and permissions
AuthorizeHandle returning false or throwing invokes AuthorizeFailHandle and produces HTTP 401. PermissionHandle returning false or throwing invokes PermissionFailHandle and produces HTTP 403. Failure callbacks receive the original exception. Cancellation bypasses failure callbacks and propagates, as do exceptions thrown by the failure callbacks themselves. A valid JWT does not override session failure.
AuthorizeHandle retains its authorization-time invocation and resource context: HttpContext for endpoint authorization and AuthorizationFilterContext for MVC. Both paths invoke the callback when both are present. Validate existing sessions without creating or resurrecting them. Existing callback signatures remain available.
Fast certifies only its own requirements, leaving Roles, Claims and third-party policies independent. AllowForbidden skips only Fast permissions. AllowAnonymous preserves public access. SignalR handshakes use HTTP authentication; established Hub invocation denials use the Hub protocol.
AuthorizeFailHandle and PermissionFailHandle retain their existing callback locations. Custom response codes must be 401 and 403 respectively. Framework Challenge preserves Bearer WWW-Authenticate semantics. Started responses are not rewritten.
Endpoint refresh and HTTP results
Missing/invalid credentials without usable refresh produce 401. A valid or refreshed JWT with AuthorizeHandle=false also produces 401 without successor headers. Successful refresh with a valid session continues the original request. Permission denial remains 403 and retains any successful refresh result.
Existing automatic refresh sets access-token and x-access-token with no-store/no-cache. Subsequent identity failure removes both headers before the response starts. Unified responses no longer infer authentication status from token headers or convert 401 to 403. Clients should store both returned credentials together, including on permission-denied responses carrying a successful refresh.
Existing utilities and settings
GenerateToken, GenerateRefreshToken, Exchange/ExchangeAsync and AutoRefreshToken/AutoRefreshTokenAsync retain their public signatures and parameter behavior; they are not deprecated. Full registration retains refresh during authorization, so application authorization callbacks need not refresh again. Parsing alone is not validation.
JWT ClockSkew remains 5 seconds by default and controls lifetime validation. The historical utility clockSkew parameter still controls compatible repeated refresh consumption in seconds, defaulting to zero. These are separate settings; no new result-reuse window is introduced.
RequireRefreshTokenCache, ValidateAccessToken, blacklist retention and existing cache consumption behavior remain unchanged. Standard registration still supplies the distributed-memory fallback. This fix neither adds nor verifies distributed atomic rotation; process locks and ordinary cache Get/Set are not distributed atomic guarantees.
Validation scope
Version 3.5.44 only updates the ASP.NET Core JwtBearer dependency patch versions. Identity and permission failures, refresh response headers, and endpoint/MVC result contracts remain unchanged. Release builds and local NuGet package identity, target assets and dependencies were verified for net8.0, net9.0 and net10.0. HTTP regression tests were not rerun. No business database or Redis was contacted; Fast.Admin integration, SignalR runtime behavior and multi-instance refresh coordination were not verified.
Failure callbacks run for both endpoints and MVC. Non-null return values are written as JSON. Null uses the default Challenge/Forbid response; optional UnifyResult can supply a unified body.
Dependency alignment on 2026-11-02
2026-11-02 dependency alignment: this package increments from 3.5.50 to 3.5.51, updating its dependency to Fast.Runtime 3.5.37. This module's implementation and public declarations are unchanged. Runtime adds mobile H5 and shifts Android and subsequent flags; migrate numeric protocols/masks, rebuild consumers and regenerate client enums. See the Runtime H5 migration guide.
2026-10-24 versions and dependencies
On 2026-10-24, this package increments from 3.5.46 to 3.5.47, with dependencies updated to Fast.Runtime 3.5.34. This module's own implementation and public declarations are unchanged.
Consumers using AppEnvironmentEnum must migrate numeric values and rebuild according to the Runtime HarmonyOS migration guide. This batch reviewed source and effective MSBuild package metadata only. Tests were skipped as requested; no restore, build, pack or consumer runtime validation was performed.
2026-10-30 dependency patch updates
Fast.JwtBearer increments from 3.5.47 to 3.5.48. For net8.0 / net9.0 / net10.0, Microsoft.AspNetCore.Authentication.JwtBearer uses 8.0.33 / 9.0.22 / 10.0.14. Fast.Runtime 3.5.34 is unchanged.
This dependency update does not modify module implementation or public APIs. Restore, Release builds and local packaging passed for all three targets without final build warnings or errors. Package identity, dependency groups and DLL/XML equality with build outputs were verified. No host, HTTP/serialization/ORM runtime regression, database or Redis operation was run; consumer examples on this page were not recompiled.
