private async Task <ClaimsIdentity> GetClaimsIdentity(GirisDto girisBilgileri, Kullanici kullanici) { if (string.IsNullOrEmpty(girisBilgileri.KullaniciAdi) || string.IsNullOrEmpty(girisBilgileri.Sifre)) { return(await Task.FromResult <ClaimsIdentity>(null)); } // get the user to verifty var userToVerify = kullanici; if (userToVerify == null) { return(await Task.FromResult <ClaimsIdentity>(null)); } // check the credentials if (await userManager.CheckPasswordAsync(userToVerify, girisBilgileri.Sifre)) { return(await Task.FromResult(jwtFactory.GenerateClaimsIdentity(kullanici))); } // Credentials are invalid, or account doesn't exist return(await Task.FromResult <ClaimsIdentity>(null)); }