4

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 !!

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
Vincent
  • 510
  • 1
  • 5
  • 23
  • Do you want to perform an anonymous (guest) request, or are you trying to do some sort of single sign-on magic? – Gagravarr May 09 '12 at 16:58

5 Answers5

2

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/

sabisabi
  • 1,501
  • 5
  • 22
  • 40
2

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.

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
1

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.

Vincent
  • 510
  • 1
  • 5
  • 23
  • Thanks a lot for the patch! To be clear, this is for NTLM-based SSO (Alfresco passthru + ldap-ad), not for Kerberos-based SSO, right? – Nicolas Raoul Oct 23 '13 at 08:32
0

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....);
David.Chu.ca
  • 37,408
  • 63
  • 148
  • 190
  • There should be a ntlm parameterI think : http://chemistry.apache.org/java/0.7.0/maven/apidocs/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.html#NTLM_AUTHENTICATION_PROVIDER but it's not implemented in dotCMIS as far as I studied it and I don't have knowledge on how to add it – Vincent May 09 '12 at 16:13
0

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

Rocky111
  • 255
  • 1
  • 5
  • 19