Skip to content

Update Part11.md #22

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions docs/tutorial/Part11.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ Besides that, you need to add a couple extras to your ASP.NET Core app service c
var fusion = services.AddFusion();
var fusionServer = fusion.AddWebServer();
var fusionAuth = fusion.AddAuthentication().AddServer(
signInControllerOptionsFactory: _ => new() {
signInControllerSettingsFactory: _ => new() {
// Set to the desired one
DefaultScheme = MicrosoftAccountDefaults.AuthenticationScheme,
SignInPropertiesBuilder = (_, properties) => {
properties.IsPersistent = true;
}
},
serverAuthHelperOptionsFactory: _ => new() {
serverAuthHelperSettingsFactory: _ => new() {
// These are the claims mapped to User.Name once a new
// User is created on sign-in; if they absent or this list
// is empty, ClaimsPrincipal.Identity.Name is used.
Expand Down Expand Up @@ -344,7 +344,7 @@ All of this means your Blazor WASM client doesn't need to know the actual `Sessi

And you want your Blazor components to work on Blazor Server, you need to use the right `Session`, which is available there.

Now, if you still remember the beginning of this document, there is a number of services managing `Session` in Fusion:
Now, if you still remember the beginning of this document, there is a number of services managing `Session` in Fusion on Client side:

```cs --editable false
Services.TryAddScoped<ISessionProvider, SessionProvider>();
Expand Down Expand Up @@ -372,15 +372,7 @@ So all we need is to make `ISessionResolver` to resolve `Session.Default` on the
</CascadingAuthState>

@code {
[Parameter]
public string SessionId { get; set; } = Session.Default.Id;

protected override void OnInitialized()
{
if (!BlazorCircuitContext.IsPrerendering)
BlazorCircuitContext.RootComponent = this;
}


[Parameter]
public string SessionId { get; set; } = Session.Default.Id;

Expand All @@ -407,7 +399,7 @@ All of this implies you also need a bit special logic in `_Host.cshtml` to spawn
```cs --editable false
<app id="app">
@{
using var prerendering = BlazorCircuitContext.Prerendering();
using var prerendering = _blazorCircuitContext.Prerendering();
var prerenderedApp = await Html.RenderComponentAsync<App>(
isServerSideBlazor ? RenderMode.ServerPrerendered : RenderMode.WebAssemblyPrerendered,
isServerSideBlazor ? new { SessionId = sessionId } : null);
Expand Down