Configure WCF with basic authentication

WCF

Set basic authentication in the binding:

<binding name="serviceBinding">
    <security mode="Transport">
        <transport clientCredentialType="Basic" />  
    </security>
</binding>

Basic authentication should be only used with https or else it is insecure, the password is sent as plaintext.

To revert to bare http change the "Transport" mode to: "TransportCredentialOnly".

To restrict the connection to a specific user, add the "authorization element", this is very useful when establishing a secure channel between two applications.

<configuration>
  <system.web>
      <authorization>
          <allow users="mydomain\myuser" />
          <deny users="*" />
      </authorization>
  </system.web>

...

Post a Comment

Previous Post Next Post