From 002f33224802da1820f3152a030833b11ec77a9b Mon Sep 17 00:00:00 2001 From: Mihai Varga Date: Mon, 23 Jun 2014 19:14:08 +0300 Subject: OneDrive binding settings Change-Id: I72c97931098c1a029d39532e3433c0aeaba73e3f --- config_host/config_oauth2.h.in | 10 +++++++ configure.ac | 33 ++++++++++++++++++++++ .../registry/data/org/openoffice/Office/Common.xcu | 2 ++ svtools/source/dialogs/ServerDetailsControls.cxx | 6 +++- ucb/source/ucp/cmis/cmis_content.cxx | 5 ++++ ucb/source/ucp/cmis/cmis_repo_content.cxx | 5 ++++ 6 files changed, 60 insertions(+), 1 deletion(-) diff --git a/config_host/config_oauth2.h.in b/config_host/config_oauth2.h.in index 40c57a871a92..72c19a8aa670 100644 --- a/config_host/config_oauth2.h.in +++ b/config_host/config_oauth2.h.in @@ -33,6 +33,16 @@ #define ALFRESCO_CLOUD_REDIRECT_URI "http://127.0.0.1/Callback" #define ALFRESCO_CLOUD_SCOPE "public_api" + +/* OneDrive */ +#define ONEDRIVE_BASE_URL "https://apis.live.net/v5.0" +#define ONEDRIVE_CLIENT_ID "" +#define ONEDRIVE_CLIENT_SECRET "" +#define ONEDRIVE_AUTH_URL "https://login.live.com/oauth20_authorize.srf" +#define ONEDRIVE_TOKEN_URL "https://login.live.com/oauth20_token.srf" +#define ONEDRIVE_REDIRECT_URI "https://login.live.com/oauth20_desktop.srf" +#define ONEDRIVE_SCOPE "wl.offline_access" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configure.ac b/configure.ac index 5ef2401d34fc..a3a178137894 100644 --- a/configure.ac +++ b/configure.ac @@ -2209,6 +2209,19 @@ AC_ARG_WITH(alfresco-cloud-client-secret, --with-alfresco-cloud-client-id is empty, the feature will be disabled]), ) +AC_ARG_WITH(onedrive-client-id, + AS_HELP_STRING([--with-onedrive-client-id], + [Provides the client id of the application for OAuth2 authentication + on OneDrive. If either this or --with-onedrive-client-secret is + empty, the feature will be disabled]), +) + +AC_ARG_WITH(onedrive-client-secret, + AS_HELP_STRING([--with-onedrive-client-secret], + [Provides the client secret of the application for OAuth2 + authentication on OneDrive. If either this or + --with-onedrive-client-id is empty, the feature will be disabled]), +) dnl =================================================================== dnl Do we want to use pre-build binary tarball for recompile dnl =================================================================== @@ -12709,6 +12722,26 @@ fi AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID) AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET) +AC_MSG_CHECKING([for OneDrive client id and secret]) +ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\"" +ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\"" +if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then + ONEDRIVE_CLIENT_ID="\"\"" +fi + +if test "$with_onedrive_client_secret" = "no" -o -z "$with_onedrive_client_secret"; then + ONEDRIVE_CLIENT_SECRET="\"\"" +fi + +if test -z "$ONEDRIVE_CLIENT_ID" -o -z "$ONEDRIVE_CLIENT_SECRET"; then + AC_MSG_RESULT([not set]) +else + AC_MSG_RESULT([set]) +fi +AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID) +AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_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 dcb3f70edda3..5cc6649de177 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -585,6 +585,7 @@ http://ec2-184-72-233-127.compute-1.amazonaws.com/ot-cmis/services/RepositoryService?wsdl http://<host>/_vti_bin/CMISSoapwsdl.aspx https://www.googleapis.com/drive/v2 + https://apis.live.net/v5.0 @@ -599,6 +600,7 @@ OpenText ELS 10.2.0 SharePoint 2010 Google Drive + OneDrive diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 4bc907c1efba..1c723565b778 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -283,6 +283,9 @@ CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder ) : OUString( GDRIVE_CLIENT_SECRET ).isEmpty(); bool bSkipAlfresco = OUString( ALFRESCO_CLOUD_CLIENT_ID ).isEmpty() || OUString( ALFRESCO_CLOUD_CLIENT_SECRET ).isEmpty(); + bool bSkipOneDrive= OUString( ONEDRIVE_CLIENT_ID ).isEmpty() || + OUString( ONEDRIVE_CLIENT_SECRET ).isEmpty(); + Sequence< OUString > aTypesUrlsList( officecfg::Office::Common::Misc::CmisServersUrls::get( xContext ) ); Sequence< OUString > aTypesNamesList( officecfg::Office::Common::Misc::CmisServersNames::get( xContext ) ); @@ -290,7 +293,8 @@ CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder ) : { OUString sUrl = aTypesUrlsList[i]; if ( !( sUrl == GDRIVE_BASE_URL && bSkipGDrive ) && - !( sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL ) && bSkipAlfresco ) ) + !( sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL ) && bSkipAlfresco ) && + !( sUrl == ONEDRIVE_BASE_URL && bSkipOneDrive ) ) { 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 88b47847f606..29d43c3a0966 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -351,6 +351,11 @@ namespace cmis ALFRESCO_CLOUD_AUTH_URL, ALFRESCO_CLOUD_TOKEN_URL, ALFRESCO_CLOUD_SCOPE, ALFRESCO_CLOUD_REDIRECT_URI, ALFRESCO_CLOUD_CLIENT_ID, ALFRESCO_CLOUD_CLIENT_SECRET ) ); + if ( m_aURL.getBindingUrl( ) == ONEDRIVE_BASE_URL ) + oauth2Data.reset( new libcmis::OAuth2Data( + ONEDRIVE_AUTH_URL, ONEDRIVE_TOKEN_URL, + ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI, + ONEDRIVE_CLIENT_ID, ONEDRIVE_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 ea99c3509063..c6f6ff345613 100644 --- a/ucb/source/ucp/cmis/cmis_repo_content.cxx +++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx @@ -177,6 +177,11 @@ namespace cmis ALFRESCO_CLOUD_AUTH_URL, ALFRESCO_CLOUD_TOKEN_URL, ALFRESCO_CLOUD_SCOPE, ALFRESCO_CLOUD_REDIRECT_URI, ALFRESCO_CLOUD_CLIENT_ID, ALFRESCO_CLOUD_CLIENT_SECRET ) ); + if ( m_aURL.getBindingUrl( ) == ONEDRIVE_BASE_URL ) + oauth2Data.reset( new libcmis::OAuth2Data( + ONEDRIVE_AUTH_URL, ONEDRIVE_TOKEN_URL, + ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI, + ONEDRIVE_CLIENT_ID, ONEDRIVE_CLIENT_SECRET ) ); boost::scoped_ptr session(libcmis::SessionFactory::createSession( OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ), -- cgit