LibreOffice Module ucb (master) 1
auth_provider.hxx
Go to the documentation of this file.
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#if defined __GNUC__ && !defined __clang__
12#pragma GCC diagnostic push
13#pragma GCC diagnostic ignored "-Wdeprecated"
14#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
15#endif
16#include <libcmis/libcmis.hxx>
17#if defined __GNUC__ && !defined __clang__
18#pragma GCC diagnostic pop
19#endif
20
21#include <com/sun/star/ucb/XCommandEnvironment.hpp>
23
24namespace cmis
25{
26 class AuthProvider : public libcmis::AuthProvider
27 {
28 const css::uno::Reference< css::ucb::XCommandEnvironment>& m_xEnv;
29 static css::uno::WeakReference< css::ucb::XCommandEnvironment> sm_xEnv;
30 OUString m_sUrl;
31 OUString m_sBindingUrl;
32
33 public:
34 AuthProvider ( const css::uno::Reference< css::ucb::XCommandEnvironment> & xEnv,
35 OUString sUrl,
36 OUString sBindingUrl ):
37 m_xEnv( xEnv ), m_sUrl( std::move(sUrl) ), m_sBindingUrl( std::move(sBindingUrl) ) { }
38
39 bool authenticationQuery( std::string& username, std::string& password ) override;
40
41 std::string getRefreshToken( std::string& username );
42 bool storeRefreshToken(const std::string& username, const std::string& password,
43 const std::string& refreshToken);
44
45 static char* copyWebAuthCodeFallback( const char* url,
46 const char* /*username*/,
47 const char* /*password*/ );
48
49 static void setXEnv( const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv );
50 static css::uno::Reference< css::ucb::XCommandEnvironment> getXEnv();
51
52 };
53}
54
55/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool authenticationQuery(std::string &username, std::string &password) override
bool storeRefreshToken(const std::string &username, const std::string &password, const std::string &refreshToken)
AuthProvider(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv, OUString sUrl, OUString sBindingUrl)
static css::uno::WeakReference< css::ucb::XCommandEnvironment > sm_xEnv
const css::uno::Reference< css::ucb::XCommandEnvironment > & m_xEnv
static void setXEnv(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
static char * copyWebAuthCodeFallback(const char *url, const char *, const char *)
std::string getRefreshToken(std::string &username)
static css::uno::Reference< css::ucb::XCommandEnvironment > getXEnv()