Я застрял в следующей ситуации: Я запускаю программу C# с клиентом с аутентификацией Kerberos. Я хочу использовать учетные данные kerberos для аутентификации веб-службы сервера SharePoint, которая по-прежнему проверяется NTLM. Как я могу войти в веб-сервис с помощью NTLM с моими учетными данными Kerberos?Аутентификация с аутентифицированной машины Kerberos на сервер NTLM
В качестве тестовой программы я написал следующее, я хотел бы настроить, что к программе, которая не использует константы пользователя, Pasword и домен и по-прежнему функционировать правильно:
using System;
using System.Security.Principal;
using TestSharePointServices.listService;
namespace TestSharePointServices
{
class Program
{
static void Main(string[] args)
{
string username = "myusername";
string password = "mypassword";
string domain = "mydomain";
ListsSoapClient client = new ListsSoapClient();
if (client.ClientCredentials != null)
{
Console.WriteLine("Name: " + WindowsIdentity.GetCurrent().Name);
Console.WriteLine("Authenticated: " + WindowsIdentity.GetCurrent().IsAuthenticated);
Console.WriteLine("Authentication Type: " + WindowsIdentity.GetCurrent().AuthenticationType);
Console.ReadKey();
client.ClientCredentials.Windows.ClientCredential =
new System.Net.NetworkCredential(username, password, domain);
client.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
}
string callback = client.GetList("Accounts").ToString();
Console.WriteLine(callback);
Console.ReadKey();
}
}
}
Со следующим приложением. конфигурации:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ListsSoap" closeTimeout="00:05:00" openTimeout="00:05:00"
receiveTimeout="00:30:00" sendTimeout="00:05:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://sharepointserver/crm/_vti_bin/Lists.asmx"
binding="basicHttpBinding" bindingConfiguration="ListsSoap"
contract="listService.ListsSoap" name="ListsSoap" />
</client>
</system.serviceModel>
</configuration>
программа выводит:
Имя: MYDOMAIN \ MyUserName
идентифицированные: Правда
Тип аутентификации: Kerberos
Xml выход из SharePoint на экране.
Я сказал ИТ-подразделению перейти на Kerberos более года назад. Спасибо за ответ, как и ожидалось, теперь я должен использовать общий аккаунт. –