LCOV - code coverage report
Current view: top level - ucb/source/ucp/cmis - auth_provider.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 21 0.0 %
Date: 2014-11-03 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #define OUSTR_TO_STDSTR(s) string( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
      11             : #define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
      12             : 
      13             : #include <com/sun/star/task/XInteractionHandler.hpp>
      14             : 
      15             : #include <ucbhelper/simpleauthenticationrequest.hxx>
      16             : 
      17             : #include "auth_provider.hxx"
      18             : 
      19             : using namespace com::sun::star;
      20             : using namespace std;
      21             : 
      22             : namespace cmis
      23             : {
      24           0 :     bool AuthProvider::authenticationQuery( string& username, string& password )
      25             :     {
      26           0 :         if ( m_xEnv.is() )
      27             :         {
      28             :             uno::Reference< task::XInteractionHandler > xIH
      29           0 :                 = m_xEnv->getInteractionHandler();
      30             : 
      31           0 :             if ( xIH.is() )
      32             :             {
      33             :                 rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest
      34             :                     = new ucbhelper::SimpleAuthenticationRequest(
      35             :                         m_sUrl, m_sBindingUrl, OUString(),
      36           0 :                         STD_TO_OUSTR( username ),
      37           0 :                         STD_TO_OUSTR( password ),
      38           0 :                         OUString(), true, false );
      39           0 :                 xIH->handle( xRequest.get() );
      40             : 
      41             :                 rtl::Reference< ucbhelper::InteractionContinuation > xSelection
      42           0 :                     = xRequest->getSelection();
      43             : 
      44           0 :                 if ( xSelection.is() )
      45             :                 {
      46             :                     // Handler handled the request.
      47             :                     uno::Reference< task::XInteractionAbort > xAbort(
      48           0 :                         xSelection.get(), uno::UNO_QUERY );
      49           0 :                     if ( !xAbort.is() )
      50             :                     {
      51             :                         const rtl::Reference<
      52             :                             ucbhelper::InteractionSupplyAuthentication > & xSupp
      53           0 :                             = xRequest->getAuthenticationSupplier();
      54             : 
      55           0 :                         username = OUSTR_TO_STDSTR( xSupp->getUserName() );
      56           0 :                         password = OUSTR_TO_STDSTR( xSupp->getPassword() );
      57             : 
      58           0 :                         return true;
      59           0 :                     }
      60           0 :                 }
      61           0 :             }
      62             :         }
      63           0 :         return false;
      64             :     }
      65           0 : }
      66             : 
      67             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10