Blame SOURCES/0001-Revert-tdf-101630-gdrive-support-w-oAuth-and-Drive-A.patch

76e0e0
From 12f14a6c9d2b5034df53646bbc57774c0c83ecaa Mon Sep 17 00:00:00 2001
76e0e0
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
76e0e0
Date: Fri, 3 Sep 2021 09:13:03 +0100
76e0e0
Subject: [PATCH] Revert "tdf#101630 - gdrive support w/oAuth and Drive API v3"
76e0e0
76e0e0
This reverts commit 854c03ebc94aae205b85d0c9d342048baf93e9a9.
76e0e0
---
76e0e0
 Repository.mk                                 |   2 +-
76e0e0
 config_host/config_oauth2.h.in                |   8 +-
76e0e0
 external/libcmis/UnpackedTarball_libcmis.mk   |   2 -
76e0e0
 external/libcmis/libcmis_gdrive.patch.1       | 702 ------------------
76e0e0
 .../libcmis_oauth_pw_as_refreshtoken.patch.1  | 185 -----
76e0e0
 .../data/org/openoffice/Office/Common.xcu     |   2 +-
76e0e0
 ucb/source/ucp/cmis/auth_provider.cxx         | 130 +---
76e0e0
 ucb/source/ucp/cmis/auth_provider.hxx         |   8 +-
76e0e0
 ucb/source/ucp/cmis/cmis_content.cxx          |  21 +-
76e0e0
 ucb/source/ucp/cmis/cmis_repo_content.cxx     |   4 +-
76e0e0
 10 files changed, 56 insertions(+), 1008 deletions(-)
76e0e0
 delete mode 100644 external/libcmis/libcmis_gdrive.patch.1
76e0e0
 delete mode 100644 external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1
76e0e0
76e0e0
diff --git a/Repository.mk b/Repository.mk
76e0e0
index 23c268775fcf..c887d9b4297d 100644
76e0e0
--- a/Repository.mk
76e0e0
+++ b/Repository.mk
76e0e0
@@ -432,7 +432,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
76e0e0
 	ucpexpand1 \
76e0e0
 	ucpext \
76e0e0
 	ucpimage \
76e0e0
-	$(if $(ENABLE_LIBCMIS),ucpcmis1) \
76e0e0
+	ucpcmis1 \
76e0e0
 	ucptdoc1 \
76e0e0
 	unordf \
76e0e0
 	unoxml \
76e0e0
diff --git a/config_host/config_oauth2.h.in b/config_host/config_oauth2.h.in
76e0e0
index 9945dda3dda5..a95015b41f3e 100644
76e0e0
--- a/config_host/config_oauth2.h.in
76e0e0
+++ b/config_host/config_oauth2.h.in
76e0e0
@@ -15,13 +15,13 @@
76e0e0
 
76e0e0
 
76e0e0
 /* Google Drive settings */
76e0e0
-#define GDRIVE_BASE_URL "https://www.googleapis.com/drive/v3"
76e0e0
+#define GDRIVE_BASE_URL "https://www.googleapis.com/drive/v2"
76e0e0
 #define GDRIVE_CLIENT_ID ""
76e0e0
 #define GDRIVE_CLIENT_SECRET ""
76e0e0
-#define GDRIVE_AUTH_URL "https://accounts.google.com/o/oauth2/v2/auth"
76e0e0
-#define GDRIVE_TOKEN_URL "https://oauth2.googleapis.com/token"
76e0e0
+#define GDRIVE_AUTH_URL "https://accounts.google.com/o/oauth2/auth"
76e0e0
+#define GDRIVE_TOKEN_URL "https://accounts.google.com/o/oauth2/token"
76e0e0
 #define GDRIVE_REDIRECT_URI "urn:ietf:wg:oauth:2.0:oob"
76e0e0
-#define GDRIVE_SCOPE "https://www.googleapis.com/auth/drive.file"
76e0e0
+#define GDRIVE_SCOPE "https://www.googleapis.com/auth/drive"
76e0e0
 
76e0e0
 
76e0e0
 /* Alfresco Cloud */
76e0e0
diff --git a/external/libcmis/UnpackedTarball_libcmis.mk b/external/libcmis/UnpackedTarball_libcmis.mk
76e0e0
index 8398853e4511..a5be3078c95a 100644
76e0e0
--- a/external/libcmis/UnpackedTarball_libcmis.mk
76e0e0
+++ b/external/libcmis/UnpackedTarball_libcmis.mk
76e0e0
@@ -17,8 +17,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libcmis, \
76e0e0
 	external/libcmis/libcmis-libxml2_compatibility.patch \
76e0e0
 	external/libcmis/0001-rename-class-GetObject-to-avoid-name-clash-on-Window.patch \
76e0e0
 	external/libcmis/libcmis_onedrive.patch \
76e0e0
-	external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1 \
76e0e0
-	external/libcmis/libcmis_gdrive.patch.1 \
76e0e0
 ))
76e0e0
 
76e0e0
 # vim: set noet sw=4 ts=4:
76e0e0
diff --git a/external/libcmis/libcmis_gdrive.patch.1 b/external/libcmis/libcmis_gdrive.patch.1
76e0e0
deleted file mode 100644
76e0e0
index 24ff65d1ef15..000000000000
76e0e0
--- a/external/libcmis/libcmis_gdrive.patch.1
76e0e0
+++ /dev/null
76e0e0
@@ -1,702 +0,0 @@
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-document.cxx libcmis/src/libcmis/gdrive-document.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-document.cxx	2021-07-27 19:11:02.679247008 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-document.cxx	2021-07-27 19:11:18.873246420 +0200
76e0e0
-@@ -145,23 +145,17 @@
76e0e0
- {
76e0e0
-     if ( !os.get( ) )
76e0e0
-         throw libcmis::Exception( "Missing stream" );
76e0e0
--    if ( !isImmutable( ) )
76e0e0
--        throw libcmis::Exception( string ( "Document " + getId( )+ 
76e0e0
--                                    " is not editable" ) );
76e0e0
--    string putUrl = getUploadUrl( ) + getId( );
76e0e0
--    putUrl += "?uploadType=media";
76e0e0
--    
76e0e0
--    // If it's a Google document, convert it 
76e0e0
--    if ( isGoogleDoc( ) )
76e0e0
--        putUrl  += "&convert=true";
76e0e0
-+
76e0e0
-+    string putUrl = GDRIVE_UPLOAD_LINK + getId( ) + "?uploadType=media";
76e0e0
- 
76e0e0
-     // Upload stream
76e0e0
-     boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) );
76e0e0
-     vector <string> headers;
76e0e0
-     headers.push_back( string( "Content-Type: " ) + contentType );
76e0e0
-+    string res;
76e0e0
-     try
76e0e0
-     {
76e0e0
--        getSession()->httpPutRequest( putUrl, *is, headers );
76e0e0
-+        res = getSession()->httpPatchRequest( putUrl, *is, headers )->getStream()->str();
76e0e0
-     }
76e0e0
-     catch ( const CurlException& e )
76e0e0
-     {
76e0e0
-@@ -181,35 +175,10 @@
76e0e0
- {
76e0e0
-     if ( !os.get( ) )
76e0e0
-         throw libcmis::Exception( "Missing stream" );
76e0e0
--    
76e0e0
--    if ( !isImmutable( ) )
76e0e0
--        throw libcmis::Exception( string ( "Document " + getId( )+ 
76e0e0
--                                    " is not editable" ) );
76e0e0
--    string metaUrl = getUrl( );
76e0e0
--
76e0e0
--    // If it's a Google document, convert it 
76e0e0
--    if ( isGoogleDoc( ) )
76e0e0
--        metaUrl += "?convert=true";
76e0e0
--
76e0e0
--    // Update file name meta information
76e0e0
--    if ( !fileName.empty( ) && fileName != getContentFilename( ) )
76e0e0
--    {
76e0e0
--        Json metaJson;
76e0e0
--        Json fileJson( fileName.c_str( ) );
76e0e0
--        metaJson.add("title", fileJson );
76e0e0
--
76e0e0
--        std::istringstream is( metaJson.toString( ) );
76e0e0
--        vector<string> headers;
76e0e0
--        headers.push_back( "Content-Type: application/json" );
76e0e0
--        try
76e0e0
--        {
76e0e0
--            getSession()->httpPutRequest( metaUrl, is, headers );
76e0e0
--        }
76e0e0
--        catch ( const CurlException& e )
76e0e0
--        {
76e0e0
--            throw e.getCmisException( );
76e0e0
--        }
76e0e0
--    }
76e0e0
-+
76e0e0
-+    // TODO: when would the filename need an update?
76e0e0
-+    if (!fileName.empty() && fileName != getContentFilename())
76e0e0
-+        std::cout << "filename change is not implemented in setContentStream" << std::endl;
76e0e0
- 
76e0e0
-     // Upload stream
76e0e0
-     uploadStream( os, contentType );
76e0e0
-@@ -251,7 +220,7 @@
76e0e0
- vector< libcmis::DocumentPtr > GDriveDocument::getAllVersions( ) 
76e0e0
- {   
76e0e0
-     vector< libcmis::DocumentPtr > revisions;
76e0e0
--    string versionUrl = getUrl( ) + "/revisions";
76e0e0
-+    string versionUrl = GDRIVE_METADATA_LINK + getId( ) + "/revisions";
76e0e0
-     // Run the http request to get the properties definition
76e0e0
-     string res;
76e0e0
-     try
76e0e0
-@@ -263,7 +232,7 @@
76e0e0
-         throw e.getCmisException( );
76e0e0
-     }
76e0e0
-     Json jsonRes = Json::parse( res );        
76e0e0
--    Json::JsonVector objs = jsonRes["items"].getList( );
76e0e0
-+    Json::JsonVector objs = jsonRes["revisions"].getList( );
76e0e0
-    
76e0e0
-     string parentId = getStringProperty( "cmis:parentId" );
76e0e0
- 
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-folder.cxx libcmis/src/libcmis/gdrive-folder.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-folder.cxx	2021-07-27 19:11:02.678247008 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-folder.cxx	2021-07-27 19:11:18.874246420 +0200
76e0e0
-@@ -62,8 +62,8 @@
76e0e0
-     // Instead of sending multiple queries for children,
76e0e0
-     // we send a single query to search for objects where parents
76e0e0
-     // include the folderID.
76e0e0
--    string query = getSession( )->getBindingUrl( ) + 
76e0e0
--        "/files?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false";
76e0e0
-+    string query = GDRIVE_METADATA_LINK + "?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false" +
76e0e0
-+        "&fields=files(kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size)";
76e0e0
- 
76e0e0
-     string res;
76e0e0
-     try
76e0e0
-@@ -76,7 +76,7 @@
76e0e0
-     }
76e0e0
- 
76e0e0
-     Json jsonRes = Json::parse( res );
76e0e0
--    Json::JsonVector objs = jsonRes["items"].getList( );
76e0e0
-+    Json::JsonVector objs = jsonRes["files"].getList( );
76e0e0
-     
76e0e0
-     // Create children objects from Json objects
76e0e0
-     for(unsigned int i = 0; i < objs.size(); i++)
76e0e0
-@@ -95,7 +95,7 @@
76e0e0
- string GDriveFolder::uploadProperties( Json properties )
76e0e0
- {
76e0e0
-     // URL for uploading meta data
76e0e0
--    string metaUrl =  getSession()->getBindingUrl() + "/files/";
76e0e0
-+    string metaUrl =  GDRIVE_METADATA_LINK + "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime";
76e0e0
- 
76e0e0
-     // add parents to the properties    
76e0e0
-     properties.add( "parents", GdriveUtils::createJsonFromParentId( getId( ) ) );
76e0e0
-@@ -147,9 +147,15 @@
76e0e0
-     
76e0e0
-     Json propsJson = GdriveUtils::toGdriveJson( properties );
76e0e0
- 
76e0e0
--    // Add filename to properties
76e0e0
--    Json jsonFilename( fileName.c_str( ) );
76e0e0
--    propsJson.add( "title", jsonFilename );
76e0e0
-+    if(!fileName.empty()) {
76e0e0
-+        // use provided filename
76e0e0
-+        Json jsonFilename( fileName.c_str( ) );
76e0e0
-+
76e0e0
-+        propsJson.add( "name", jsonFilename );
76e0e0
-+    }
76e0e0
-+    if(!contentType.empty()) {
76e0e0
-+        propsJson.add( "mimeType", Json(contentType.c_str()));
76e0e0
-+    }
76e0e0
-     
76e0e0
-     // Upload meta-datas
76e0e0
-     string res = uploadProperties( propsJson);
76e0e0
-@@ -171,12 +177,9 @@
76e0e0
-     libcmis::UnfileObjects::Type /*unfile*/, 
76e0e0
-     bool /*continueOnError*/ ) 
76e0e0
- {
76e0e0
--    // Object remove doesn't work with folder
76e0e0
--    // Using trash instead
76e0e0
-     try
76e0e0
-     {   
76e0e0
--        istringstream is( "" );
76e0e0
--        getSession( )->httpPostRequest( getUrl( ) + "/trash", is, "" );
76e0e0
-+        getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) );
76e0e0
-     }
76e0e0
-     catch ( const CurlException& e )
76e0e0
-     {
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-object.cxx libcmis/src/libcmis/gdrive-object.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-object.cxx	2021-07-27 19:11:02.675247009 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-object.cxx	2021-07-27 19:11:18.874246420 +0200
76e0e0
-@@ -89,8 +89,8 @@
76e0e0
-             property.reset( new GDriveProperty( it->first, it->second ) );
76e0e0
-             m_properties[ property->getPropertyType( )->getId()] = property;
76e0e0
-            
76e0e0
--            // we map "title" to both "cmis:name" and "cmis:getContentStreamFileName"
76e0e0
--            if ( it->first == "title" )
76e0e0
-+            // we map "name" to both "cmis:name" and "cmis:getContentStreamFileName"
76e0e0
-+            if ( it->first == "name" )
76e0e0
-             {
76e0e0
-                 property.reset( new GDriveProperty( "cmis:name", it->second) );
76e0e0
-                 m_properties[ property->getPropertyType( )->getId()] = property;
76e0e0
-@@ -142,16 +142,13 @@
76e0e0
- {
76e0e0
-     if ( m_renditions.empty( ) )
76e0e0
-     {
76e0e0
--        string downloadUrl = getStringProperty( "downloadUrl" );
76e0e0
--        if ( !downloadUrl.empty( ) )
76e0e0
--        {
76e0e0
--            string mimeType = getStringProperty( "cmis:contentStreamMimeType" );
76e0e0
--            if ( !mimeType.empty( ) )
76e0e0
--            { 
76e0e0
--                RenditionPtr rendition( 
76e0e0
--                    new Rendition( mimeType, mimeType, mimeType, downloadUrl ));
76e0e0
--                m_renditions.push_back( rendition );
76e0e0
--            }
76e0e0
-+        string downloadUrl = GDRIVE_METADATA_LINK + getId( ) + "?alt=media";
76e0e0
-+        string mimeType = getStringProperty( "cmis:contentStreamMimeType" );
76e0e0
-+        if ( !mimeType.empty( ) )
76e0e0
-+        {
76e0e0
-+            RenditionPtr rendition(
76e0e0
-+                new Rendition( mimeType, mimeType, mimeType, downloadUrl ));
76e0e0
-+            m_renditions.push_back( rendition );
76e0e0
-         }
76e0e0
- 
76e0e0
-         vector< string > exportLinks = getMultiStringProperty( "exportLinks" );
76e0e0
-@@ -192,7 +189,7 @@
76e0e0
-     {   
76e0e0
-         vector< string > headers;
76e0e0
-         headers.push_back( "Content-Type: application/json" );
76e0e0
--        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
76e0e0
-+        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
76e0e0
-     }
76e0e0
-     catch ( const CurlException& e )
76e0e0
-     {   
76e0e0
-@@ -228,7 +225,7 @@
76e0e0
- {
76e0e0
-     try
76e0e0
-     {
76e0e0
--        getSession( )->httpDeleteRequest( getUrl( ) );
76e0e0
-+        getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) );
76e0e0
-     }
76e0e0
-     catch ( const CurlException& e )
76e0e0
-     {
76e0e0
-@@ -239,8 +236,8 @@
76e0e0
- void GDriveObject::move( FolderPtr /*source*/, FolderPtr destination ) 
76e0e0
- {  
76e0e0
-     Json parentsJson;
76e0e0
--    Json parentsValue = GdriveUtils::createJsonFromParentId( destination->getId( ) );
76e0e0
--    parentsJson.add( "parents", parentsValue );
76e0e0
-+    parentsJson.add( "addParents", Json(destination->getId( ).c_str()) );
76e0e0
-+    parentsJson.add( "removeParents", Json(getStringProperty( "cmis:parentId" ).c_str()) );
76e0e0
-     
76e0e0
-     istringstream is( parentsJson.toString( ) );
76e0e0
-     libcmis::HttpResponsePtr response;
76e0e0
-@@ -248,7 +245,7 @@
76e0e0
-     {   
76e0e0
-         vector< string > headers;
76e0e0
-         headers.push_back( "Content-Type: application/json" );
76e0e0
--        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
76e0e0
-+        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
76e0e0
-     }
76e0e0
-     catch ( const CurlException& e )
76e0e0
-     {   
76e0e0
-@@ -262,12 +259,10 @@
76e0e0
- 
76e0e0
- string GDriveObject::getUrl( )
76e0e0
- {
76e0e0
--    return getSession( )->getBindingUrl( ) + "/files/" + getId( );
76e0e0
--}
76e0e0
--
76e0e0
--string GDriveObject::getUploadUrl( )
76e0e0
--{
76e0e0
--    return GDRIVE_UPLOAD_LINKS;
76e0e0
-+    // thumbnailLink causes some operations to fail with internal server error,
76e0e0
-+    // see https://issuetracker.google.com/issues/36760667
76e0e0
-+    return GDRIVE_METADATA_LINK + getId( ) +
76e0e0
-+                "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime,size";
76e0e0
- }
76e0e0
- 
76e0e0
- vector< string> GDriveObject::getMultiStringProperty( const string& propertyName )
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-repository.cxx libcmis/src/libcmis/gdrive-repository.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-repository.cxx	2021-07-27 19:11:02.676247009 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-repository.cxx	2021-07-27 19:11:18.874246420 +0200
76e0e0
-@@ -35,7 +35,7 @@
76e0e0
-     m_name = "Google Drive";
76e0e0
-     m_description = "Google Drive repository";
76e0e0
-     m_productName = "Google Drive";
76e0e0
--    m_productVersion = "v2";
76e0e0
-+    m_productVersion = "v3";
76e0e0
-     m_rootId = "root";
76e0e0
-  
76e0e0
-     m_capabilities[ ACL ] = "discover";
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-session.cxx libcmis/src/libcmis/gdrive-session.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-session.cxx	2021-07-27 19:11:02.675247009 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-session.cxx	2021-07-27 19:11:18.874246420 +0200
76e0e0
-@@ -124,9 +124,13 @@
76e0e0
- 
76e0e0
- libcmis::ObjectPtr GDriveSession::getObject( string objectId )
76e0e0
- {
76e0e0
-+    if(objectId == "root") {
76e0e0
-+        return getRootFolder();
76e0e0
-+    }
76e0e0
-     // Run the http request to get the properties definition
76e0e0
-     string res;
76e0e0
--    string objectLink = m_bindingUrl + "/files/" + objectId;
76e0e0
-+    string objectLink = GDRIVE_METADATA_LINK + objectId +
76e0e0
-+         "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size";
76e0e0
-     try
76e0e0
-     {
76e0e0
-         res = httpGetRequest( objectLink )->getStream()->str();
76e0e0
-@@ -188,9 +192,10 @@
76e0e0
-         {
76e0e0
-             // Normal child case
76e0e0
-             // Ask for the ID of the child if there is any
76e0e0
--            string childIdUrl = m_bindingUrl + "/files/" + objectId +
76e0e0
--                                "/children/?q=title+=+'" + segment +
76e0e0
--                                "'&fields=items:id";
76e0e0
-+            // somewhat flawed as names are not necessarily unique in GDrive...
76e0e0
-+            string query = libcmis::escape("'" + objectId + "' in parents and trashed = false and name='" + segment + "'");
76e0e0
-+
76e0e0
-+            string childIdUrl = m_bindingUrl + "/files/?q=" + query + "&fields=files(id)";
76e0e0
- 
76e0e0
-             string res;
76e0e0
-             try
76e0e0
-@@ -204,7 +209,7 @@
76e0e0
-             Json jsonRes = Json::parse( res );
76e0e0
- 
76e0e0
-             // Did we get an id?
76e0e0
--            Json::JsonVector items = jsonRes["items"].getList();
76e0e0
-+            Json::JsonVector items = jsonRes["files"].getList();
76e0e0
-             if ( items.empty( ) )
76e0e0
-                 throw libcmis::Exception( "Object not found: " + path, "objectNotFound" );
76e0e0
- 
76e0e0
-@@ -219,6 +224,27 @@
76e0e0
-     return getObject( objectId );
76e0e0
- }
76e0e0
- 
76e0e0
-+libcmis::FolderPtr GDriveSession::getRootFolder()
76e0e0
-+{
76e0e0
-+    // permissions/scope with just drive.file don't allow to get it with the "root" alias/by its actual object-ID
76e0e0
-+    Json propsJson;
76e0e0
-+
76e0e0
-+    // GDrive folder is a file with a different mime type.
76e0e0
-+    string mimeType = GDRIVE_FOLDER_MIME_TYPE;
76e0e0
-+
76e0e0
-+    // Add mimetype to the propsJson
76e0e0
-+    Json jsonMimeType( mimeType.c_str( ) );
76e0e0
-+    propsJson.add( "mimeType", jsonMimeType );
76e0e0
-+    propsJson.add( "id", "root" );
76e0e0
-+
76e0e0
-+    // Upload meta-datas
76e0e0
-+    propsJson.add("cmis:name", "VirtualRoot");
76e0e0
-+
76e0e0
-+    libcmis::FolderPtr folderPtr( new GDriveFolder( this, propsJson ) );
76e0e0
-+
76e0e0
-+    return folderPtr;
76e0e0
-+}
76e0e0
-+
76e0e0
- libcmis::ObjectTypePtr GDriveSession::getType( string id )
76e0e0
- {
76e0e0
-     libcmis::ObjectTypePtr type( new GdriveObjectType( id ) );
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-session.hxx libcmis/src/libcmis/gdrive-session.hxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-session.hxx	2021-07-27 19:11:02.675247009 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-session.hxx	2021-07-27 19:11:18.875246420 +0200
76e0e0
-@@ -57,6 +57,8 @@
76e0e0
- 
76e0e0
-         virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( );
76e0e0
- 
76e0e0
-+        virtual libcmis::FolderPtr getRootFolder();
76e0e0
-+
76e0e0
-         virtual std::string getRefreshToken();
76e0e0
- 
76e0e0
-     private:
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-utils.cxx libcmis/src/libcmis/gdrive-utils.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-utils.cxx	2021-07-27 19:11:02.677247008 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-utils.cxx	2021-07-27 19:11:18.875246420 +0200
76e0e0
-@@ -44,17 +44,17 @@
76e0e0
-         convertedKey = "cmis:createdBy";
76e0e0
-     else if ( key == "description" )
76e0e0
-         convertedKey = "cmis:description";
76e0e0
--    else if ( key == "createdDate" )
76e0e0
-+    else if ( key == "createdTime" )
76e0e0
-         convertedKey = "cmis:creationDate";
76e0e0
-     else if ( key == "lastModifyingUserName" )
76e0e0
-         convertedKey = "cmis:lastModifiedBy";
76e0e0
--    else if ( key == "modifiedDate" )
76e0e0
-+    else if ( key == "modifiedTime" )
76e0e0
-         convertedKey = "cmis:lastModificationDate";
76e0e0
--    else if ( key == "title" )
76e0e0
-+    else if ( key == "name" )
76e0e0
-         convertedKey = "cmis:contentStreamFileName";
76e0e0
-     else if ( key == "mimeType" )
76e0e0
-         convertedKey = "cmis:contentStreamMimeType";
76e0e0
--    else if ( key == "fileSize" )
76e0e0
-+    else if ( key == "size" )
76e0e0
-         convertedKey = "cmis:contentStreamLength";
76e0e0
-     else if ( key == "editable" )
76e0e0
-         convertedKey = "cmis:isImmutable";
76e0e0
-@@ -72,21 +72,21 @@
76e0e0
-     else if ( key == "cmis:createdBy" )
76e0e0
-         convertedKey = "ownerNames";
76e0e0
-     else if ( key == "cmis:creationDate" )
76e0e0
--        convertedKey = "createdDate";
76e0e0
-+        convertedKey = "createdTime";
76e0e0
-     else if ( key == "cmis:description" )
76e0e0
-         convertedKey = "description";
76e0e0
-     else if ( key == "cmis:lastModifiedBy" )
76e0e0
-         convertedKey = "lastModifyingUserName";
76e0e0
-     else if ( key == "cmis:lastModificationDate" )
76e0e0
--        convertedKey = "modifiedDate";
76e0e0
-+        convertedKey = "modifiedTime";
76e0e0
-     else if ( key == "cmis:contentStreamFileName" )
76e0e0
--        convertedKey = "title";
76e0e0
-+        convertedKey = "name";
76e0e0
-     else if ( key == "cmis:name" )
76e0e0
--        convertedKey = "title";
76e0e0
-+        convertedKey = "name";
76e0e0
-     else if ( key == "cmis:contentStreamMimeType" )
76e0e0
-         convertedKey = "mimeType";
76e0e0
-     else if ( key == "cmis:contentStreamLength" )
76e0e0
--        convertedKey = "fileSize";
76e0e0
-+        convertedKey = "size";
76e0e0
-     else if ( key == "cmis:isImmutable" )
76e0e0
-         convertedKey = "editable";
76e0e0
-     else if ( key == "cmis:parentId" )
76e0e0
-@@ -124,9 +124,9 @@
76e0e0
- bool GdriveUtils::checkUpdatable( const string& key )
76e0e0
- {
76e0e0
-     // taken from https://developers.google.com/drive/v2/reference/files
76e0e0
--    bool updatable = ( key == "title" ||
76e0e0
-+    bool updatable = ( key == "name" ||
76e0e0
-                   key == "description" ||
76e0e0
--                  key == "modifiedDate" ||
76e0e0
-+                  key == "modifiedTime" ||
76e0e0
-                   key == "lastViewedByMeDate" );
76e0e0
-     return updatable;    
76e0e0
- }
76e0e0
-@@ -143,18 +143,11 @@
76e0e0
- 
76e0e0
- Json GdriveUtils::createJsonFromParentId( const string& parentId )
76e0e0
- {
76e0e0
--    Json parentValue( parentId.c_str( ) );
76e0e0
--    
76e0e0
-     // parents is a Json array
76e0e0
-     Json firstParent;
76e0e0
--    firstParent.add( "id", parentValue );
76e0e0
--    
76e0e0
--    Json::JsonVector parents;
76e0e0
--    parents.insert( parents.begin( ), firstParent );
76e0e0
-+    firstParent.add( Json( parentId.c_str() ) );
76e0e0
-     
76e0e0
--    Json parentsValue( parents );
76e0e0
--
76e0e0
--    return parentsValue;
76e0e0
-+    return firstParent;
76e0e0
- }
76e0e0
- 
76e0e0
- vector< string > GdriveUtils::parseGdriveProperty( string key, Json json )
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-utils.hxx libcmis/src/libcmis/gdrive-utils.hxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-utils.hxx	2021-07-27 19:11:02.677247008 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-utils.hxx	2021-07-27 19:11:18.875246420 +0200
76e0e0
-@@ -35,7 +35,8 @@
76e0e0
- #include "json-utils.hxx"
76e0e0
- 
76e0e0
- static const std::string GDRIVE_FOLDER_MIME_TYPE = "application/vnd.google-apps.folder" ;
76e0e0
--static const std::string GDRIVE_UPLOAD_LINKS = "https://www.googleapis.com/upload/drive/v2/files/";
76e0e0
-+static const std::string GDRIVE_UPLOAD_LINK = "https://www.googleapis.com/upload/drive/v3/files/";
76e0e0
-+static const std::string GDRIVE_METADATA_LINK = "https://www.googleapis.com/drive/v3/files/";
76e0e0
- 
76e0e0
- class GdriveUtils
76e0e0
- {
76e0e0
-diff -ur libcmis.org/src/libcmis/oauth2-handler.cxx libcmis/src/libcmis/oauth2-handler.cxx
76e0e0
---- libcmis.org/src/libcmis/oauth2-handler.cxx	2021-07-27 19:11:02.676247009 +0200
76e0e0
-+++ libcmis/src/libcmis/oauth2-handler.cxx	2021-07-27 19:11:18.875246420 +0200
76e0e0
-@@ -92,8 +92,11 @@
76e0e0
-         "code="              + authCode +
76e0e0
-         "&client_id="        + m_data->getClientId() +
76e0e0
-         "&redirect_uri="     + m_data->getRedirectUri() +
76e0e0
--        "&scope="            + libcmis::escape( m_data->getScope() ) +
76e0e0
-         "&grant_type=authorization_code" ;
76e0e0
-+    if(boost::starts_with(m_data->getTokenUrl(), "https://oauth2.googleapis.com/"))
76e0e0
-+        post += "&client_secret="    + m_data->getClientSecret();
76e0e0
-+    else
76e0e0
-+        post += "&scope="            + libcmis::escape( m_data->getScope() );
76e0e0
- 
76e0e0
-     istringstream is( post );
76e0e0
- 
76e0e0
-@@ -104,7 +107,7 @@
76e0e0
-         resp = m_session->httpPostRequest ( m_data->getTokenUrl(), is,
76e0e0
-                                         "application/x-www-form-urlencoded" );
76e0e0
-     }
76e0e0
--    catch ( const CurlException& )
76e0e0
-+    catch ( const CurlException& e)
76e0e0
-     {
76e0e0
-         throw libcmis::Exception(
76e0e0
-                 "Couldn't get tokens from the authorization code ");
76e0e0
-@@ -122,6 +125,8 @@
76e0e0
-         "refresh_token="     + m_refresh +
76e0e0
-         "&client_id="        + m_data->getClientId() +
76e0e0
-         "&grant_type=refresh_token" ;
76e0e0
-+    if(boost::starts_with(m_data->getTokenUrl(), "https://oauth2.googleapis.com/"))
76e0e0
-+        post += "&client_secret="    + m_data->getClientSecret();
76e0e0
- 
76e0e0
-     istringstream is( post );
76e0e0
-     libcmis::HttpResponsePtr resp;
76e0e0
-@@ -130,7 +135,7 @@
76e0e0
-         resp = m_session->httpPostRequest( m_data->getTokenUrl( ), is,
76e0e0
-                                            "application/x-www-form-urlencoded" );
76e0e0
-     }
76e0e0
--    catch (const CurlException& )
76e0e0
-+    catch (const CurlException& e )
76e0e0
-     {
76e0e0
-         throw libcmis::Exception( "Couldn't refresh token ");
76e0e0
-     }
76e0e0
-diff -ur libcmis.org/src/libcmis/oauth2-providers.cxx libcmis/src/libcmis/oauth2-providers.cxx
76e0e0
---- libcmis.org/src/libcmis/oauth2-providers.cxx	2021-07-27 19:11:02.679247008 +0200
76e0e0
-+++ libcmis/src/libcmis/oauth2-providers.cxx	2021-07-27 19:11:18.886246420 +0200
76e0e0
-@@ -80,172 +80,8 @@
76e0e0
- 
76e0e0
- }
76e0e0
- 
76e0e0
--string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUrl,
76e0e0
--                                      const string& username, const string& password )
76e0e0
--{
76e0e0
--    /* This member function implements 'Google OAuth 2.0'
76e0e0
--     *
76e0e0
--     * The interaction is carried out by libcmis, with no web browser involved.
76e0e0
--     *
76e0e0
--     * Normal sequence (without 2FA) is:
76e0e0
--     * 1) a get to activate login page
76e0e0
--     *    receive first login page, html format
76e0e0
--     * 2) subsequent post to sent email
76e0e0
--     *    receive html page for password input
76e0e0
--     * 3) subsequent post to send password
76e0e0
--     *    receive html page for application consent
76e0e0
--     * 4) subsequent post to send a consent for the application
76e0e0
--     *    receive a single-use authorization code
76e0e0
--     *    this code is returned as a string
76e0e0
--     *
76e0e0
--     * Sequence with 2FA is:
76e0e0
--     * 1) a get to activate login page
76e0e0
--     *    receive first login page, html format
76e0e0
--     * 2) subsequent post to sent email
76e0e0
--     *    receive html page for password input
76e0e0
--     * 3) subsequent post to send password
76e0e0
--     *    receive html page for pin input
76e0e0
--     * 3b) subsequent post to send pin number
76e0e0
--     *    receive html page for application consent
76e0e0
--     * 4) subsequent post to send a consent for the application
76e0e0
--     *    receive a single-use authorization code
76e0e0
--     *    this code is returned as a string
76e0e0
--     */
76e0e0
--
76e0e0
--    static const string CONTENT_TYPE( "application/x-www-form-urlencoded" );
76e0e0
--    // STEP 1: get login page
76e0e0
--    string res;
76e0e0
--    try
76e0e0
--    {
76e0e0
--        // send the first get, receive the html login page
76e0e0
--        res = session->httpGetRequest( authUrl )->getStream( )->str( );
76e0e0
--    }
76e0e0
--    catch ( const CurlException& )
76e0e0
--    {
76e0e0
--        return string( );
76e0e0
--    }
76e0e0
--
76e0e0
--    // STEP 2: send email
76e0e0
--
76e0e0
--    string loginEmailPost, loginEmailLink;
76e0e0
--    if ( !parseResponse( res.c_str( ), loginEmailPost, loginEmailLink ) )
76e0e0
--        return string( );
76e0e0
--
76e0e0
--    loginEmailPost += "Email=";
76e0e0
--    loginEmailPost += escapeForm( username );
76e0e0
--
76e0e0
--    istringstream loginEmailIs( loginEmailPost );
76e0e0
--    string loginEmailRes;
76e0e0
--    try
76e0e0
--    {
76e0e0
--        // send a post with user email, receive the html page for password input
76e0e0
--        loginEmailRes = session->httpPostRequest ( loginEmailLink, loginEmailIs, CONTENT_TYPE )
76e0e0
--                        ->getStream( )->str( );
76e0e0
--    }
76e0e0
--    catch ( const CurlException& )
76e0e0
--    {
76e0e0
--        return string( );
76e0e0
--    }
76e0e0
--
76e0e0
--    // STEP 3: password page
76e0e0
--
76e0e0
--    string loginPasswdPost, loginPasswdLink;
76e0e0
--    if ( !parseResponse( loginEmailRes.c_str( ), loginPasswdPost, loginPasswdLink ) )
76e0e0
--        return string( );
76e0e0
--
76e0e0
--    loginPasswdPost += "Passwd=";
76e0e0
--    loginPasswdPost += escapeForm( password );
76e0e0
--
76e0e0
--    istringstream loginPasswdIs( loginPasswdPost );
76e0e0
--    string loginPasswdRes;
76e0e0
--    try
76e0e0
--    {
76e0e0
--        // send a post with user password, receive the application consent page
76e0e0
--        loginPasswdRes = session->httpPostRequest ( loginPasswdLink, loginPasswdIs, CONTENT_TYPE )
76e0e0
--                        ->getStream( )->str( );
76e0e0
--    }
76e0e0
--    catch ( const CurlException& )
76e0e0
--    {
76e0e0
--        return string( );
76e0e0
--    }
76e0e0
--
76e0e0
--    string approvalPost, approvalLink;
76e0e0
--    if ( !parseResponse( loginPasswdRes. c_str( ), approvalPost, approvalLink) )
76e0e0
--        return string( );
76e0e0
--
76e0e0
--    // when 2FA is enabled, link doesn't start with 'http'
76e0e0
--    if ( approvalLink.compare(0, 4, "http") != 0 )
76e0e0
--    {
76e0e0
--        // STEP 3b: 2 Factor Authentication, pin code request
76e0e0
--
76e0e0
--        string loginChallengePost( approvalPost );
76e0e0
--        string loginChallengeLink( approvalLink );
76e0e0
--
76e0e0
--        libcmis::OAuth2AuthCodeProvider fallbackProvider = libcmis::SessionFactory::getOAuth2AuthCodeProvider( );
76e0e0
--        unique_ptr< char, void (*)( void * ) > pin{ fallbackProvider( "", "", "" ), free };
76e0e0
--
76e0e0
--        if( !pin )
76e0e0
--        {
76e0e0
--            // unset OAuth2AuthCode Provider to avoid showing pin request again in the HttpSession::oauth2Authenticate
76e0e0
--            libcmis::SessionFactory::setOAuth2AuthCodeProvider( NULL );
76e0e0
--            return string( );
76e0e0
--        }
76e0e0
--
76e0e0
--        loginChallengeLink = "https://accounts.google.com" + loginChallengeLink;
76e0e0
--        loginChallengePost += string( PIN_INPUT_NAME ) + "=";
76e0e0
--        loginChallengePost += string( pin.get() );
76e0e0
--
76e0e0
--        istringstream loginChallengeIs( loginChallengePost );
76e0e0
--        string loginChallengeRes;
76e0e0
--        try
76e0e0
--        {
76e0e0
--            // send a post with pin, receive the application consent page
76e0e0
--            loginChallengeRes = session->httpPostRequest ( loginChallengeLink, loginChallengeIs, CONTENT_TYPE )
76e0e0
--                            ->getStream( )->str( );
76e0e0
--        }
76e0e0
--        catch ( const CurlException& )
76e0e0
--        {
76e0e0
--            return string( );
76e0e0
--        }
76e0e0
--
76e0e0
--        approvalPost = string();
76e0e0
--        approvalLink = string();
76e0e0
--
76e0e0
--        if ( !parseResponse( loginChallengeRes. c_str( ), approvalPost, approvalLink) )
76e0e0
--            return string( );
76e0e0
--    }
76e0e0
--    else if( approvalLink.compare( "https://accounts.google.com/ServiceLoginAuth" ) == 0 )
76e0e0
--    {
76e0e0
--        // wrong password,
76e0e0
--        // unset OAuth2AuthCode Provider to avoid showing pin request again in the HttpSession::oauth2Authenticate
76e0e0
--        libcmis::SessionFactory::setOAuth2AuthCodeProvider( NULL );
76e0e0
--        return string( );
76e0e0
--    }
76e0e0
--
76e0e0
--    // STEP 4: allow libcmis to access google drive
76e0e0
--    approvalPost += "submit_access=true";
76e0e0
--
76e0e0
--    istringstream approvalIs( approvalPost );
76e0e0
--    string approvalRes;
76e0e0
--    try
76e0e0
--    {
76e0e0
--        // send a post with application consent
76e0e0
--        approvalRes = session->httpPostRequest ( approvalLink, approvalIs,
76e0e0
--                            CONTENT_TYPE) ->getStream( )->str( );
76e0e0
--    }
76e0e0
--    catch ( const CurlException& e )
76e0e0
--    {
76e0e0
--        throw e.getCmisException( );
76e0e0
--    }
76e0e0
--
76e0e0
--    // Take the authentication code from the text bar
76e0e0
--    string code = parseCode( approvalRes.c_str( ) );
76e0e0
--
76e0e0
--    return code;
76e0e0
--}
76e0e0
--
76e0e0
--string OAuth2Providers::OAuth2Onedrive( HttpSession* /*session*/, const string& /*authUrl*/,
76e0e0
--                                      const string& /*username*/, const string& /*password*/ )
76e0e0
-+string OAuth2Providers::OAuth2Dummy( HttpSession* /*session*/, const string& /*authUrl*/,
76e0e0
-+                                     const string& /*username*/, const string& /*password*/ )
76e0e0
- {
76e0e0
-     return string( );
76e0e0
- }
76e0e0
-@@ -314,12 +150,8 @@
76e0e0
-         // For Alfresco in the cloud, only match the hostname as there can be several
76e0e0
-         // binding URLs created with it.
76e0e0
-         return OAuth2Alfresco;
76e0e0
--    else if ( boost::starts_with( url, "https://www.googleapis.com/drive/v2" ) )
76e0e0
--        return OAuth2Gdrive;
76e0e0
--    else if ( boost::starts_with( url, "https://graph.microsoft.com/v1.0" ) )
76e0e0
--        return OAuth2Onedrive;
76e0e0
- 
76e0e0
--    return OAuth2Gdrive;
76e0e0
-+    return OAuth2Dummy;
76e0e0
- }
76e0e0
- 
76e0e0
- int OAuth2Providers::parseResponse ( const char* response, string& post, string& link )
76e0e0
-diff -ur libcmis.org/src/libcmis/oauth2-providers.hxx libcmis/src/libcmis/oauth2-providers.hxx
76e0e0
---- libcmis.org/src/libcmis/oauth2-providers.hxx	2021-07-27 19:11:02.678247008 +0200
76e0e0
-+++ libcmis/src/libcmis/oauth2-providers.hxx	2021-07-27 19:11:18.886246420 +0200
76e0e0
-@@ -39,12 +39,8 @@
76e0e0
- class OAuth2Providers
76e0e0
- {
76e0e0
-     public :
76e0e0
--        static std::string OAuth2Gdrive( HttpSession* session, const std::string& authUrl, 
76e0e0
-+        static std::string OAuth2Dummy( HttpSession* session, const std::string& authUrl,
76e0e0
-                                        const std::string& username, const std::string& password );
76e0e0
--
76e0e0
--        static std::string OAuth2Onedrive( HttpSession* session, const std::string& authUrl, 
76e0e0
--                                       const std::string& username, const std::string& password );
76e0e0
--
76e0e0
-         static std::string OAuth2Alfresco( HttpSession* session, const std::string& authUrl, 
76e0e0
-                                        const std::string& username, const std::string& password );
76e0e0
- 
76e0e0
-diff -ur libcmis.org/src/libcmis/session-factory.cxx libcmis/src/libcmis/session-factory.cxx
76e0e0
---- libcmis.org/src/libcmis/session-factory.cxx	2021-07-27 19:11:02.679247008 +0200
76e0e0
-+++ libcmis/src/libcmis/session-factory.cxx	2021-07-27 19:11:18.886246420 +0200
76e0e0
-@@ -66,7 +66,7 @@
76e0e0
-         if ( !bindingUrl.empty( ) )
76e0e0
-         {
76e0e0
-             // Try the special cases based on the binding URL
76e0e0
--            if ( bindingUrl == "https://www.googleapis.com/drive/v2" )
76e0e0
-+            if ( bindingUrl == "https://www.googleapis.com/drive/v3" )
76e0e0
-             {
76e0e0
-                 session = new GDriveSession( bindingUrl, username, password,
76e0e0
-                                              oauth2, verbose );
76e0e0
diff --git a/external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1 b/external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1
76e0e0
deleted file mode 100644
76e0e0
index a8cb06509421..000000000000
76e0e0
--- a/external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1
76e0e0
+++ /dev/null
76e0e0
@@ -1,185 +0,0 @@
76e0e0
-diff -ur libcmis.org/inc/libcmis/session.hxx libcmis/inc/libcmis/session.hxx
76e0e0
---- libcmis.org/inc/libcmis/session.hxx	2021-07-27 19:09:42.580249917 +0200
76e0e0
-+++ libcmis/inc/libcmis/session.hxx	2021-07-27 19:10:02.368249199 +0200
76e0e0
-@@ -95,6 +95,8 @@
76e0e0
-                 certificate exception feature available on common web browser.
76e0e0
-               */
76e0e0
-             virtual void setNoSSLCertificateCheck( bool noCheck ) = 0;
76e0e0
-+
76e0e0
-+            virtual std::string getRefreshToken() { return ""; };
76e0e0
-     };
76e0e0
- }
76e0e0
- 
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-session.cxx libcmis/src/libcmis/gdrive-session.cxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-session.cxx	2021-07-27 19:09:42.581249917 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-session.cxx	2021-07-27 19:10:02.369249198 +0200
76e0e0
-@@ -70,6 +70,46 @@
76e0e0
- {
76e0e0
- }
76e0e0
- 
76e0e0
-+
76e0e0
-+void GDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 )
76e0e0
-+{
76e0e0
-+    m_oauth2Handler = new OAuth2Handler( this, oauth2 );
76e0e0
-+    m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( getBindingUrl( ) ) );
76e0e0
-+
76e0e0
-+    oauth2Authenticate( );
76e0e0
-+}
76e0e0
-+
76e0e0
-+void GDriveSession::oauth2Authenticate()
76e0e0
-+{
76e0e0
-+    // treat the supplied password as refresh token
76e0e0
-+    if (!m_password.empty())
76e0e0
-+    {
76e0e0
-+        try
76e0e0
-+        {
76e0e0
-+            m_inOAuth2Authentication = true;
76e0e0
-+
76e0e0
-+            m_oauth2Handler->setRefreshToken(m_password);
76e0e0
-+            // Try to get new access tokens using the stored refreshtoken
76e0e0
-+            m_oauth2Handler->refresh();
76e0e0
-+            m_inOAuth2Authentication = false;
76e0e0
-+        }
76e0e0
-+        catch (const CurlException &e)
76e0e0
-+        {
76e0e0
-+            m_inOAuth2Authentication = false;
76e0e0
-+            // refresh token expired or invalid, trigger initial auth (that in turn will hit the fallback with copy'n'paste method)
76e0e0
-+            BaseSession::oauth2Authenticate();
76e0e0
-+        }
76e0e0
-+    }
76e0e0
-+    else
76e0e0
-+    {
76e0e0
-+        BaseSession::oauth2Authenticate();
76e0e0
-+    }
76e0e0
-+}
76e0e0
-+
76e0e0
-+string GDriveSession::getRefreshToken() {
76e0e0
-+    return HttpSession::getRefreshToken();
76e0e0
-+}
76e0e0
-+
76e0e0
- libcmis::RepositoryPtr GDriveSession::getRepository( )
76e0e0
- {
76e0e0
-     // Return a dummy repository since GDrive doesn't have that notion
76e0e0
-diff -ur libcmis.org/src/libcmis/gdrive-session.hxx libcmis/src/libcmis/gdrive-session.hxx
76e0e0
---- libcmis.org/src/libcmis/gdrive-session.hxx	2021-07-27 19:09:42.583249917 +0200
76e0e0
-+++ libcmis/src/libcmis/gdrive-session.hxx	2021-07-27 19:10:02.369249198 +0200
76e0e0
-@@ -57,8 +57,14 @@
76e0e0
- 
76e0e0
-         virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( );
76e0e0
- 
76e0e0
-+        virtual std::string getRefreshToken();
76e0e0
-+
76e0e0
-     private:
76e0e0
-         GDriveSession( );
76e0e0
-+
76e0e0
-+        virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
76e0e0
-+
76e0e0
-+        void oauth2Authenticate( );
76e0e0
- };
76e0e0
- 
76e0e0
- #endif /* _GDRIVE_SESSION_HXX_ */
76e0e0
-diff -ur libcmis.org/src/libcmis/http-session.hxx libcmis/src/libcmis/http-session.hxx
76e0e0
---- libcmis.org/src/libcmis/http-session.hxx	2021-07-27 19:09:42.582249917 +0200
76e0e0
-+++ libcmis/src/libcmis/http-session.hxx	2021-07-27 19:10:02.369249198 +0200
76e0e0
-@@ -148,7 +148,7 @@
76e0e0
- 
76e0e0
-         void setNoSSLCertificateCheck( bool noCheck );
76e0e0
- 
76e0e0
--        std::string getRefreshToken( );
76e0e0
-+        virtual std::string getRefreshToken( );
76e0e0
- 
76e0e0
-     protected:
76e0e0
-         HttpSession( );
76e0e0
-diff -ur libcmis.org/src/libcmis/oauth2-handler.cxx libcmis/src/libcmis/oauth2-handler.cxx
76e0e0
---- libcmis.org/src/libcmis/oauth2-handler.cxx	2021-07-27 19:09:42.582249917 +0200
76e0e0
-+++ libcmis/src/libcmis/oauth2-handler.cxx	2021-07-27 19:10:02.369249198 +0200
76e0e0
-@@ -158,6 +158,11 @@
76e0e0
-     return m_refresh;
76e0e0
- }
76e0e0
- 
76e0e0
-+void OAuth2Handler::setRefreshToken( string refreshToken )
76e0e0
-+{
76e0e0
-+    m_refresh = refreshToken;
76e0e0
-+}
76e0e0
-+
76e0e0
- string OAuth2Handler::getHttpHeader( )
76e0e0
- {
76e0e0
-     string header;
76e0e0
-diff -ur libcmis.org/src/libcmis/oauth2-handler.hxx libcmis/src/libcmis/oauth2-handler.hxx
76e0e0
---- libcmis.org/src/libcmis/oauth2-handler.hxx	2021-07-27 19:09:42.582249917 +0200
76e0e0
-+++ libcmis/src/libcmis/oauth2-handler.hxx	2021-07-27 19:10:02.370249198 +0200
76e0e0
-@@ -61,6 +61,7 @@
76e0e0
- 
76e0e0
-         std::string getAccessToken( ) ;
76e0e0
-         std::string getRefreshToken( ) ;
76e0e0
-+        void setRefreshToken( std::string refreshToken ) ;
76e0e0
- 
76e0e0
-         // adding HTTP auth header
76e0e0
-         std::string getHttpHeader( ) ;
76e0e0
-diff -ur libcmis.org/src/libcmis/onedrive-session.cxx libcmis/src/libcmis/onedrive-session.cxx
76e0e0
---- libcmis.org/src/libcmis/onedrive-session.cxx	2021-07-27 19:09:42.583249917 +0200
76e0e0
-+++ libcmis/src/libcmis/onedrive-session.cxx	2021-07-27 19:10:02.370249198 +0200
76e0e0
-@@ -68,6 +68,45 @@
76e0e0
- {
76e0e0
- }
76e0e0
- 
76e0e0
-+void OneDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 )
76e0e0
-+{
76e0e0
-+    m_oauth2Handler = new OAuth2Handler( this, oauth2 );
76e0e0
-+    m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( getBindingUrl( ) ) );
76e0e0
-+
76e0e0
-+    oauth2Authenticate( );
76e0e0
-+}
76e0e0
-+
76e0e0
-+void OneDriveSession::oauth2Authenticate()
76e0e0
-+{
76e0e0
-+    // treat the supplied password as refresh token
76e0e0
-+    if (!m_password.empty())
76e0e0
-+    {
76e0e0
-+        try
76e0e0
-+        {
76e0e0
-+            m_inOAuth2Authentication = true;
76e0e0
-+
76e0e0
-+            m_oauth2Handler->setRefreshToken(m_password);
76e0e0
-+            // Try to get new access tokens using the stored refreshtoken
76e0e0
-+            m_oauth2Handler->refresh();
76e0e0
-+            m_inOAuth2Authentication = false;
76e0e0
-+        }
76e0e0
-+        catch (const CurlException &e)
76e0e0
-+        {
76e0e0
-+            m_inOAuth2Authentication = false;
76e0e0
-+            // refresh token expired or invalid, trigger initial auth (that in turn will hit the fallback with copy'n'paste method)
76e0e0
-+            BaseSession::oauth2Authenticate();
76e0e0
-+        }
76e0e0
-+    }
76e0e0
-+    else
76e0e0
-+    {
76e0e0
-+        BaseSession::oauth2Authenticate();
76e0e0
-+    }
76e0e0
-+}
76e0e0
-+
76e0e0
-+string OneDriveSession::getRefreshToken() {
76e0e0
-+    return HttpSession::getRefreshToken();
76e0e0
-+}
76e0e0
-+
76e0e0
- libcmis::RepositoryPtr OneDriveSession::getRepository( )
76e0e0
- {
76e0e0
-     // Return a dummy repository since OneDrive doesn't have that notion
76e0e0
-diff -ur libcmis.org/src/libcmis/onedrive-session.hxx libcmis/src/libcmis/onedrive-session.hxx
76e0e0
---- libcmis.org/src/libcmis/onedrive-session.hxx	2021-07-27 19:09:42.583249917 +0200
76e0e0
-+++ libcmis/src/libcmis/onedrive-session.hxx	2021-07-27 19:10:02.370249198 +0200
76e0e0
-@@ -62,8 +62,14 @@
76e0e0
- 
76e0e0
-        bool isAPathMatch( Json objectJson, std::string path );
76e0e0
- 
76e0e0
-+       virtual std::string getRefreshToken();
76e0e0
-+
76e0e0
-     private:
76e0e0
-         OneDriveSession( );
76e0e0
-+
76e0e0
-+        virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
76e0e0
-+
76e0e0
-+        void oauth2Authenticate( );
76e0e0
- };
76e0e0
- 
76e0e0
- #endif /* _ONEDRIVE_SESSION_HXX_ */
76e0e0
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
76e0e0
index fde7c90f9b26..816d22bc993c 100644
76e0e0
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
76e0e0
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
76e0e0
@@ -433,7 +433,7 @@
76e0e0
     </prop>
76e0e0
     <prop oor:name="CmisServersUrls">
76e0e0
       <value>
76e0e0
-        <it>https://www.googleapis.com/drive/v3</it>
76e0e0
+        <it>https://www.googleapis.com/drive/v2</it>
76e0e0
         <it>https://graph.microsoft.com/v1.0</it>
76e0e0
         <it>https://api.alfresco.com/cmis/versions/1.0/atom/</it>
76e0e0
         <it></it>
76e0e0
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx b/ucb/source/ucp/cmis/auth_provider.cxx
76e0e0
index c4407f47cc3f..dd7b4f9f1e3c 100644
76e0e0
--- a/ucb/source/ucp/cmis/auth_provider.cxx
76e0e0
+++ b/ucb/source/ucp/cmis/auth_provider.cxx
76e0e0
@@ -11,10 +11,7 @@
76e0e0
 #define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
76e0e0
 
76e0e0
 #include <com/sun/star/task/XInteractionHandler.hpp>
76e0e0
-#include <com/sun/star/task/PasswordContainer.hpp>
76e0e0
-#include <com/sun/star/task/XPasswordContainer2.hpp>
76e0e0
 
76e0e0
-#include <comphelper/processfactory.hxx>
76e0e0
 #include <ucbhelper/simpleauthenticationrequest.hxx>
76e0e0
 #include <ucbhelper/authenticationfallback.hxx>
76e0e0
 
76e0e0
@@ -67,91 +64,6 @@ namespace cmis
76e0e0
         return false;
76e0e0
     }
76e0e0
 
76e0e0
-    string AuthProvider::getRefreshToken(string& rUsername)
76e0e0
-    {
76e0e0
-        string refreshToken;
76e0e0
-        const css::uno::Reference<css::ucb::XCommandEnvironment> xEnv = getXEnv();
76e0e0
-        if (xEnv.is())
76e0e0
-        {
76e0e0
-            uno::Reference<task::XInteractionHandler> xIH = xEnv->getInteractionHandler();
76e0e0
-
76e0e0
-            if (rUsername.empty())
76e0e0
-            {
76e0e0
-                rtl::Reference<ucbhelper::SimpleAuthenticationRequest> xRequest
76e0e0
-                    = new ucbhelper::SimpleAuthenticationRequest(
76e0e0
-                        m_sUrl, m_sBindingUrl,
76e0e0
-                        ucbhelper::SimpleAuthenticationRequest::EntityType::ENTITY_NA, OUString(),
76e0e0
-                        ucbhelper::SimpleAuthenticationRequest::EntityType::ENTITY_MODIFY,
76e0e0
-                        STD_TO_OUSTR(rUsername),
76e0e0
-                        ucbhelper::SimpleAuthenticationRequest::EntityType::ENTITY_NA, OUString());
76e0e0
-                xIH->handle(xRequest.get());
76e0e0
-
76e0e0
-                rtl::Reference<ucbhelper::InteractionContinuation> xSelection
76e0e0
-                    = xRequest->getSelection();
76e0e0
-
76e0e0
-                if (xSelection.is())
76e0e0
-                {
76e0e0
-                    // Handler handled the request.
76e0e0
-                    uno::Reference<task::XInteractionAbort> xAbort(xSelection.get(),
76e0e0
-                                                                   uno::UNO_QUERY);
76e0e0
-                    if (!xAbort.is())
76e0e0
-                    {
76e0e0
-                        const rtl::Reference<ucbhelper::InteractionSupplyAuthentication>& xSupp
76e0e0
-                            = xRequest->getAuthenticationSupplier();
76e0e0
-
76e0e0
-                        rUsername = OUSTR_TO_STDSTR(xSupp->getUserName());
76e0e0
-                    }
76e0e0
-                }
76e0e0
-            }
76e0e0
-
76e0e0
-            uno::Reference<uno::XComponentContext> xContext
76e0e0
-                = ::comphelper::getProcessComponentContext();
76e0e0
-            uno::Reference<task::XPasswordContainer2> xMasterPasswd
76e0e0
-                = task::PasswordContainer::create(xContext);
76e0e0
-            if (xMasterPasswd->hasMasterPassword())
76e0e0
-            {
76e0e0
-                xMasterPasswd->authorizateWithMasterPassword(xIH);
76e0e0
-            }
76e0e0
-            if (xMasterPasswd->isPersistentStoringAllowed())
76e0e0
-            {
76e0e0
-                task::UrlRecord aRec
76e0e0
-                    = xMasterPasswd->findForName(m_sBindingUrl, STD_TO_OUSTR(rUsername), xIH);
76e0e0
-                if (aRec.UserList.hasElements() && aRec.UserList[0].Passwords.hasElements())
76e0e0
-                    refreshToken = OUSTR_TO_STDSTR(aRec.UserList[0].Passwords[0]);
76e0e0
-            }
76e0e0
-        }
76e0e0
-        return refreshToken;
76e0e0
-    }
76e0e0
-
76e0e0
-    bool AuthProvider::storeRefreshToken(const string& username, const string& password,
76e0e0
-                                         const string& refreshToken)
76e0e0
-    {
76e0e0
-        if (refreshToken.empty())
76e0e0
-            return false;
76e0e0
-        if (password == refreshToken)
76e0e0
-            return true;
76e0e0
-        const css::uno::Reference<css::ucb::XCommandEnvironment> xEnv = getXEnv();
76e0e0
-        if (xEnv.is())
76e0e0
-        {
76e0e0
-            uno::Reference<task::XInteractionHandler> xIH = xEnv->getInteractionHandler();
76e0e0
-            uno::Reference<uno::XComponentContext> xContext
76e0e0
-                = ::comphelper::getProcessComponentContext();
76e0e0
-            uno::Reference<task::XPasswordContainer2> xMasterPasswd
76e0e0
-                = task::PasswordContainer::create(xContext);
76e0e0
-            uno::Sequence<OUString> aPasswd{ STD_TO_OUSTR(refreshToken) };
76e0e0
-            if (xMasterPasswd->isPersistentStoringAllowed())
76e0e0
-            {
76e0e0
-                if (xMasterPasswd->hasMasterPassword())
76e0e0
-                {
76e0e0
-                    xMasterPasswd->authorizateWithMasterPassword(xIH);
76e0e0
-                }
76e0e0
-                xMasterPasswd->addPersistent(m_sBindingUrl, STD_TO_OUSTR(username), aPasswd, xIH);
76e0e0
-                return true;
76e0e0
-            }
76e0e0
-        }
76e0e0
-        return false;
76e0e0
-    }
76e0e0
-
76e0e0
     css::uno::WeakReference< css::ucb::XCommandEnvironment> AuthProvider::sm_xEnv;
76e0e0
 
76e0e0
     void AuthProvider::setXEnv(const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv )
76e0e0
@@ -164,7 +76,7 @@ namespace cmis
76e0e0
         return sm_xEnv;
76e0e0
     }
76e0e0
 
76e0e0
-    char* AuthProvider::copyWebAuthCodeFallback( const char* url,
76e0e0
+    char* AuthProvider::onedriveAuthCodeFallback( const char* url,
76e0e0
             const char* /*username*/,
76e0e0
             const char* /*password*/ )
76e0e0
     {
76e0e0
@@ -208,6 +120,46 @@ namespace cmis
76e0e0
 
76e0e0
         return strdup( "" );
76e0e0
     }
76e0e0
+
76e0e0
+    char* AuthProvider::gdriveAuthCodeFallback( const char* /*url*/,
76e0e0
+            const char* /*username*/,
76e0e0
+            const char* /*password*/ )
76e0e0
+    {
76e0e0
+        const css::uno::Reference<
76e0e0
+            css::ucb::XCommandEnvironment> xEnv = getXEnv( );
76e0e0
+
76e0e0
+        if ( xEnv.is() )
76e0e0
+        {
76e0e0
+            uno::Reference< task::XInteractionHandler > xIH
76e0e0
+                = xEnv->getInteractionHandler();
76e0e0
+
76e0e0
+            if ( xIH.is() )
76e0e0
+            {
76e0e0
+                rtl::Reference< ucbhelper::AuthenticationFallbackRequest > xRequest
76e0e0
+                    = new ucbhelper::AuthenticationFallbackRequest (
76e0e0
+                            "PIN:", "" );
76e0e0
+
76e0e0
+                xIH->handle( xRequest.get() );
76e0e0
+
76e0e0
+                rtl::Reference< ucbhelper::InteractionContinuation > xSelection
76e0e0
+                    = xRequest->getSelection();
76e0e0
+
76e0e0
+                if ( xSelection.is() )
76e0e0
+                {
76e0e0
+                    // Handler handled the request.
76e0e0
+                    const rtl::Reference< ucbhelper::InteractionAuthFallback >&
76e0e0
+                        xAuthFallback = xRequest->getAuthFallbackInter( );
76e0e0
+                    if ( xAuthFallback.is() )
76e0e0
+                    {
76e0e0
+                        OUString code = xAuthFallback->getCode( );
76e0e0
+                        return strdup( OUSTR_TO_STDSTR( code ).c_str( ) );
76e0e0
+                    }
76e0e0
+                }
76e0e0
+            }
76e0e0
+        }
76e0e0
+
76e0e0
+        return strdup( "" );
76e0e0
+    }
76e0e0
 }
76e0e0
 
76e0e0
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
76e0e0
diff --git a/ucb/source/ucp/cmis/auth_provider.hxx b/ucb/source/ucp/cmis/auth_provider.hxx
76e0e0
index 462f7edba54d..24430401d278 100644
76e0e0
--- a/ucb/source/ucp/cmis/auth_provider.hxx
76e0e0
+++ b/ucb/source/ucp/cmis/auth_provider.hxx
76e0e0
@@ -39,11 +39,11 @@ namespace cmis
76e0e0
 
76e0e0
             bool authenticationQuery( std::string& username, std::string& password ) override;
76e0e0
 
76e0e0
-            std::string getRefreshToken( std::string& username );
76e0e0
-            bool storeRefreshToken(const std::string& username, const std::string& password,
76e0e0
-                                   const std::string& refreshToken);
76e0e0
+            static char* onedriveAuthCodeFallback( const char* url,
76e0e0
+                    const char* /*username*/,
76e0e0
+                    const char* /*password*/ );
76e0e0
 
76e0e0
-            static char* copyWebAuthCodeFallback( const char* url,
76e0e0
+            static char* gdriveAuthCodeFallback( const char* /*url*/,
76e0e0
                     const char* /*username*/,
76e0e0
                     const char* /*password*/ );
76e0e0
 
76e0e0
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
76e0e0
index edb13ddf2457..355575d185d1 100644
76e0e0
--- a/ucb/source/ucp/cmis/cmis_content.cxx
76e0e0
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
76e0e0
@@ -347,15 +347,12 @@ namespace cmis
76e0e0
             string rPassword = OUSTR_TO_STDSTR( m_aURL.getPassword( ) );
76e0e0
 
76e0e0
             bool bSkipInitialPWAuth = false;
76e0e0
-            if (m_aURL.getBindingUrl() == ONEDRIVE_BASE_URL
76e0e0
-                || m_aURL.getBindingUrl() == GDRIVE_BASE_URL)
76e0e0
-            {
76e0e0
+            if ( m_aURL.getBindingUrl( ) == ONEDRIVE_BASE_URL ) {
76e0e0
                 // skip the initial username and pw-auth prompt, the only supported method is the
76e0e0
                 // auth-code-fallback one (login with your browser, copy code into the dialog)
76e0e0
                 // TODO: if LO were to listen on localhost for the request, it would be much nicer
76e0e0
                 // user experience
76e0e0
                 bSkipInitialPWAuth = true;
76e0e0
-                rPassword = aAuthProvider.getRefreshToken(rUsername);
76e0e0
             }
76e0e0
 
76e0e0
             bool bIsDone = false;
76e0e0
@@ -368,9 +365,7 @@ namespace cmis
76e0e0
                     libcmis::OAuth2DataPtr oauth2Data;
76e0e0
                     if ( m_aURL.getBindingUrl( ) == GDRIVE_BASE_URL )
76e0e0
                     {
76e0e0
-                        // reset the skip, so user gets a chance to cancel
76e0e0
-                        bSkipInitialPWAuth = false;
76e0e0
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::copyWebAuthCodeFallback);
76e0e0
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::gdriveAuthCodeFallback);
76e0e0
                         oauth2Data.reset( new libcmis::OAuth2Data(
76e0e0
                             GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
76e0e0
                             GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
76e0e0
@@ -385,7 +380,7 @@ namespace cmis
76e0e0
                     {
76e0e0
                         // reset the skip, so user gets a chance to cancel
76e0e0
                         bSkipInitialPWAuth = false;
76e0e0
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::copyWebAuthCodeFallback);
76e0e0
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::onedriveAuthCodeFallback);
76e0e0
                         oauth2Data.reset( new libcmis::OAuth2Data(
76e0e0
                             ONEDRIVE_AUTH_URL, ONEDRIVE_TOKEN_URL,
76e0e0
                             ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI,
76e0e0
@@ -417,12 +412,6 @@ namespace cmis
76e0e0
                         else
76e0e0
                         {
76e0e0
                             m_pProvider->registerSession(sSessionId, m_aURL.getUsername( ), m_pSession);
76e0e0
-                            if (m_aURL.getBindingUrl() == ONEDRIVE_BASE_URL
76e0e0
-                                || m_aURL.getBindingUrl() == GDRIVE_BASE_URL)
76e0e0
-                            {
76e0e0
-                                aAuthProvider.storeRefreshToken(rUsername, rPassword,
76e0e0
-                                                                m_pSession->getRefreshToken());
76e0e0
-                            }
76e0e0
                         }
76e0e0
 
76e0e0
                         bIsDone = true;
76e0e0
@@ -430,10 +419,7 @@ namespace cmis
76e0e0
                     catch( const libcmis::Exception & e )
76e0e0
                     {
76e0e0
                         if ( e.getType() != "permissionDenied" )
76e0e0
-                        {
76e0e0
-                            SAL_INFO("ucb.ucp.cmis", "Unexpected libcmis exception: " << e.what());
76e0e0
                             throw;
76e0e0
-                        }
76e0e0
                     }
76e0e0
                 }
76e0e0
                 else
76e0e0
@@ -525,7 +511,6 @@ namespace cmis
76e0e0
                 }
76e0e0
                 catch ( const libcmis::Exception& )
76e0e0
                 {
76e0e0
-                    SAL_INFO( "ucb.ucp.cmis", "object: " << OUSTR_TO_STDSTR(m_sObjectId));
76e0e0
                     throw libcmis::Exception( "Object not found" );
76e0e0
                 }
76e0e0
             }
76e0e0
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
76e0e0
index 1bec3152b3b6..d98da53d5e2d 100644
76e0e0
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
76e0e0
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
76e0e0
@@ -165,7 +165,7 @@ namespace cmis
76e0e0
                     libcmis::OAuth2DataPtr oauth2Data;
76e0e0
                     if ( m_aURL.getBindingUrl( ) == GDRIVE_BASE_URL )
76e0e0
                     {
76e0e0
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::copyWebAuthCodeFallback );
76e0e0
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::gdriveAuthCodeFallback );
76e0e0
                         oauth2Data.reset( new libcmis::OAuth2Data(
76e0e0
                             GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
76e0e0
                             GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
76e0e0
@@ -178,7 +178,7 @@ namespace cmis
76e0e0
                             ALFRESCO_CLOUD_CLIENT_ID, ALFRESCO_CLOUD_CLIENT_SECRET ) );
76e0e0
                     if ( m_aURL.getBindingUrl( ) == ONEDRIVE_BASE_URL )
76e0e0
                     {
76e0e0
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::copyWebAuthCodeFallback );
76e0e0
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::onedriveAuthCodeFallback );
76e0e0
                         oauth2Data.reset( new libcmis::OAuth2Data(
76e0e0
                             ONEDRIVE_AUTH_URL, ONEDRIVE_TOKEN_URL,
76e0e0
                             ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI,
76e0e0
-- 
76e0e0
2.31.1
76e0e0