@page "/" @using Microsoft.AspNetCore.Components.Authorization @inject AuthenticationStateProvider AuthStateProvider Zahlen-Analyse Willkommen zurück, @context.User.Identity?.Name! Deine Pocket-ID (Sub): @_userId Abmelden Bitte melde dich an, um deine Workspaces zu verwalten. Mit Pocket-ID anmelden @code { private string _userId = string.Empty; protected override async Task OnInitializedAsync() { var authState = await AuthStateProvider.GetAuthenticationStateAsync(); var user = authState.User; if (user.Identity?.IsAuthenticated == true) { // Das ist der "sub"-Claim (Subject), den wir als OwnerId in RavenDB nutzen _userId = user.FindFirst(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value ?? user.FindFirst("sub")?.Value ?? string.Empty; } } }