【问题标题】:how to access Cmis without a password?如何在没有密码的情况下访问 Cmis?
【发布时间】:2012-05-09 15:35:07
【问题描述】:

我正在尝试使用 DotCmis (http://chemistry.apache.org/dotnet/dotcmis.html) 通过 cmis 查询 Alfresco

只要我指定用户/密码,它就可以正常工作。

如何在不指定密码的情况下做到这一点?我想使用 CurrentIdentity 之类的,但我不能......

parameters[SessionParameter.BindingType] = BindingType.AtomPub;
parameters[SessionParameter.AtomPubUrl] = "http://server/alfresco/service/cmis";
parameters[SessionParameter.User] = "user";
parameters[SessionParameter.Password] = "password";

通过 Apache 文档,您似乎可以将 CmisBindingFactory 用于 ntlm,但我认为 dotCmis 不支持它。 我对 java / apache 一无所知,所以我在这里迷路了。

可以实现吗?还是您可以推荐任何其他图书馆?

如果你能提供帮助,真的非常感谢!

【问题讨论】:

  • 您想执行匿名(访客)请求,还是尝试执行某种单点登录魔术?

标签: c# alfresco ntlm cmis dotcmis


【解决方案1】:

不确定这是否会有所帮助,但是:

dotCMIS 将在下一版本 (0.5) NTLM 中支持,对于 0.4,您可以下载补丁 https://issues.apache.org/jira/browse/CMIS-531 或从主干获取整个源 https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk/

【讨论】:

    【解决方案2】:

    DotCMIS 0.5 已经发布,感谢 Vincent,它现在应该可以开箱即用了 :-)

    示例代码:

    // Parameters.
    Dictionary<string, string> parameters = new Dictionary<string, string>();
    parameters[SessionParameter.AtomPubUrl] = "http://yourserver:port/alfresco/cmisatom"; // Change this to yours.
    parameters[SessionParameter.BindingType] = BindingType.AtomPub;
    parameters[SessionParameter.AuthenticationProviderClass] = "DotCMIS.Binding.NtlmAuthenticationProvider";
    
    // No need for username and password, thanks to NTLM-based SSO (Single Sign On)
    //parameters[SessionParameter.User] = "<username>";
    //parameters[SessionParameter.Password] = "<password>";
    
    SessionFactory factory = SessionFactory.NewInstance();
    ISession session = factory.GetRepositories(parameters)[0].CreateSession();
    
    // List all children of the root folder.
    IFolder rootFolder = session.GetRootFolder();
    foreach (ICmisObject cmisObject in rootFolder.GetChildren())
    {
        Console.WriteLine(cmisObject.Name);
    }
    

    请注意AuthenticationProviderClass 行。
    确保不要定义用户名和密码,否则将不起作用。

    Full working sample C# solution.

    【讨论】:

      【解决方案3】:

      我向 DotCmis 提交了一个补丁,现在最新版本可以与 Ntlm 一起使用。 这是在我这边在 Alfresco 上测试的。

      抱歉,在这里回答太久了。

      【讨论】:

      • 非常感谢补丁!需要明确的是,这是针对基于 NTLM 的 SSO(Alfresco passthru + ldap-ad),而不是针对基于 Kerberos 的 SSO,对吧?
      【解决方案4】:

      我不熟悉 CMIS。从您的代码看来,参数未传递给服务器。您是否需要通过添加参数来做不同的事情?例如,

      parameters.add(value, key....);
      

      【讨论】:

      【解决方案5】:

      默认启用 WS-Security (UsernameToken) 和用户名 并且必须提供密码。尝试禁用 WS-Security

      我不熟悉 CMIS

      在这里检查..可能会有所帮助

      https://svn.apache.org/repos/infra/websites/production/chemistry/content/opencmis-client-bindings.html

      【讨论】:

      • 我不认为你可以这样做,我也不能通过网络服务手动登录
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-13
      • 2011-11-18
      • 2019-10-23
      • 1970-01-01
      • 1970-01-01
      • 2020-12-25
      • 2014-02-20
      相关资源
      最近更新 更多