簡體   English   中英

Tridion 2011核心服務:無法在SSO環境中進行連接

[英]Tridion 2011 Core Service: Unable to connect in a SSO environment

在嘗試連接到Core Service時,出現以下錯誤:

客戶端身份驗證方案“Anonymous”禁止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以外的身份驗證類型與Core Service進行交互的經驗?

更新:

我現在得到錯誤:

客戶端身份驗證方案“Basic”禁止HTTP請求。

什么clientCredentialType應該在/webservices/web.config中用於綁定?

當我取消注釋/webservies/web.config中的SsoAgentHttpModule時,我們在webservice上收到500錯誤,因此SDL告訴我們將此注釋掉。

我認為CoreService需要使用此模塊進行身份驗證方案'Basic'的身份驗證?

您的代碼有2個問題:

  1. 您已在服務器上將authenticntiction設置為匿名,並假設應在客戶端上設置相同,但事實並非如此。 您還啟用了在啟用匿名身份驗證后立即啟動的服務器上的LDAP SSO模塊。 在客戶端,它看起來像普通的基本身份驗證,因此您的客戶端安全代碼應如下所示:

     Security = new BasicHttpSecurity() { Mode = BasicHttpSecurityMode.TransportCredentialOnly, Transport = new HttpTransportSecurity() { ClientCredentialType = HttpClientCredentialType.Basic, } } 
  2. 您已設置用戶名,但未設置密碼,因此:

     factory.Credentials.UserName.UserName = username; factory.Credentials.UserName.Password = password; 

如果您仍然遇到問題,這應該會讓您更近一步 - 請使用最近的例外情況更新您的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM