public static System.Threading.Tasks.Task LoginAsync(string username, string password) { var tcs = new System.Threading.Tasks.TaskCompletionSource <PTPrincipal>(); PTIdentity.GetPTIdentity(username, password, (o, e) => { if (e.Error == null && e.Object != null) { SetPrincipal(e.Object); tcs.SetResult(null); } else { Logout(); if (e.Error != null) { tcs.SetException(e.Error.InnerException); } else { tcs.SetCanceled(); } } }); return(tcs.Task); }
public static bool Load(string username) { var current = Csla.ApplicationContext.User; if (current != null && current.Identity != null && current.Identity.Name == username) { return(true); } var identity = PTIdentity.GetPTIdentity(username); return(SetPrincipal(identity)); }
public static void BeginLogin(string username, string password) { PTIdentity.GetPTIdentity(username, password, (o, e) => { if (e.Error == null && e.Object != null) { SetPrincipal(e.Object); } else { Logout(); } }); }
public static bool Login(string username, string password) { var identity = PTIdentity.GetPTIdentity(username, password); return(SetPrincipal(identity)); }
public static bool Load(string username) { var identity = PTIdentity.GetPTIdentity(username); return(SetPrincipal(identity)); }