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