如何在没有密码的情况下访问Cmis?

时间:2012-05-09 15:35:07

标签: c# alfresco ntlm cmis dotcmis

我正在尝试使用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一无所知,所以我在这里非常失落。

可以实现吗?或者你可以建议其他图书馆吗?

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

5 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分: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

答案 2 :(得分:1)

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

对不起,我花了太长时间才回答这个问题。

答案 3 :(得分:0)

我不熟悉CMIS。从您的代码中,看起来这些参数不会传递给服务器。你需要通过添加参数来做到这一点吗?例如,

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

答案 4 :(得分:0)

  默认情况下启用WS-Security(UsernameToken)中的

和用户名   并且必须提供密码。尝试禁用WS-Security

     

我不熟悉CMIS

     

在这里查看..可能有帮助

     

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

相关问题