[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - include/ucbhelper ucbhelper/source ucb/source

Szymon Kłos eszkadev at gmail.com
Tue Jul 7 23:09:27 PDT 2015


 include/ucbhelper/simpleauthenticationrequest.hxx         |    8 ++-
 ucb/source/ucp/cmis/auth_provider.cxx                     |    2 
 ucb/source/ucp/cmis/cmis_content.cxx                      |    4 -
 ucbhelper/source/provider/simpleauthenticationrequest.cxx |   32 ++++++++++----
 4 files changed, 31 insertions(+), 15 deletions(-)

New commits:
commit 050c4f9ceca3046159f7a24d3d5abf8ec4e47fb3
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Thu Jul 2 11:24:39 2015 +0200

    tdf#84190 : when auth fails, don't remember passwords for cmis
    
    Change-Id: Ia1e0d553556693e0efa6de0bfc6f8b0ae9d40b5d
    Reviewed-on: https://gerrit.libreoffice.org/16688
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/ucbhelper/simpleauthenticationrequest.hxx b/include/ucbhelper/simpleauthenticationrequest.hxx
index 85e949e..7bc5a40 100644
--- a/include/ucbhelper/simpleauthenticationrequest.hxx
+++ b/include/ucbhelper/simpleauthenticationrequest.hxx
@@ -60,8 +60,9 @@ private:
                      bool bCanSetUserName,
                      bool bCanSetPassword,
                      bool bCanSetAccount,
-                      bool bAllowPersistentStoring,
-                     bool bAllowUseSystemCredentials );
+                     bool bAllowPersistentStoring,
+                     bool bAllowUseSystemCredentials,
+                     bool bAllowSessionStoring = true );
 
 public:
     /** Specification whether some entity (realm, username, password, account)
@@ -97,7 +98,8 @@ public:
                                  const OUString & rPassword,
                                  const OUString & rAccount,
                                  bool bAllowPersistentStoring,
-                                 bool bAllowUseSystemCredentials );
+                                 bool bAllowUseSystemCredentials,
+                                 bool bAllowSessionStoring = true );
 
 
     /**
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx b/ucb/source/ucp/cmis/auth_provider.cxx
index 97414f1..500b601 100644
--- a/ucb/source/ucp/cmis/auth_provider.cxx
+++ b/ucb/source/ucp/cmis/auth_provider.cxx
@@ -38,7 +38,7 @@ namespace cmis
                         m_sUrl, m_sBindingUrl, OUString(),
                         STD_TO_OUSTR( username ),
                         STD_TO_OUSTR( password ),
-                        OUString(), true, false );
+                        OUString(), true, false, false );
                 xIH->handle( xRequest.get() );
 
                 rtl::Reference< ucbhelper::InteractionContinuation > xSelection
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index b54c246..34f5b9f 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -362,7 +362,6 @@ namespace cmis
                         ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI,
                         ONEDRIVE_CLIENT_ID, ONEDRIVE_CLIENT_SECRET ) );
                 }
-
                 m_pSession = libcmis::SessionFactory::createSession(
                         OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ),
                         rUsername, rPassword, OUSTR_TO_STDSTR( m_aURL.getRepositoryId( ) ), false, oauth2Data );
@@ -372,7 +371,8 @@ namespace cmis
                                         uno::Sequence< uno::Any >( 0 ),
                                         xEnv,
                                         OUString( ) );
-                m_pProvider->registerSession( sSessionId, m_pSession );
+                else
+                    m_pProvider->registerSession( sSessionId, m_pSession );
             }
             else
             {
diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
index cdaa80a..ad6c9cd 100644
--- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx
+++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
@@ -33,7 +33,8 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
                                       const OUString & rPassword,
                                       const OUString & rAccount,
                                       bool bAllowPersistentStoring,
-                                      bool bAllowUseSystemCredentials )
+                                      bool bAllowUseSystemCredentials,
+                                      bool bAllowSessionStoring )
 {
 
     // Fill request...
@@ -61,7 +62,8 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
        true,
        aRequest.HasAccount,
        bAllowPersistentStoring,
-       bAllowUseSystemCredentials );
+       bAllowUseSystemCredentials,
+       bAllowSessionStoring );
 }
 
 
@@ -115,17 +117,29 @@ void SimpleAuthenticationRequest::initialize(
       bool bCanSetPassword,
       bool bCanSetAccount,
       bool bAllowPersistentStoring,
-      bool bAllowUseSystemCredentials )
+      bool bAllowUseSystemCredentials,
+      bool bAllowSessionStoring )
 {
     setRequest( uno::makeAny( rRequest ) );
 
     // Fill continuations...
-    uno::Sequence< ucb::RememberAuthentication > aRememberModes(
-        bAllowPersistentStoring ? 3 : 2 );
-    aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
-    aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
-    if (bAllowPersistentStoring)
-        aRememberModes[ 2 ] = ucb::RememberAuthentication_PERSISTENT;
+    unsigned int nSize = 1;
+    unsigned int nPos = 0;
+
+    if( bAllowSessionStoring )
+        nSize++;
+
+    if( bAllowPersistentStoring )
+        nSize++;
+
+    uno::Sequence< ucb::RememberAuthentication > aRememberModes( nSize );
+    aRememberModes[ nPos++ ] = ucb::RememberAuthentication_NO;
+
+    if( bAllowSessionStoring )
+        aRememberModes[ nPos++ ] = ucb::RememberAuthentication_SESSION;
+
+    if ( bAllowPersistentStoring )
+        aRememberModes[ nPos++ ] = ucb::RememberAuthentication_PERSISTENT;
 
     m_xAuthSupplier
         = new InteractionSupplyAuthentication(


More information about the Libreoffice-commits mailing list