| 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 |
#pragma once |
| 10 |
|
| 11 |
#include <libcmis/libcmis.hxx> |
| 12 |
|
| 13 |
#include <com/sun/star/ucb/XCommandEnvironment.hpp> |
| 14 |
#include <cppuhelper/weakref.hxx> |
| 15 |
|
| 16 |
namespace cmis |
| 17 |
{ |
| 18 |
class AuthProvider : public libcmis::AuthProvider |
| 19 |
{ |
| 20 |
const css::uno::Reference< css::ucb::XCommandEnvironment>& m_xEnv; |
| 21 |
static css::uno::WeakReference< css::ucb::XCommandEnvironment> sm_xEnv; |
| 22 |
OUString m_sUrl; |
| 23 |
OUString m_sBindingUrl; |
| 24 |
|
| 25 |
public: |
| 26 |
AuthProvider ( const css::uno::Reference< css::ucb::XCommandEnvironment> & xEnv, |
| 27 |
OUString sUrl, |
| 28 |
OUString sBindingUrl ): |
| 29 |
m_xEnv( xEnv ), m_sUrl( std::move(sUrl) ), m_sBindingUrl( std::move(sBindingUrl) ) { } |
| 30 |
|
| 31 |
bool authenticationQuery( std::string& username, std::string& password ) override; |
| 32 |
|
| 33 |
std::string getRefreshToken( std::string& username ); |
| 34 |
bool storeRefreshToken(const std::string& username, const std::string& password, |
| 35 |
const std::string& refreshToken); |
| 36 |
|
| 37 |
static char* copyWebAuthCodeFallback( const char* url, |
| 38 |
const char* /*username*/, |
| 39 |
const char* /*password*/ ); |
| 40 |
|
| 41 |
static void setXEnv( const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv ); |
| 42 |
static css::uno::Reference< css::ucb::XCommandEnvironment> getXEnv(); |
| 43 |
|
| 44 |
}; |
| 45 |
} |
| 46 |
|
| 47 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |