WCF Service Authentication from MVC App sharing same Membership Provider

巧了我就是萌 提交于 2019-12-12 17:15:29

问题


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.

The WCF Service is in Y domain because the data is in an intranet 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.

I want the user to login to the MVC Application and by doing so also authenticating to the WCF Service.

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). I don't want my WCF Service be available to anyone who's not authenticated.

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.

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.

Is there something easier?


回答1:


Check the link below. Your scenario is fully covered and explained. http://msdn.microsoft.com/en-us/library/bb386582.aspx

Hope that helps.



来源:https://stackoverflow.com/questions/10017771/wcf-service-authentication-from-mvc-app-sharing-same-membership-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!