I am writing a WCF Service which would allow access to operations based on AD user group. If the logged in user is part of groupA
, allow him to do operationA
, but not operationB
and so on and so forth. Now for this I have to pass NetworkCredentials
to the service like
factory.Credentials.Windows.AllowedImpersonationLevel =
TokenImpersonationLevel.Identification;
factory.Credentials.Windows.AllowNtlm = true;
factory.Credentials.Windows.ClientCredential.username = "username";
factory.Credentials.Windows.ClientCredential.password = "pwd";
factory.Credentials.Windows.ClientCredential.domain = "mycompany.com";
I want that the user need not enter his credentials for calling service operation. It should take from Thread.CurrentPrincipal
. Can anyone help me out in this regards as to how to pass network credentials.