cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS & Active Directory

baaka
Champ in-the-making
Champ in-the-making
Hello there,
I've configured Alfresco to use users who are stored in Active Directory. I want to connect Alfresco via CMIS,
is it possible to tell CMIS that users're already authenticated? (actually I've not got access to passwords, so
I want to connect Alfresco using CMIS, without password)
1 ACCEPTED ANSWER

kaynezhang
World-Class Innovator
World-Class Innovator
No since you are using atom binding<strong>parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());</strong> in your code ,you should provide ATOMPUB_URL like this
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");


If you are using cmis 1.0 atom binding ,you can write i like this

      Map<String, String> parameter = new HashMap<String, String>();

      parameter.put(SessionParameter.USER, "ROLE_TICKET");
      parameter.put(SessionParameter.PASSWORD, ticket);

      // Specify the connection settings
      parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");
      parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

      parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

      // Create a session
      SessionFactory factory = SessionFactoryImpl.newInstance();
      Session session = factory.getRepositories(parameter).get(0).createSession();


I have already tested in my envirment ,it works fine ,I can login correctly.

View answer in original post

4 REPLIES 4

kaynezhang
World-Class Innovator
World-Class Innovator
Authenticating with Alfresco ticket using OpenCMIS
Ticket can be specified in password, if any of the following are true:
a) username is not specified (i.e. null, or length of zero)
b) username is equal to "ROLE_TICKET" (case insensitive)

baaka
Champ in-the-making
Champ in-the-making
Thanks for your reply,
Here is my code snippet:
        parameter.put(SessionParameter.USER, "ROLE_TICKET");
        parameter.put(SessionParameter.PASSWORD, "TICKET….");
        parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
        parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

It throws me exception, that said that user isn't authorized.
org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException: Unauthorized

baaka
Champ in-the-making
Champ in-the-making
I've corrected it by changing atompub url from http://hostSmiley Tongueort/alfresco/cmisatom/ to http://hostSmiley Tongueort/alfresco/service/cmis.

Any other ideas about above mantioned? (For ticket we still need password)

kaynezhang
World-Class Innovator
World-Class Innovator
No since you are using atom binding<strong>parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());</strong> in your code ,you should provide ATOMPUB_URL like this
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");


If you are using cmis 1.0 atom binding ,you can write i like this

      Map<String, String> parameter = new HashMap<String, String>();

      parameter.put(SessionParameter.USER, "ROLE_TICKET");
      parameter.put(SessionParameter.PASSWORD, ticket);

      // Specify the connection settings
      parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");
      parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());

      parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

      // Create a session
      SessionFactory factory = SessionFactoryImpl.newInstance();
      Session session = factory.getRepositories(parameter).get(0).createSession();


I have already tested in my envirment ,it works fine ,I can login correctly.