来自WPF客户端的AspNet.Core身份验证
我已经实现了asp.net核心身份验证,它与我的web应用程序配合得很好。在startup.cs文件中,我有以下内容:来自WPF客户端的AspNet.Core身份验证,wpf,authentication,asp.net-core,identity,Wpf,Authentication,Asp.net Core,Identity,我已经实现了asp.net核心身份验证,它与我的web应用程序配合得很好。在startup.cs文件中,我有以下内容: services.ConfigureApplicationCookie(options => { // Cookie settings options.Cookie.HttpOnly = true; options.ExpireTimeSpan = TimeSpan.FromMi
services.ConfigureApplicationCookie(options =>
{
// Cookie settings
options.Cookie.HttpOnly = true;
options.ExpireTimeSpan = TimeSpan.FromMinutes(30);
options.LoginPath = "/Identity/Account/Login";
options.AccessDeniedPath = "/Identity/Account/AccessDenied";
options.SlidingExpiration = true;
});
在Login.chtml.cs中,我使用了登录方法:
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
if (ModelState.IsValid)
{
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: true);
if (result.Succeeded)
{
//...
}
else
{
//....
}
}
return Page();
}
PostAsync上的公共异步任务(字符串returnUrl=null)
{
if(ModelState.IsValid)
{
var result=wait _signInManager.PasswordSignInAsync(Input.Email、Input.Password、Input.RememberMe、lockoutOnFailure:true);
if(result.successed)
{
//...
}
其他的
{
//....
}
}
返回页();
}
现在,我正在放置一个WPF客户端,我想在其中使用AspNetCore.Identity登录过程对我的用户进行身份验证。如果您对如何继续操作提出任何建议,我们将不胜感激。最后,我决定继续,以便为WPF客户端和以后可能需要的其他客户端提供一个集中的登录和工作流。如果您使用WPF,为什么不使用Windows身份验证?操作系统已经知道域用户是谁事实上,WPF客户端将由不一定在域中的客户使用。