LCOV - code coverage report
Current view: top level - uui/source - passwordcontainer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #ifndef INCLUDED_UUI_PASSWORDCONTAINER_HXX
      21                 :            : #define INCLUDED_UUI_PASSWORDCONTAINER_HXX
      22                 :            : 
      23                 :            : #include "cppuhelper/implbase2.hxx"
      24                 :            : 
      25                 :            : #include "com/sun/star/lang/XServiceInfo.hpp"
      26                 :            : #include "com/sun/star/lang/XSingleServiceFactory.hpp"
      27                 :            : #include "com/sun/star/task/XInteractionHandler.hpp"
      28                 :            : #include "com/sun/star/task/XPasswordContainer.hpp"
      29                 :            : 
      30                 :            : namespace com {
      31                 :            :     namespace sun {
      32                 :            :         namespace star {
      33                 :            :             namespace lang {
      34                 :            :                 class XMultiServiceFactory;
      35                 :            :             }
      36                 :            :             namespace ucb {
      37                 :            :                 class AuthenticationRequest;
      38                 :            :                 class XInteractionSupplyAuthentication;
      39                 :            : } } } }
      40                 :            : 
      41                 :            : namespace uui {
      42                 :            : 
      43                 :            : // ============================================================================
      44                 :            : 
      45                 :            : /** Passwordcontainer UNO service (com.sun.star.task.PasswordContainer) helper.
      46                 :            :  */
      47                 :          0 : class PasswordContainerHelper
      48                 :            : {
      49                 :            : public:
      50                 :            :     PasswordContainerHelper(
      51                 :            :         com::sun::star::uno::Reference<
      52                 :            :             com::sun::star::lang::XMultiServiceFactory > const &
      53                 :            :                 xServiceFactory );
      54                 :            : 
      55                 :            :     // ------------------------------------------------------------------------
      56                 :            : 
      57                 :            :     /** This member function tries to handle an authentication interaction
      58                 :            :         request by looking up credentials for the given URL in the password
      59                 :            :         container service.
      60                 :            : 
      61                 :            :         In case of success the given interaction continuation
      62                 :            :         (XInteractionSupplyAuthentication) is filled with the credentials found
      63                 :            :         in the password container.
      64                 :            : 
      65                 :            :         Please note the the continuation gets not "selected" by this
      66                 :            :         implementation. "Selecting" the continuation is up to the caller (e.g.
      67                 :            :         an implementation of XInteractionHandler::handle) of this function.
      68                 :            : 
      69                 :            :         @param rRequest
      70                 :            :             The authentication request.
      71                 :            : 
      72                 :            :         @param xSupplyAuthentication
      73                 :            :             The "supply authentication" interaction continuation.
      74                 :            : 
      75                 :            :         @param rURL
      76                 :            :             The URL to lookup credentials for.
      77                 :            : 
      78                 :            :         @param xIH
      79                 :            :             The interaction handler to use, for example if a master password is
      80                 :            :             needed to access the password container.
      81                 :            : 
      82                 :            :         @return
      83                 :            :             True, if the authentication request was handled successfully.
      84                 :            :             False, otherwise.
      85                 :            :      */
      86                 :            :     bool handleAuthenticationRequest(
      87                 :            :         com::sun::star::ucb::AuthenticationRequest const & rRequest,
      88                 :            :         com::sun::star::uno::Reference<
      89                 :            :             com::sun::star::ucb::XInteractionSupplyAuthentication > const &
      90                 :            :                 xSupplyAuthentication,
      91                 :            :         rtl::OUString const & rURL,
      92                 :            :         com::sun::star::uno::Reference<
      93                 :            :             com::sun::star::task::XInteractionHandler > const & xIH )
      94                 :            :     SAL_THROW( (com::sun::star::uno::RuntimeException) );
      95                 :            : 
      96                 :            :     /** This member function adds credentials for the given URL to the password
      97                 :            :         container.
      98                 :            : 
      99                 :            :         @param rURL
     100                 :            :             The URL the credentials are valid for. rURL must not be empty.
     101                 :            : 
     102                 :            :         @param rUsername
     103                 :            :             The user name.
     104                 :            : 
     105                 :            :         @param rPasswords
     106                 :            :             This list of passwords.
     107                 :            : 
     108                 :            :         @param xIH
     109                 :            :             The interaction handler to use, for example if a master password is
     110                 :            :             needed to access the password container.
     111                 :            : 
     112                 :            :         @param bPersist
     113                 :            :             True, the record will get stored persistently; restored upon
     114                 :            :             password container initialization
     115                 :            :             False, the record will be stored until password container instance
     116                 :            :             gets destroyed.
     117                 :            : 
     118                 :            :         @return
     119                 :            :             True, if the record was added successfully.
     120                 :            :             False, otherwise.
     121                 :            : 
     122                 :            :     */
     123                 :            :     bool addRecord( rtl::OUString const & rURL,
     124                 :            :                     rtl::OUString const & rUsername,
     125                 :            :                     com::sun::star::uno::Sequence< rtl::OUString > const &
     126                 :            :                     rPasswords,
     127                 :            :                     com::sun::star::uno::Reference<
     128                 :            :                         com::sun::star::task::XInteractionHandler > const & xIH,
     129                 :            :                     bool bPersist )
     130                 :            :         SAL_THROW( (com::sun::star::uno::RuntimeException) );
     131                 :            : 
     132                 :            :     // ------------------------------------------------------------------------
     133                 :            : 
     134                 :            : private:
     135                 :            :     com::sun::star::uno::Reference<
     136                 :            :         com::sun::star::task::XPasswordContainer > m_xPasswordContainer;
     137                 :            : };
     138                 :            : 
     139                 :            : // ============================================================================
     140                 :            : 
     141                 :            : class PasswordContainerInteractionHandler :
     142                 :            :         public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
     143                 :            :                                       com::sun::star::task::XInteractionHandler >
     144                 :            : {
     145                 :            : public:
     146                 :            :     PasswordContainerInteractionHandler(
     147                 :            :         const com::sun::star::uno::Reference<
     148                 :            :             com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
     149                 :            :     virtual ~PasswordContainerInteractionHandler();
     150                 :            : 
     151                 :            :     // XServiceInfo
     152                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName()
     153                 :            :         throw ( com::sun::star::uno::RuntimeException );
     154                 :            : 
     155                 :            :     virtual sal_Bool SAL_CALL
     156                 :            :     supportsService( const ::rtl::OUString& ServiceName )
     157                 :            :         throw ( com::sun::star::uno::RuntimeException );
     158                 :            : 
     159                 :            :     virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
     160                 :            :     getSupportedServiceNames()
     161                 :            :         throw ( com::sun::star::uno::RuntimeException );
     162                 :            : 
     163                 :            :     // XInteractionHandler
     164                 :            :     virtual void SAL_CALL
     165                 :            :     handle( const ::com::sun::star::uno::Reference<
     166                 :            :                 ::com::sun::star::task::XInteractionRequest >& Request )
     167                 :            :         throw (::com::sun::star::uno::RuntimeException);
     168                 :            : 
     169                 :            :     // Non-UNO interfaces
     170                 :            :     static rtl::OUString
     171                 :            :     getImplementationName_Static();
     172                 :            : 
     173                 :            :     static com::sun::star::uno::Sequence< rtl::OUString >
     174                 :            :     getSupportedServiceNames_Static();
     175                 :            : 
     176                 :            :     static com::sun::star::uno::Reference<
     177                 :            :             com::sun::star::lang::XSingleServiceFactory >
     178                 :            :     createServiceFactory( const com::sun::star::uno::Reference<
     179                 :            :             com::sun::star::lang::XMultiServiceFactory > & rxServiceMgr );
     180                 :            : 
     181                 :            : private:
     182                 :            :     //com::sun::star::uno::Reference<
     183                 :            :     //    com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
     184                 :            :     PasswordContainerHelper m_aPwContainerHelper;
     185                 :            : };
     186                 :            : 
     187                 :            : } // namespace uui
     188                 :            : 
     189                 :            : #endif
     190                 :            : 
     191                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10