Authentic hyperlink (2024-03-26)
.NET 9 Preview 2 launched by Microsoft consists of a number of updates for ASP.NET Core.These embrace Blazor element injection and WebSocket compression for Blazor’s interactive server parts. Moreover, builders can customise OIDC and OAuth parameters and set the HTTP.sys prolonged authentication flag to streamline authentication integration.
Blazor parts use @inject and[Inject]Including to the present performance of injecting service properties utilizing attributes, we now assist constructor injection for configuration providers. Microsoft demonstrates this characteristic with the next instance. On this instance, a element makes use of constructor injection by means of the C# default constructor to entry the NavigationManager service.
Builder injection for Blazor parts (Supply: Microsoft Weblog)
Blazor’s interactive server providing consists of WebSocket protocol compression by default, considerably lowering message payload measurement. As well as, to cut back the danger of compression assaults on safe connections, Interactive Server Rendering makes use of the ancestor framework of Content material Safety Coverage (CSP): ‘self’, which permits nesting of purposes provided that the applying embeds a hyperlink derived from the collection. The identical supply.
To vary the body ancestors supply, you have to use the ContentSecurityFrameAncestorsPolicy choice.
app.MapRazorComponents() .AddInteractiveServerRenderMode(o => o.ContentSecurityFrameAncestorsPolicy=”‘no'”);
To disable compression there’s a DisableWebSocketCompression choice.
app.MapRazorComponents() .AddInteractiveServerRenderMode(o => o.DisableWebSocketCompression = true);
Moreover, the OAuth and OIDC authorization strategies have a brand new choice that permits customization of authorization message parameters which can be usually included in redirect request strings. This may be achieved like this:
builder.Providers.AddAuthentication().AddOpenIdConnect(choices =>){ choices.AdditionalAuthorizationParameters.Add(“immediate”, “login”); choices.AdditionalAuthorizationParameters.Add(“viewers”, “https://api.instance.com”);});
The following characteristic is setting the HTTP.sys prolonged authentication flag. Builders can use the brand new EnableKerberosCredentialCaching and CaptureCredentials properties within the HTTP.sys AuthenticationManager to set the HTTP_AUTH_EX_FLAG_ENABLE_KERBEROS_CREDENTIAL_CACHING and HTTP_AUTH_EX_FLAG_CAPTURE_CREDENTIALHTTP.sys flags to higher deal with flags for Home windows.
The most recent launch additionally launched a brand new AllowOutOrderMetadataProperties setting for System.Textual content.Json.Feedback partWeihan Li, a .NET software program growth engineer, launched assist for out-of-order metadata loading in JsonSerializer, guaranteeing that JSON property names are all the time unresolved when loading .to alteridentified.
The ASP.NET Core roadmap for .NET 9 is:Github RepositoryOut there at.