public Task <bool> AuthenticateWithUsernameOrEmailAsync(string userNameOrEmail, string password, MobileInfo mobileInfo, out UserAccountAuthentication accountAuthentication) { UserAccount account; var isAuthenticate = AuthenticateWithUsernameOrEmail(userNameOrEmail, password, out account); accountAuthentication = new UserAccountAuthentication { Status = _accountStatus }; if (!isAuthenticate) { return(Task.FromResult(false)); } accountAuthentication.InjectFrom(account); accountAuthentication.Profile.InjectFrom(account.Profile); accountAuthentication.Claims = account.ClaimCollection.Select(uc => new Claim(uc.Type, uc.Value)).ToList(); if (mobileInfo == null) { return(Task.FromResult(true)); } isAuthenticate = RegisterMobile(account.UserId, account.Username, mobileInfo); return(Task.FromResult(isAuthenticate)); }
private void CacheUserAccount(UserAccountAuthentication account) { var cache = _resolver.GetService(typeof(IDataCache)) as IDataCache; cache?.Insert(DataCacheKey.CurrentUser, account.UserId, account); }