Configure the server to use this binding
<basicHttpBinding>
<binding name="basicWin" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
...
<services>
<service name="My.Service">
<endpoint address="" contract="My.Contract" binding="basicHttpBinding" bindingConfiguration="basicWin" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
Configure the client to use this binding
<basicHttpBinding>
<binding name="winBasic" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
...
<client>
<endpoint address="https://myserver/myservice.svc"
binding="basicHttpBinding" bindingConfiguration="winBasic" contract="My.Contract"/>
</client>
Set the IIS to require windows authentication, disable anonymous authentication
To get the authenticated identity on the server side use this:
string username = ServiceSecurityContext.Current.PrimaryIdentity?.Name;
Tags
WCF