Kaydet (Commit) 7586bea9 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Add data for Alfresco Cloud CMIS connection

Change-Id: Ie5374f2e81e1429294805f05ae432fba86cc50df
üst 87bd65ef
......@@ -23,6 +23,16 @@
#define GDRIVE_REDIRECT_URI "urn:ietf:wg:oauth:2.0:oob"
#define GDRIVE_SCOPE "https://www.googleapis.com/auth/drive"
/* Alfresco Cloud */
#define ALFRESCO_CLOUD_BASE_URL "https://api.alfresco.com/"
#define ALFRESCO_CLOUD_CLIENT_ID ""
#define ALFRESCO_CLOUD_CLIENT_SECRET ""
#define ALFRESCO_CLOUD_AUTH_URL "https://api.alfresco.com/auth/oauth/versions/2/authorize"
#define ALFRESCO_CLOUD_TOKEN_URL "https://api.alfresco.com/auth/oauth/versions/2/token"
#define ALFRESCO_CLOUD_REDIRECT_URI "http://127.0.0.1/Callback"
#define ALFRESCO_CLOUD_SCOPE "public_api"
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -2032,19 +2032,33 @@ AC_ARG_WITH(all-tarballs,
[Download all external tarballs unconditionally]))
AC_ARG_WITH(gdrive-client-id,
AS_HELP_STRING([--with-drive-client-id],
AS_HELP_STRING([--with-gdrive-client-id],
[Provides the client id of the application for OAuth2 authentication
on Google Drive. If either this or --with-gdrive-client-secret is
empty, the feature will be disabled]),
)
AC_ARG_WITH(gdrive-client-secret,
AS_HELP_STRING([--with-drive-client-secret],
AS_HELP_STRING([--with-gdrive-client-secret],
[Provides the client secret of the application for OAuth2
authentication on Google Drive. If either this or
--with-gdrive-client-id is empty, the feature will be disabled]),
)
AC_ARG_WITH(alfresco-cloud-client-id,
AS_HELP_STRING([--with-alfresco-cloud-client-id],
[Provides the client id of the application for OAuth2 authentication
on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
empty, the feature will be disabled]),
)
AC_ARG_WITH(alfresco-cloud-client-secret,
AS_HELP_STRING([--with-alfresco-cloud-client-secret],
[Provides the client secret of the application for OAuth2
authentication on Alfresco Cloud. If either this or
--with-alfresco-cloud-client-id is empty, the feature will be disabled]),
)
dnl ===================================================================
dnl Do we want to use pre-build binary tarball for recompile
dnl ===================================================================
......@@ -12314,16 +12328,42 @@ AC_SUBST(TESTINSTALLDIR)
AC_MSG_CHECKING([for Google Drive client id and secret])
GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
if test "$with_gdrive_client_id" = "no" -o -n "$with_driver_client_id"; then
if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
GDRIVE_CLIENT_ID="\"\""
fi
if test "$with_gdrive_client_secret" = "no" -o -n "$with_driver_client_secret"; then
if test "$with_gdrive_client_secret" = "no" -o -z "$with_gdrive_client_secret"; then
GDRIVE_CLIENT_SECRET="\"\""
fi
if test -z "$GDRIVE_CLIENT_ID" -o -z "$GDRIVE_CLIENT_SECRET"; then
AC_MSG_RESULT([not set])
else
AC_MSG_RESULT([set])
fi
AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
ALFRESCO_CLOUD_CLIENT_ID="\"\""
fi
if test "$with_alfresco_cloud_client_secret" = "no" -o -z "$with_alfresco_cloud_client_secret"; then
ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
fi
if test -z "$ALFRESCO_CLOUD_CLIENT_ID" -o -z "$ALFRESCO_CLOUD_CLIENT_SECRET"; then
AC_MSG_RESULT([not set])
else
AC_MSG_RESULT([set])
fi
AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
# ===================================================================
# De- or increase default verbosity of build process
# ===================================================================
......
......@@ -576,6 +576,7 @@
<prop oor:name="CmisServersUrls">
<value>
<it>http://&lt;host&gt;/alfresco/cmisws/RepositoryService?wsdl</it>
<it>https://api.alfresco.com/cmis/versions/1.0/atom/</it>
<it>http://&lt;host&gt;/p8cmis/wsdl</it>
<it>https://apps.lotuslive.com/files/basic/cmis/my/servicedoc</it>
<it>http://&lt;host&gt;/servlet/cmis/repository/_P&lt;Quickr place name&gt;_RMain.nsf/servicedoc</it>
......@@ -589,6 +590,7 @@
<prop oor:name="CmisServersNames">
<value>
<it>Alfresco 4</it>
<it>Alfresco Cloud</it>
<it>IBM FileNet P8</it>
<it>Lotus Live Files</it>
<it>Lotus Quickr Domino</it>
......
......@@ -281,13 +281,16 @@ CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder ) :
// Load the ServerType entries
bool bSkipGDrive = OUString( GDRIVE_CLIENT_ID ).isEmpty() ||
OUString( GDRIVE_CLIENT_SECRET ).isEmpty();
bool bSkipAlfresco = OUString( ALFRESCO_CLOUD_CLIENT_ID ).isEmpty() ||
OUString( ALFRESCO_CLOUD_CLIENT_SECRET ).isEmpty();
Sequence< OUString > aTypesUrlsList( officecfg::Office::Common::Misc::CmisServersUrls::get( xContext ) );
Sequence< OUString > aTypesNamesList( officecfg::Office::Common::Misc::CmisServersNames::get( xContext ) );
for ( sal_Int32 i = 0; i < aTypesUrlsList.getLength( ) && aTypesNamesList.getLength( ); ++i )
{
OUString sUrl = aTypesUrlsList[i];
if ( !( sUrl == GDRIVE_BASE_URL && bSkipGDrive ) )
if ( !( sUrl == GDRIVE_BASE_URL && bSkipGDrive ) &&
!( sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL ) && bSkipAlfresco ) )
{
m_pLBServerType->InsertEntry( aTypesNamesList[i] );
m_aServerTypesURLs.push_back( sUrl );
......
......@@ -291,6 +291,11 @@ namespace cmis
GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
GDRIVE_CLIENT_ID, GDRIVE_CLIENT_SECRET ) );
if ( m_aURL.getBindingUrl().startsWith( ALFRESCO_CLOUD_BASE_URL ) )
oauth2Data.reset( new libcmis::OAuth2Data(
ALFRESCO_CLOUD_AUTH_URL, ALFRESCO_CLOUD_TOKEN_URL,
ALFRESCO_CLOUD_SCOPE, ALFRESCO_CLOUD_REDIRECT_URI,
ALFRESCO_CLOUD_CLIENT_ID, ALFRESCO_CLOUD_CLIENT_SECRET ) );
m_pSession = libcmis::SessionFactory::createSession(
OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ),
......
......@@ -17,6 +17,7 @@
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <comphelper/processfactory.hxx>
#include <config_oauth2.h>
#include <rtl/uri.hxx>
#include <ucbhelper/cancelcommandexecution.hxx>
#include <ucbhelper/commandenvironment.hxx>
......@@ -147,6 +148,16 @@ namespace cmis
{
// Create a session to get repositories
libcmis::OAuth2DataPtr oauth2Data;
if ( m_aURL.getBindingUrl( ) == GDRIVE_BASE_URL )
oauth2Data.reset( new libcmis::OAuth2Data(
GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
GDRIVE_CLIENT_ID, GDRIVE_CLIENT_SECRET ) );
if ( m_aURL.getBindingUrl().startsWith( ALFRESCO_CLOUD_BASE_URL ) )
oauth2Data.reset( new libcmis::OAuth2Data(
ALFRESCO_CLOUD_AUTH_URL, ALFRESCO_CLOUD_TOKEN_URL,
ALFRESCO_CLOUD_SCOPE, ALFRESCO_CLOUD_REDIRECT_URI,
ALFRESCO_CLOUD_CLIENT_ID, ALFRESCO_CLOUD_CLIENT_SECRET ) );
libcmis::Session* session = libcmis::SessionFactory::createSession(
OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment