简体   繁体   English

通过WCF的ASP.NET默认登录

[英]ASP.NET default login through WCF

I'm starting a new project and I'm also a little bit of new to ASP.NET and WCF services and right now I'm trying to understand the logic behind the ASP.NET login and registration functionality but I can't seem to figure it out exactly. 我正在开始一个新项目,并且对ASP.NET和WCF服务也有些陌生,现在我正试图了解ASP.NET登录和注册功能背后的逻辑,但我似乎无法弄清楚。

I want to make a WebApp using N-Layer architecture and I want presentation layer to be completely data-free and the default ASP.NET registration-login functionality doesn't let me do that since it access the database directly, at least not through some logic I want to do myself. 我想使用N层体系结构制作WebApp,并且我希望表示层完全没有数据,并且默认的ASP.NET注册登录功能不允许我这样做,因为它直接访问数据库,至少不能通过我想自己做一些逻辑。 What I'd like to do is to continue using the register-login functionality but instead of fetching for data directly to the database, I want it to be fetched from a WCF service, but I can't seem to find how to configure the register-login to do so. 我想做的是继续使用注册登录功能,但是我希望从WCF服务中获取数据,而不是直接将数据获取到数据库中,但是我似乎找不到如何配置该功能。注册登录即可。

Any idea where to start reading? 知道从哪里开始阅读吗? I've read something about WCF Authentication but that doesn't seem to be what I'm looking for. 我已经阅读了有关WCF身份验证的内容,但这似乎不是我想要的。

Thanks in advance 提前致谢

There isn't as far as I know a WCFMembershipProvider or similar. 据我所知,没有WCFMembershipProvider或类似的东西。 This means that if you want to use build-in security features of ASP.NET you will need to create your own MembershipProvider . 这意味着,如果要使用ASP.NET的内置安全功能,则需要创建自己的MembershipProvider

Take a look at this tutorial it guide you on this process: 看一下本教程,它指导您完成此过程:

How to build a custom membership provider 如何建立自订会员提供者

For this case, you would need to implement your own membership provider to use the service you have as the backing for authentication. 对于这种情况,您将需要实现自己的成员资格提供程序,以将您拥有的服务用作身份验证的支持。

MSDN has resources on how to do this. MSDN上有如何执行此操作的资源。

Additionally, you may want to ask yourself WHY you want this service to provide authentication. 此外,您可能想问自己为什么要使用此服务提供身份验证。 What value does it give you? 它给您什么价值? Keep YAGNI and DRY principles at the forefront of your mind while thinking about it. 在思考时,请将YAGNI和DRY原则放在您的脑海中。

@Dalorzo beat me to it @达洛佐击败我

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

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