[英]WCF Service Authentication from MVC App sharing same Membership Provider
I have an MVC Application on X domain and a WCF Service in Y domain, and I want to use the same membership provider for both of them.我在 X 域上有一个 MVC 应用程序,在 Y 域中有一个 WCF 服务,我想对它们使用相同的成员资格提供程序。
The WCF Service is in Y domain because the data is in an intr.net server, and the MVC Application is in X domain because I don't want to handle all the request on our server that generates the data. WCF 服务在 Y 域中,因为数据在 intr.net 服务器中,而 MVC 应用程序在 X 域中,因为我不想处理我们服务器上生成数据的所有请求。
I want the user to login to the MVC Application and by doing so also authenticating to the WCF Service.我希望用户登录到 MVC 应用程序,并通过这样做也对 WCF 服务进行身份验证。
I don't know which would be the best way to do so, if I can create cookies for both things when they authenticate in the MVC Application (which I'm not sure how to accomplish).我不知道最好的方法是什么,如果我可以在 MVC 应用程序中验证时为这两件事创建 cookies(我不确定如何完成)。 I don't want my WCF Service be available to anyone who's not authenticated.我不希望任何未通过身份验证的人都可以使用我的 WCF 服务。
So what I think I need is the AuthenticationService to validate the user and then pass the same username and password to my custom WCF Service to be able to interact with it.所以我认为我需要的是 AuthenticationService 来验证用户,然后将相同的用户名和密码传递给我的自定义 WCF 服务以便能够与之交互。
The thing is that I validate my username with AuthenticationService and create a cookie ( http://msdn.microsoft.com/en-us/library/bb515342.aspx ) but then when I interact with my Custom WCF Service (Data) I need to supply username and password again ( http://msdn.microsoft.com/en-us/library/ff647294.aspx ), I have no problem with the username but the password I'm not sure how to manage it and I don't want to be asking for the password every time.问题是我使用 AuthenticationService 验证我的用户名并创建一个 cookie( http://msdn.microsoft.com/en-us/library/bb515342.aspx )但是当我与我的自定义 WCF 服务(数据)交互时我需要再次提供用户名和密码( http://msdn.microsoft.com/en-us/library/ff647294.aspx ),我对用户名没有问题,但密码我不知道如何管理它,我不知道每次都想输入密码。
Is there something easier?有什么更容易的吗?
Check the link below.检查下面的链接。 Your scenario is fully covered and explained.您的方案已完全涵盖和解释。 http://msdn.microsoft.com/en-us/library/bb386582.aspx http://msdn.microsoft.com/en-us/library/bb386582.aspx
Hope that helps.希望有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.