Kaydet (Commit) 4998e6a3 authored tarafından Mihai Varga's avatar Mihai Varga Kaydeden (comit) Miklos Vajna

Authentication fallback request for the OneDrive connection

To fix build, also squashed in:

Author: Mihai Varga <mihai.mv13@gmail.com>
Date:   Fri Aug 1 12:50:23 2014 +0300

    OneDrive auth fallback dialog interaction continuation

Change-Id: Id37f502217da3fde55ae93a6e1c01409509d657c
üst fc79b871
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_UCBHELPER_AUTHENTICATIONFALLBACK_HXX
#define INCLUDED_UCBHELPER_AUTHENTICATIONFALLBACK_HXX
#include <rtl/ref.hxx>
#include <ucbhelper/interactionrequest.hxx>
#include <ucbhelper/ucbhelperdllapi.h>
#include <com/sun/star/ucb/AuthenticationFallbackRequest.hpp>
namespace ucbhelper {
/**
* This class implements a simple authentication interaction request used
* when programmatically authentication cannot succeed.
*
* Read-only values : instructions, url
* Read-write values: code
*/
class UCBHELPER_DLLPUBLIC AuthenticationFallbackRequest : public ucbhelper::InteractionRequest
{
private:
rtl::Reference< ucbhelper::InteractionAuthFallback > m_xAuthFallback;
public:
/**
* Constructor.
*
* @param rInstructions instructions to be followed by the user
* @param rURL contains a URL for which authentication is requested.
*/
AuthenticationFallbackRequest( const OUString & rInstructions,
const OUString & rURL );
const rtl::Reference< ucbhelper::InteractionAuthFallback >&
getAuthFallbackInter( ) const { return m_xAuthFallback; }
};
} // namespace ucbhelper
#endif /* ! INCLUDED_UCBHELPER_AUTHENTICATIONFALLBACK_HXX*/
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,6 +26,7 @@
#include <com/sun/star/task/XInteractionRetry.hpp>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionDisapprove.hpp>
#include <com/sun/star/ucb/XInteractionAuthFallback.hpp>
#include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
#include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
#include <rtl/ref.hxx>
......@@ -660,6 +661,39 @@ public:
throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
};
class UCBHELPER_DLLPUBLIC InteractionAuthFallback:
public InteractionContinuation,
public com::sun::star::ucb::XInteractionAuthFallback
{
OUString m_aCode;
public:
InteractionAuthFallback( InteractionRequest * pRequest )
: InteractionContinuation( pRequest ) {}
// XInterface
virtual com::sun::star::uno::Any SAL_CALL
queryInterface( const com::sun::star::uno::Type & rType )
throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual void SAL_CALL acquire()
throw() SAL_OVERRIDE;
virtual void SAL_CALL release()
throw() SAL_OVERRIDE;
// XInteractionContinuation
virtual void SAL_CALL select()
throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
// XAuthFallback
virtual void SAL_CALL setCode( const OUString& code )
throw (::css::uno::RuntimeException, ::std::exception);
virtual OUString SAL_CALL getCode()
throw (::css::uno::RuntimeException, ::std::exception);
};
} // namespace ucbhelper
#endif /* ! INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX */
......
......@@ -3938,6 +3938,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ucb,\
XFetchProvider \
XFetchProviderForContentAccess \
XFileIdentifierConverter \
XInteractionAuthFallback \
XInteractionHandlerSupplier \
XInteractionReplaceExistingData \
XInteractionSupplyAuthentication \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef __com_sun_star_task_XInteractionApprove_idl__
#define __com_sun_star_task_XInteractionApprove_idl__
#include <com/sun/star/task/XInteractionContinuation.idl>
module com { module sun { module star { module ucb {
/** An interaction continuation specifying authentication success.
*/
published interface XInteractionAuthFallback: com::sun::star::task::XInteractionContinuation
{
/* Authentication code submited by the user */
void setCode( [in] string code );
string getCode( );
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -33,6 +33,7 @@ $(eval $(call gb_Library_add_exception_objects,ucbhelper,\
ucbhelper/source/client/fileidentifierconverter \
ucbhelper/source/client/interceptedinteraction \
ucbhelper/source/client/proxydecider \
ucbhelper/source/provider/authenticationfallback \
ucbhelper/source/provider/cancelcommandexecution \
ucbhelper/source/provider/contenthelper \
ucbhelper/source/provider/contentidentifier \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <ucbhelper/authenticationfallback.hxx>
using namespace com::sun::star;
using namespace ucbhelper;
AuthenticationFallbackRequest::AuthenticationFallbackRequest(
const OUString & rInstructions,
const OUString & rURL )
{
ucb::AuthenticationFallbackRequest aRequest;
aRequest.instructions = rInstructions;
aRequest.url = rURL;
setRequest( uno::makeAny( aRequest ) );
m_xAuthFallback = new InteractionAuthFallback( this );
uno::Sequence<
uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
aContinuations[ 0 ] = new InteractionAbort( this );
aContinuations[ 1 ] = m_xAuthFallback.get( );
setContinuations( aContinuations );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -940,4 +940,60 @@ void SAL_CALL InteractionReplaceExistingData::select()
recordSelection();
}
// InteractionAuthFallback Implementation
// XInterface methods.
// virtual
void SAL_CALL InteractionAuthFallback::acquire()
throw()
{
OWeakObject::acquire();
}
// virtual
void SAL_CALL InteractionAuthFallback::release()
throw()
{
OWeakObject::release();
}
// virtual
uno::Any SAL_CALL
InteractionAuthFallback::queryInterface( const uno::Type & rType )
throw ( uno::RuntimeException, std::exception )
{
uno::Any aRet = cppu::queryInterface( rType,
static_cast< task::XInteractionContinuation * >( this ),
static_cast< ucb::XInteractionAuthFallback * >( this ));
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
}
// XInteractionContinuation methods.
// virtual
void SAL_CALL InteractionAuthFallback::select()
throw( uno::RuntimeException, std::exception )
{
recordSelection();
}
// XInteractionAuthFallback methods
// virtual
void SAL_CALL InteractionAuthFallback::setCode( const OUString& code )
throw ( uno::RuntimeException, std::exception )
{
m_aCode = code;
}
// virtual
OUString SAL_CALL InteractionAuthFallback::getCode( )
throw ( uno::RuntimeException, std::exception )
{
return m_aCode;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment