-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[Blazor] Update AuthenticationStateProvider to use declarative persistent component state #62063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Greetings human! You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime . Please make sure you synchronize this code with the changes in that repo! |
…FromPersistentComponentState Co-authored-by: ilonatommy <[email protected]>
...bAssembly/WebAssembly.Authentication/src/Services/DeserializedAuthenticationStateProvider.cs
Outdated
Show resolved
Hide resolved
…sistent state Co-authored-by: ilonatommy <[email protected]>
...bAssembly/WebAssembly.Authentication/src/Services/DeserializedAuthenticationStateProvider.cs
Outdated
Show resolved
Hide resolved
...bAssembly/WebAssembly.Authentication/src/Services/DeserializedAuthenticationStateProvider.cs
Show resolved
Hide resolved
…onent state properly Co-authored-by: ilonatommy <[email protected]>
src/SignalR/clients/ts/signalr-protocol-msgpack/package.json.bak
Outdated
Show resolved
Hide resolved
...bAssembly/WebAssembly.Authentication/src/Services/DeserializedAuthenticationStateProvider.cs
Show resolved
Hide resolved
…component state Co-authored-by: ilonatommy <[email protected]>
src/Components/WebAssembly/Server/src/AuthenticationStateSerializer.cs
Outdated
Show resolved
Hide resolved
src/Components/WebAssembly/Server/src/AuthenticationStateSerializer.cs
Outdated
Show resolved
Hide resolved
…nent state Co-authored-by: ilonatommy <[email protected]>
...embly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
…vider interface Co-authored-by: ilonatommy <[email protected]>
src/Components/WebAssembly/Server/src/WebAssemblyRazorComponentsBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
…ttern Co-authored-by: ilonatommy <[email protected]>
…ateProvider Co-authored-by: ilonatommy <[email protected]>
src/Components/WebAssembly/Server/src/AuthenticationStateSerializer.cs
Outdated
Show resolved
Hide resolved
src/Components/WebAssembly/Server/src/AuthenticationStateSerializer.cs
Outdated
Show resolved
Hide resolved
@@ -41,6 +43,8 @@ public static IRazorComponentsBuilder AddInteractiveWebAssemblyComponents(this I | |||
public static IRazorComponentsBuilder AddAuthenticationStateSerialization(this IRazorComponentsBuilder builder, Action<AuthenticationStateSerializationOptions>? configure = null) | |||
{ | |||
builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IHostEnvironmentAuthenticationStateProvider, AuthenticationStateSerializer>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IHostEnvironmentAuthenticationStateProvider, AuthenticationStateSerializer>()); | |
builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<AuthenticationStateProvider, AuthenticationStateSerializer>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested TryAddEnumerable is already present in line 45 of the file. No changes were needed for this comment.
…ndant null check Co-authored-by: ilonatommy <[email protected]>
…Provider Co-authored-by: ilonatommy <[email protected]>
This PR updates the
DeserializedAuthenticationStateProvider
to use the declarative persistent component state pattern with the[SupplyParameterFromPersistentComponentState]
attribute, matching the approach used for antiforgery token handling.Changes
[SupplyParameterFromPersistentComponentState]
attribute toDeserializedAuthenticationStateProvider
to receive authentication state data:Updated the constructor to use this property while maintaining backward compatibility with the existing
TryTakeFromJson
approach to ensure a smooth transitionMaintained the existing persistence key to ensure compatibility with the
AuthenticationStateSerializer
class which persists the data on the server sideBenefits
Fixes #60718.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.