I'm currently investigating WCF for implementing a RESTful service that will run through IIS. Currently our software offers the ability to authenticate users against a range of sources
Our own internal user accounts stored in the database
A specified windows active directory where if authentication is successful, a lookup is done to find which internal account the winows one is linked to
- Another LDAP server e.g Novell
So the way I want this to work is that a client sends an http(s) request with an authentication header (basic for now) over SSL, then the service will use custom authentication to implement the process described above.
For the moment I am self-hosting the service and trying to get the custom authentication example working, it starts up correctly but all I get when I try to make a request from a browser or a tool where i can attach an authentication header is
"Error 101 (net::ERR_CONNECTION_RESET): The connection was reset."
I have set a breakpoint in the custom authentication class an it is never reached, so I'm guessing its a problem with the configuration.
My app.config;
<configuration>
...
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="secure">
<security mode="Transport">
<transport clientCredentialType="Basic"></transport>
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="CELCAT.RegisterMarker.RegisterMarker" behaviorConfiguration="myServiceBehavior">
<endpoint address="https://mymachine:8001/servicename"
binding="webHttpBinding"
bindingConfiguration="secure"
contract="myServiceContract" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
<serviceAuthorization serviceAuthorizationManagerType="MyServiceAuthorizationManager, authenticatonassembly" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="servicenamespace, serviceassembly" />
<serviceCertificate findValue="certname"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
I have read a post that said what I am trying to do is impossible out of the box with WCF and to achieve this I will need to write a custom module or request interceptor as describe below;
authentication via custom module; http://custombasicauth.codeplex.com/
authentication via request interceptor; http://www.codeproject.com/KB/WCF/BasicAuthWCFRest.aspx
This seems like it should be possible to me, so my questions are
- Is what i'm trying to do possible?
- If so what have I got wrong? or if not which work around is best?