If a user logs out in another session. Or is deleted or disabled, I want to have that reflected in all other sessions.
Codewrinkles provides a moderately complex solution here using his own IdentityValidationProvider class. Is that the best way to do it? I ask because Microsoft has all this A&A stuff pretty well designed and this would be a noticeable miss.
And there's the AuthenticationStateProvider.AuthenticationStateChanged Event. Now I've read in numerous places that you should not use AuthenticationStateProvider to get the user because it does not reflect changes. But with that limitation, does the AuthenticationStateChanged event still work?
Or is there another way to accomplish this?
And once I get the event that the authenticated user has changed (or gone away), is it on me to get the notification to the MainLayout.razor and every child razor file individually? Or is there a clean way to just rebuild the page I have up, like call NavigationManager.RedirectTo(currentPage)?
The best approach I see (if there's better, please let me know) is to create a scoped service with an event. I have MainLayout subscribe to the event and I call the event when the authentication state changes. In MainLayout, when the event firs and calls me, I call StateHasChanged().