我的 C# 应用程序部署在 Sharepoint 中,我想用 C# 从 EMC DOCUMENTUM D2 下载文档并将其上传到 Sharepoint 文档库中。我正在使用 kerberos 身份验证进行单点登录。当我搜索文档时,Kerberos 工作正常但是当我尝试从 D2 下载文档时,代码正在使用服务帐户来下载文档(我知道它在我看到时使用服务帐户Documentum 的传入流量日志)。
IObjectService objectService = this.GetRemoteServiceDownload<IObjectService>(moduleName);
函数的定义。
protected IObjectService GetRemoteServiceDownload<IObjectService>(string serviceModule)
{
KerberosTokenHandler handler = new KerberosTokenHandler();
try
{
using (KerberosClientContext kerberosClientContext = new KerberosClientContext(servicePrincipalName, true, ImpersonationLevel.Delegation))
{
try
{
KerberosBinarySecurityToken token = new KerberosBinarySecurityToken(kerberosClientContext.InitializeContext(), KerberosValueType.KERBEROSV5_AP_REQ);
handler.SetBinarySecurityToken(token);
List<IEndpointBehavior> handlers = new List<IEndpointBehavior>();
handlers.Add(handler);
handlers.Add(new DFSBindingBehaviour(0, 10, 0, 0, 10, 0, 40960, 32, 16384, 16384, 20000000));
var remoteService = ServiceFactory.Instance.GetRemoteService<IObjectService>(serviceContext, serviceModule, address, handlers);
return remoteService;
}
catch (Exception ex)
{
Service.LoggerService.SetError(new Exception("In GetRemoteService" + ex.Message, ex));
return default(IObjectService);
}
}
}
catch (Exception ex)
{
Service.LoggerService.SetError(new Exception("In GetRemoteService using" + ex.Message, ex));
return default(IObjectService);
}
}