WCF Authentication

I have a WCF service deployed to another computer and I want to authenticate the client to the WCF service.

I have done the following:

1) In IIS, I disabled anonymous access and checked the "Integrated Windows Authentication" checkbox.

2) My web configuration

 <authentication mode="Windows" />
 <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBind">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

3) On the client side, I pass the user credentials as shown below:

MyServiceClient _client;

_client = new MyServiceClient();

_client.ClientCredentials.Windows.ClientCredential.UserName = "username";
_client.ClientCredentials.Windows.ClientCredential.Password = "password";
_client.ClientCredentials.Windows.ClientCredential.Domain = "mydomain";

My question is, how can I catch the server-side username and password (where the service is deployed)?

How can I authenticate the user with the credentials submitted?

I am currently using the basichttp binding .. is this binding good enough to support the security model?

+3
source share
2

Active Directory Windows, .

, :

IIdentity caller = ServiceSecurityContext.Current.PrimaryIdentity;

, Windows Windows ( ),

ServiceSecurityContext.Current.WindowsIdentity

NULL, Windows , Windows, , ( ..) - , ! , , , .

Windows/Active Directory, clientCredentialType "Windows". , wsHttpBinding : netTcpBinding ( Windows ).

<bindings>
  <netTcpBinding>
    <binding name="WindowsSecured">
      <security mode="Transport">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </netTcpBinding>
</bindings>

, Windows, . .

Windows ServiceSecurityContext.Current.WindowsIdentity , .

MSDN , , Windows.

+6

, . MSDN, : .

BasicHttpBinding . , BasicHttpSecurityMode.

0

Source: https://habr.com/ru/post/1716469/


All Articles