Tridion 2011核心服务:无法在SSO环境中连接
本文关键字:SSO 环境 连接 2011 核心 服务 Tridion | 更新日期: 2023-09-27 18:27:16
在尝试连接到核心服务时,我收到以下错误:
HTTP请求被客户端身份验证方案"匿名"禁止
Tridion环境使用SiteMinder的SSO进行配置。
这是我的代码:
public static ICoreService2010 GetTridionClient()
{
var binding = new BasicHttpBinding()
{
Name = "BasicHttpBinding_TridionCoreService",
CloseTimeout = new TimeSpan(0, 1, 0),
OpenTimeout = new TimeSpan(0, 1, 0),
ReceiveTimeout = new TimeSpan(0, 10, 0),
SendTimeout = new TimeSpan(0, 1, 0),
AllowCookies = false,
BypassProxyOnLocal = false,
HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
MaxBufferSize = 4194304, // 4MB
MaxBufferPoolSize = 4194304,
MaxReceivedMessageSize = 4194304,
MessageEncoding = WSMessageEncoding.Text,
TextEncoding = System.Text.Encoding.UTF8,
TransferMode = TransferMode.Buffered,
UseDefaultWebProxy = true,
ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
{
MaxDepth = 32,
MaxStringContentLength = 4194304, // 4MB
MaxArrayLength = 4194304,
MaxBytesPerRead = 4194304,
MaxNameTableCharCount = 16384
},
Security = new BasicHttpSecurity()
{
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
Transport = new HttpTransportSecurity()
{
ClientCredentialType = HttpClientCredentialType.None,
},
Message = new BasicHttpMessageSecurity()
{
ClientCredentialType = BasicHttpMessageCredentialType.UserName
}
}
};
string hostname = ConfigurationManager.AppSettings["TridionUrl"];
string username = ConfigurationManager.AppSettings["TridionUsername"];
hostname = string.Format("{0}{1}{2}",
hostname.StartsWith("http") ? "" : "http://",
hostname,
hostname.EndsWith("/") ? "" : "/");
var endpoint = new EndpointAddress(hostname +
"/webservices/CoreService.svc/basicHttp_2010");
var factory = new ChannelFactory<ICoreService2010>(binding, endpoint);
factory.Credentials.UserName.UserName = username;
return factory.CreateChannel();
}
有人有使用Windows以外的身份验证类型与核心服务交互的经验吗?
更新:
我现在得到错误:
客户端身份验证方案为"基本"时,HTTP请求被禁止。
在/webservices/web.config中应该为绑定使用什么clientCredentialType?
当我在/webservers/web.config中取消对SsoAgentHttpModule的注释时,我们在web服务上得到了一个500错误,所以SDL告诉我们不要对此进行注释。
我认为CoreService需要此模块才能使用身份验证方案"Basic"进行身份验证?
您的代码有两个问题:
-
您已经在服务器上将authentition设置为匿名,并假设在客户端上也应该设置相同的身份验证,但事实并非如此。您还在服务器上启用了LDAP SSO模块,一旦打开匿名身份验证,该模块就会启动。在客户端,它看起来像是简单的基本身份验证,所以您的客户端安全代码应该是这样的:
Security = new BasicHttpSecurity() { Mode = BasicHttpSecurityMode.TransportCredentialOnly, Transport = new HttpTransportSecurity() { ClientCredentialType = HttpClientCredentialType.Basic, } }
-
您设置了用户名,但没有设置密码,所以:
factory.Credentials.UserName.UserName = username; factory.Credentials.UserName.Password = password;
此外,请记住,在设置用户时,您可能需要指定用户名限定符(默认为SSO),如SSO''User
如果你仍然有问题,这应该会让你更近一步——请更新你的问题,但最近有例外。