简体   繁体   English

在C#客户端应用程序中创建用户身份验证

[英]Create User authentication in a C# client application

So I wrote quite a few ASP.NET web applications and there I often used the forms authentication. 因此,我编写了许多ASP.NET Web应用程序,在那里我经常使用表单身份验证。 Now I need to do the same but in a client application. 现在,我需要在客户端应用程序中执行相同的操作。 What would be the best way to create something like this? 创建这样的东西的最佳方法是什么?

I was searching for it for some time now but I didn't find something that I could implement in my project. 我已经搜索了一段时间,但是没有找到可以在我的项目中实现的东西。 I just need to have a login screen and only when it is valid with the user logins I created I should be able to use the complete application. 我只需要有一个登录屏幕,只有当它对我创建的用户登录名有效时,我才可以使用完整的应用程序。

Can someone please help me? 有人可以帮帮我吗?

There are probably several approaches that you could take. 您可能会采用几种方法。 If the application is internally distributed you could use a database connection to something like SQL Server where you would have accounts set up to validate against. 如果应用程序是内部分发的,则可以使用与SQL Server之类的数据库连接,在该数据库中设置要进行验证的帐户。 If the distribution is external you may want to consider setting up a server and using socket connections in your application to make calls to your server(again storing account information in a back end database) to validate users. 如果分发是外部的,则可能要考虑设置服务器并在应用程序中使用套接字连接来调用服务器(同样将帐户信息存储在后端数据库中)以验证用户。

I remember using ASP.NET Identity for that purpose. 我记得为此目的使用过ASP.NET Identity。 Was very easy and everything is pretty much ready. 非常简单,一切准备就绪。

ASP.NET Core Identity is a membership system that adds login functionality to ASP.NET Core apps. ASP.NET Core身份是一种成员资格系统,将登录功能添加到ASP.NET Core应用程序。 Users can create an account with the login information stored in Identity or they can use an external login provider 用户可以使用存储在Identity中的登录信息创建帐户,也可以使用外部登录提供程序

docs.microsoft.com/en-us/aspnet/core/security/authentication/identity docs.microsoft.com/en-us/aspnet/core/security/authentication/identity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM