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.
CslaUserService.cs
Go to the documentation of this file.
1using System;
2using System.Security.Claims;
3
5{
11 public class CslaUserService
12 {
16 public event EventHandler<CurrentUserChangedEventArgs> CurrentUserChanged;
17
23 {
24 Csla.ApplicationContext.User = new ClaimsPrincipal(new ClaimsIdentity());
25 }
26
30 public ClaimsPrincipal CurrentUser
31 {
32 get
33 {
34 return (ClaimsPrincipal)Csla.ApplicationContext.User;
35 }
36 set
37 {
38 Csla.ApplicationContext.User = value;
39 CurrentUserChanged?.Invoke(this, new CurrentUserChangedEventArgs() { NewUser = value });
40 }
41 }
42
46 public class CurrentUserChangedEventArgs : EventArgs
47 {
51 public ClaimsPrincipal NewUser { get; internal set; }
52 }
53 }
54}
Expose Csla.ApplicationContext.User for use in Blazor authentication pages.
CslaUserService()
Creates an instance of the type, setting the current user to an unauthenticated ClaimsPrincipal.
ClaimsPrincipal? CurrentUser
Gets or sets the current user.
EventHandler< CurrentUserChangedEventArgs > CurrentUserChanged
Event raised when the current user is changed.