public bool Authenticate(ExtendedApplicationBase app) { AuthenticationWindow loadingWindow = new AuthenticationWindow(); loadingWindow.Show(); var account = app.Properties[app.PROPERTY_ACCOUNT]; var password = app.Properties[app.PROPERTY_PASSWORD]; if (account == null || password == null) { loadingWindow.Close(); return(false); } if (Authenticate(account.ToString(), password.ToString())) { //1. 获取用户信息 UserWorkRequest request = new UserWorkRequest(); var identity = new Identity(account.ToString(), true); app.Context.User = new Principal(request, identity); Thread.Sleep(5000); loadingWindow.Close(); return(true); } loadingWindow.Close(); return(false); }
public Principal(UserWorkRequest request, IIdentity identity) { if(request == null) { throw new FatalException("request arguement can't be null."); } if(identity == null) { throw new FatalException("identity arguement can't be null."); } _request = request; _identity = identity; }
public Principal(UserWorkRequest request, IIdentity identity) { if (request == null) { throw new FatalException("request arguement can't be null."); } if (identity == null) { throw new FatalException("identity arguement can't be null."); } _request = request; _identity = identity; }