Is there a way to use the same username and password from the membership provider for a WCF service authentication? if so, which binding does it supports? I need to extract a profile variable from the user currently calling the service. Thanks for any help.
Basically any binding that accepts username/password as client credentials for message security can be configured to use the ASP.NET membership provider.
Check out this MSDN docs on how to use the ASP.NET Membership provider in WCF - you need to configure your binding for client credentials of type "UserName"
<bindings>
<wsHttpBinding>
<!-- Set up a binding that uses UserName as the client credential type -->
<binding name="MembershipBinding">
<security mode ="Message">
<message clientCredentialType ="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
and the service to use ASP.NET Membership for user authentication:
<serviceBehaviors>
<behavior name="AspNetMembership">
<serviceCredentials>
<userNameAuthentication
userNamePasswordValidationMode ="MembershipProvider"
membershipProviderName ="SqlMembershipProvider"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
and of course, you have to apply this service behavior to your services when configuring them!
<services>
<service name="YourService" behaviorConfiguration="AspNetMembership">
....
</service>
</services>
The UserName client credential type is supported by basicHttpBinding, wsHttpBinding, netTcpBinding - so pretty much all the usual suspects.