AnsweredAssumed Answered

Getting a ticket in open CMIS and passing it to query service

Question asked by kartech11 on Jul 23, 2018
Latest reply on Jul 24, 2018 by afaust

Jeff Potts & alfresco experts, 

 

I have a username and password with which I get a ticket and then I use the ticket to query my alfresco repository. 

 

With Open CMIS how can I get a ticket and pass it along for querying

 

I am using the sample code in CMISExampleBase from Jeff Potts example to connect to my alfresco instance.

alfresco-developer-series/CMISExampleBase.java at master · jpotts/alfresco-developer-series · GitHub 

 

In the getSession method below, username and password is used to get a session, but my case is a bit different as outlined above. I need to pass username and password to get a ticket and then pass the ticket to my service. 

How can i achieve this?

 

 

public Session getSession() {

   if (session == null) {
      // default factory implementation
      SessionFactory factory = SessionFactoryImpl.newInstance();
      Map<String, String> parameter = new HashMap<String, String>();

      // user credentials
      parameter.put(SessionParameter.USER, getUser());
      parameter.put(SessionParameter.PASSWORD, getPassword());

      // connection settings
      //parameter.put(SessionParameter.ATOMPUB_URL, getServiceUrl()); // Uncomment for Atom Pub binding
      //parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); // Uncomment for Atom Pub binding

      parameter.put(SessionParameter.BROWSER_URL, getServiceUrl()); // Uncomment for Browser binding
      parameter.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value()); // Uncomment for Browser binding
     
      // Set the alfresco object factory
      // Used when using the CMIS extension for Alfresco for working with aspects and CMIS 1.0
      // This is not needed when using CMIS 1.1
      //parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
     
      List<Repository> repositories = factory.getRepositories(parameter);

      this.session = repositories.get(0).createSession();
   }
   return this.session;
}

Outcomes