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;
}
You cannot obtain an authentication ticket via CMIS. The only way is via the Alfresco ReST API.
Thanks Axel Faust for your response. I wanted to use CMIS as it apparently is easier to extract all the folders, subfolders and documents along with their metadata . If I use Alfresco REST API is it easy to extract folders, subfolders , documents along with their metadata? What approach should I take for the above?
You asked for how to obtain a ticket, and I replied you cannot do that via CMIS but have to use ReST API. You can still use CMIS for those other use cases of dealing with files, folders etc. It just is not useful for dealing with tickets (apart from accepting ticket for authentication). Of course you can also use the new ReST API to deal with files and folders - it is a lot more low-level then CMIS but also less restrictive. I will not make any recommendation for that use case though since you need to figure out what works best for you.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.