how to access Cmis without a password?

1.9k Views Asked by At

I'm trying to query Alfresco through cmis with DotCmis ( http://chemistry.apache.org/dotnet/dotcmis.html )

It's working ok as long as I specify a user / password.

How can I do that without specifying a password ? I'd like to use the CurrentIdentity or something but I can't...

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

Through the Apache documentation, it seems you can use a CmisBindingFactory for ntlm but dotCmis does not support it I think. I know nothing of java / apache so I'm awfully lost here.

Can it be achieved ? or is there any other library you may suggest ?

A real big thank you if you can help !!

5

There are 5 best solutions below

1
On BEST ANSWER

I submitted a patch to DotCmis and now the latest build works with Ntlm. This was tested on my side on Alfresco.

Sorry it took me too long to answer here.

0
On

DotCMIS 0.5 has been released, so thanks to Vincent it should work out-of-the-box now :-)

Sample code:

// 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);
}

Please note the AuthenticationProviderClass line.
Make sure to NOT define username and password, otherwise it will not work.

Full working sample C# solution.

1
On

I am not familiar with CMIS. From your codes, it looks like that parameters are not passed to the server. Do you need to do it differently by adding parameters? For example,

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

in WS-Security (UsernameToken) is enabled by default and a username and a password have to be provided. Try to disable WS-Security

i am not familiar with the CMIS

check it here.. might help

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

0
On

not sure that this will help out but:

dotCMIS will support in the next version (0.5) NTLM, for 0.4 you could downoad the Patch https://issues.apache.org/jira/browse/CMIS-531 or get the whole source from trunk https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk/