コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 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();
         }
     });
 }
コード例 #4
0
        public static bool Login(string username, string password)
        {
            var identity = PTIdentity.GetPTIdentity(username, password);

            return(SetPrincipal(identity));
        }
コード例 #5
0
ファイル: PTPrincipal.cs プロジェクト: wyerp/csla
        public static bool Load(string username)
        {
            var identity = PTIdentity.GetPTIdentity(username);

            return(SetPrincipal(identity));
        }