diff options
-rw-r--r-- | config_host/config_oauth2.h.in | 10 | ||||
-rwxr-xr-x | configure.ac | 48 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/Common.xcu | 2 | ||||
-rw-r--r-- | svtools/source/dialogs/ServerDetailsControls.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_repo_content.cxx | 11 |
6 files changed, 76 insertions, 5 deletions
diff --git a/config_host/config_oauth2.h.in b/config_host/config_oauth2.h.in index 80800f5559b9..40c57a871a92 100644 --- a/config_host/config_oauth2.h.in +++ b/config_host/config_oauth2.h.in @@ -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: */ diff --git a/configure.ac b/configure.ac index b75be239292f..17aecb5943f9 100755 --- a/configure.ac +++ b/configure.ac @@ -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 # =================================================================== diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 0eb3e6414f77..dcb3f70edda3 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -576,6 +576,7 @@ <prop oor:name="CmisServersUrls"> <value> <it>http://<host>/alfresco/cmisws/RepositoryService?wsdl</it> + <it>https://api.alfresco.com/cmis/versions/1.0/atom/</it> <it>http://<host>/p8cmis/wsdl</it> <it>https://apps.lotuslive.com/files/basic/cmis/my/servicedoc</it> <it>http://<host>/servlet/cmis/repository/_P<Quickr place name>_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> diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 7a4b9fdf1cf1..a270a5dfe7b3 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -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 ); diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 771548619527..53777bc3b1d2 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -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( ) ), diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx index c3e605950a2b..88fefb5cb4c0 100644 --- a/ucb/source/ucp/cmis/cmis_repo_content.cxx +++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx @@ -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( ) ), |