CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
CslaAuthenticationStateProvider.cs
Go to the documentation of this file.
1using System.Threading.Tasks;
2using Microsoft.AspNetCore.Components.Authorization;
3
5{
10 public class CslaAuthenticationStateProvider : AuthenticationStateProvider
11 {
12 private readonly CslaUserService _currentUserService;
13
19 {
20 _currentUserService = currentUserService;
21 _currentUserService.CurrentUserChanged += (sender, e) =>
22 {
23 var authState = Task.FromResult(new AuthenticationState(e.NewUser));
24 NotifyAuthenticationStateChanged(authState);
25 };
26 }
27
33 public override Task<AuthenticationState> GetAuthenticationStateAsync()
34 {
35 return Task.FromResult(new AuthenticationState(_currentUserService.CurrentUser));
36 }
37 }
38}
ASP.NET AuthenticationStateProvider that relies on the CslaUserService to manage the current user.
CslaAuthenticationStateProvider(CslaUserService currentUserService)
Creates an instance of the type.
override Task< AuthenticationState > GetAuthenticationStateAsync()
Gets the AuthenticationState from the CslaUserService service.
Expose Csla.ApplicationContext.User for use in Blazor authentication pages.
EventHandler< CurrentUserChangedEventArgs > CurrentUserChanged
Event raised when the current user is changed.