public void OnGet() { Number = Utils.Number(15); RsaKey = RSACrypt.GetKey(); //获得公钥和私钥 MemoryCacheService.Default.SetCache("LOGINKEY_" + Number, RsaKey, 5); }
public void OnGet() { RsaKey = RSACrypt.GetKey(); var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme); //auth.Result.Succeeded; if (auth.Status.ToString() != "Faulted") { RedirectToPage("Index"); } }
public ApiResult LoadLoginInfo() { var rsaKey = RSACrypt.GetKey(); var number = Guid.NewGuid().ToString(); if (rsaKey.Count <= 0 || rsaKey == null) { throw new ArgumentNullException("获取登录的公钥和私钥为空"); } //获得公钥和私钥 _cache.Set("LOGINKEY" + number, rsaKey); return(new ApiResult(data: new { RsaKey = rsaKey, Number = number })); }
public void OnGet() { var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme); //auth.Result.Succeeded; if (auth.Status.ToString() != "Faulted") { RedirectToPage("Index"); } RsaKey = RSACrypt.GetKey(); //获得公钥和私钥 MemoryCacheService.Default.SetCache("LOGINKEY", RsaKey); }
public ActionResult Login() { var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme); //auth.Result.Succeeded; if (auth.Status.ToString() != "Faulted") { RedirectToPage("Index"); } List <string> RsaKey = RSACrypt.GetKey(); return(View(RsaKey)); }
private void LoadKey() { var rsaKey = RSACrypt.GetKey(); var number = Guid.NewGuid().ToString(); if (rsaKey.Count <= 0 || rsaKey == null) { throw new ArgumentNullException("»ñÈ¡µÇ¼µÄ¹«Ô¿ºÍ˽ԿΪ¿Õ"); } RsaKey = rsaKey; Number = number; //»ñµÃ¹«Ô¿ºÍ˽Կ _cache.Set(LoginKey + number, rsaKey); }
public async Task OnGetAsync() { var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme); if (auth.Status.ToString() != "Faulted") { RedirectToPage("Index"); } RsaKey = RSACrypt.GetKey(); lid = Guid.NewGuid(); //获得公钥和私钥 await _cache.SetAsync($"LOGINKEY:{lid}", RsaKey, expirationMinute : 30); }