basicHttpBinding with custom login/password and HTTPS
After a lot of googling, i ask for your help for a problem who seems to be easy but... really not.
How can i use custom login/password like in this tutorial with basichttpbinding instead of WS开发者_开发知识库HttpBinding ? http://codebetter.com/petervanooijen/2010/03/22/a-simple-wcf-service-with-username-password-authentication-the-things-they-don-t-tell-you/
I need this because clients for my webservice could be in PHP and i found that WSHttpBinding don't works with PHP Soap implementation.
Thank's by advance !
Although the actual code in this MSDN example uses wsHttpBinding, the custom user/password validator code is also applicable for basicHttpBinding use. Look at the code in this blog post to see the basicHttpBinding specific configuration for using a custom validator. Just remember that WCF, by default, will only support secure communication between the client and service. This means the basicHttpBinding configuration shown in the blog post must be over HTTPS.
Ok so finally i'm done without HTTPS but it works !
I used the following links to generate a clean webservice :
http://channel9.msdn.com/Shows/Endpoint/Endpoint-Screencasts-Creating-Your-First-WCF-Service http://laedit.developpez.com/PHP/CSharp/Interoperabilite/#LIV (in french, show the wcf par)
And then, i finally make a app.config file who works : http://pastebin.com/cVGC88Gj .This is a modified version of the example made in the second link.
And this is the custom authentification code : http://pastebin.com/QucGKqZt
Remember that this code NEVER HAD TO BE IN PRODUCTION. PASSWORDS ARE SENT IN CLEAR IN HEADERS. But for developing it's clean and simple ;-)
精彩评论