Connecting Apache Chemistry CMIS Workbench to the Alfresco Cloud
Anyone who’s familiar with CMIS and the Apache Chemistry project will likely be familiar with the CMIS Workbench. It’s a handy developer-oriented GUI tool that provides a low level view of any CMIS-compliant repository.
With the release of the Alfresco Public API back in October, the Alfresco Cloud is now a CMIS-compliant repository, and can hence be accessed using the CMIS Workbench. The CMIS Workbench does not yet directly support the OAuth2 authentication mechanism used in the Alfresco Cloud however; this post describes the steps necessary to get it working.
For starters, you’ll need accounts on both the Alfresco Cloud and the Alfresco Developer Portal (signup to both of these services is free). You’ll then need to download v0.8.0 or newer of the CMIS Workbench and unzip it somewhere convenient on your hard drive. It also helps to have some understanding of the OAuth2 authentication mechanism, how the various OAuth2 codes and tokens are obtained and used, and how OAuth2 has been implemented in the Alfresco Cloud – if you’re not familiar with these concepts you may find this DevCon 2012 session helpful.
Next you need to obtain an OAuth2 access token from the Alfresco Cloud. This is best achieved using a pre-built application, such as my Grails sample app (which conveniently dumps the access token to the log).
After that we’re ready to run the CMIS Workbench. After the “Login” dialog appears, switch to the “Expert” tab and paste in the following text (note: on Mac OSX you need to use the Ctrl key rather than the Command key for select and paste operations):
# Alfresco Cloud (CMIS 1.0 AtomPub) org.apache.chemistry.opencmis.binding.spi.type=atompub org.apache.chemistry.opencmis.binding.atompub.url=https://api.alfresco.com/cmis/versions/1.0/atom org.apache.chemistry.opencmis.binding.auth.http.basic=false # Please provide a valid OAuth access token in the following property # Note that Alfresco Cloud access tokens have a limited lifetime (currently 1 hour) and the OpenCMIS Workbench does not auto-refresh the access token when it expires org.apache.chemistry.opencmis.binding.header.0=Authorization:Bearer ####ACCESS_TOKEN#### # Other optional options - compression etc. - may be provided here
Replace the text “####ACCESS_TOKEN####” with the access token you obtained previously, ensuring there is a single space character between “Bearer” and the access token value. This should end up looking similar to the following (click to embiggen):
Click “Load Repositories” and if the settings are correct the Alfresco Networks you are a member of will be displayed in the repositories dropdown. Pick one (don’t be surprised if you have only one – that’s the normal case), click the Login button and you should be viewing your Alfresco Cloud content using the CMIS Workbench!