139a19a47SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 339a19a47SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 439a19a47SAndrew Rist * or more contributor license agreements. See the NOTICE file 539a19a47SAndrew Rist * distributed with this work for additional information 639a19a47SAndrew Rist * regarding copyright ownership. The ASF licenses this file 739a19a47SAndrew Rist * to you under the Apache License, Version 2.0 (the 839a19a47SAndrew Rist * "License"); you may not use this file except in compliance 939a19a47SAndrew Rist * with the License. You may obtain a copy of the License at 1039a19a47SAndrew Rist * 1139a19a47SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1239a19a47SAndrew Rist * 1339a19a47SAndrew Rist * Unless required by applicable law or agreed to in writing, 1439a19a47SAndrew Rist * software distributed under the License is distributed on an 1539a19a47SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1639a19a47SAndrew Rist * KIND, either express or implied. See the License for the 1739a19a47SAndrew Rist * specific language governing permissions and limitations 1839a19a47SAndrew Rist * under the License. 1939a19a47SAndrew Rist * 2039a19a47SAndrew Rist *************************************************************/ 2139a19a47SAndrew Rist 2239a19a47SAndrew Rist 23cdf0e10cSrcweir #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX 24cdf0e10cSrcweir #define INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <list> 27cdf0e10cSrcweir #include <vector> 28cdf0e10cSrcweir #include <map> 29cdf0e10cSrcweir #include <com/sun/star/task/XPasswordContainer.hpp> 30cdf0e10cSrcweir #include <com/sun/star/task/XUrlContainer.hpp> 31cdf0e10cSrcweir #include <com/sun/star/task/PasswordRequestMode.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp> 35cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 36cdf0e10cSrcweir #include <com/sun/star/task/XMasterPasswordHandling2.hpp> 37cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 38cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 39cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx> 40cdf0e10cSrcweir #include <cppuhelper/factory.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <tools/stream.hxx> 43cdf0e10cSrcweir #include <unotools/configitem.hxx> 44cdf0e10cSrcweir #include <ucbhelper/interactionrequest.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <rtl/ref.hxx> 47cdf0e10cSrcweir #include <osl/mutex.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "syscreds.hxx" 50cdf0e10cSrcweir 51cdf0e10cSrcweir #define MEMORY_RECORD 0 52cdf0e10cSrcweir #define PERSISTENT_RECORD 1 53cdf0e10cSrcweir 54cdf0e10cSrcweir //---------------------------------------------------------------------------------- 55cdf0e10cSrcweir 56cdf0e10cSrcweir class NamePassRecord 57cdf0e10cSrcweir { 58cdf0e10cSrcweir ::rtl::OUString m_aName; 59cdf0e10cSrcweir 60cdf0e10cSrcweir // there are two lists of passwords, memory passwords and persistent passwords 61cdf0e10cSrcweir sal_Bool m_bHasMemPass; 62cdf0e10cSrcweir ::std::vector< ::rtl::OUString > m_aMemPass; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // persistent passwords are encrypted in one string 65cdf0e10cSrcweir sal_Bool m_bHasPersPass; 66cdf0e10cSrcweir ::rtl::OUString m_aPersPass; 67cdf0e10cSrcweir InitArrays(sal_Bool bHasMemoryList,const::std::vector<::rtl::OUString> & aMemoryList,sal_Bool bHasPersistentList,const::rtl::OUString & aPersistentList)68cdf0e10cSrcweir void InitArrays( sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, 69cdf0e10cSrcweir sal_Bool bHasPersistentList, const ::rtl::OUString& aPersistentList ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir m_bHasMemPass = bHasMemoryList; 72cdf0e10cSrcweir if ( bHasMemoryList ) 73cdf0e10cSrcweir m_aMemPass = aMemoryList; 74cdf0e10cSrcweir 75cdf0e10cSrcweir m_bHasPersPass = bHasPersistentList; 76cdf0e10cSrcweir if ( bHasPersistentList ) 77cdf0e10cSrcweir m_aPersPass = aPersistentList; 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir NamePassRecord(const::rtl::OUString & aName)82cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName ) 83cdf0e10cSrcweir : m_aName( aName ) 84cdf0e10cSrcweir , m_bHasMemPass( sal_False ) 85cdf0e10cSrcweir , m_bHasPersPass( sal_False ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir } 88cdf0e10cSrcweir NamePassRecord(const::rtl::OUString & aName,const::std::vector<::rtl::OUString> & aMemoryList)89cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName, const ::std::vector< ::rtl::OUString >& aMemoryList ) 90cdf0e10cSrcweir : m_aName( aName ) 91cdf0e10cSrcweir , m_bHasMemPass( sal_True ) 92cdf0e10cSrcweir , m_aMemPass( aMemoryList ) 93cdf0e10cSrcweir , m_bHasPersPass( sal_False ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir } 96cdf0e10cSrcweir NamePassRecord(const::rtl::OUString & aName,const::rtl::OUString & aPersistentList)97cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName, const ::rtl::OUString& aPersistentList ) 98cdf0e10cSrcweir : m_aName( aName ) 99cdf0e10cSrcweir , m_bHasMemPass( sal_False ) 100cdf0e10cSrcweir , m_bHasPersPass( sal_True ) 101cdf0e10cSrcweir , m_aPersPass( aPersistentList ) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir } 104cdf0e10cSrcweir NamePassRecord(const::rtl::OUString & aName,sal_Bool bHasMemoryList,const::std::vector<::rtl::OUString> & aMemoryList,sal_Bool bHasPersistentList,const::rtl::OUString aPersistentList)105cdf0e10cSrcweir NamePassRecord( const ::rtl::OUString& aName, 106cdf0e10cSrcweir sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, 107cdf0e10cSrcweir sal_Bool bHasPersistentList, const ::rtl::OUString aPersistentList ) 108cdf0e10cSrcweir : m_aName( aName ) 109cdf0e10cSrcweir , m_bHasMemPass( bHasMemoryList ) 110cdf0e10cSrcweir , m_bHasPersPass( bHasPersistentList ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir InitArrays( bHasMemoryList, aMemoryList, bHasPersistentList, aPersistentList ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir NamePassRecord(const NamePassRecord & aRecord)115cdf0e10cSrcweir NamePassRecord( const NamePassRecord& aRecord ) 116cdf0e10cSrcweir : m_aName( aRecord.m_aName ) 117cdf0e10cSrcweir , m_bHasMemPass( sal_False ) 118cdf0e10cSrcweir , m_bHasPersPass( sal_False ) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); 121cdf0e10cSrcweir } 122cdf0e10cSrcweir operator =(const NamePassRecord & aRecord)123cdf0e10cSrcweir NamePassRecord& operator=( const NamePassRecord& aRecord ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir m_aName = aRecord.m_aName; 126cdf0e10cSrcweir 127cdf0e10cSrcweir m_aMemPass.clear(); 128cdf0e10cSrcweir m_aPersPass = ::rtl::OUString(); 129cdf0e10cSrcweir InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir return *this; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir GetUserName() const134cdf0e10cSrcweir ::rtl::OUString GetUserName() const 135cdf0e10cSrcweir { 136cdf0e10cSrcweir return m_aName; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir HasPasswords(sal_Int8 nStatus) const139cdf0e10cSrcweir sal_Bool HasPasswords( sal_Int8 nStatus ) const 140cdf0e10cSrcweir { 141cdf0e10cSrcweir if ( nStatus == MEMORY_RECORD ) 142cdf0e10cSrcweir return m_bHasMemPass; 143cdf0e10cSrcweir if ( nStatus == PERSISTENT_RECORD ) 144cdf0e10cSrcweir return m_bHasPersPass; 145cdf0e10cSrcweir 146cdf0e10cSrcweir return sal_False; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir GetMemPasswords() const149cdf0e10cSrcweir ::std::vector< ::rtl::OUString > GetMemPasswords() const 150cdf0e10cSrcweir { 151cdf0e10cSrcweir if ( m_bHasMemPass ) 152cdf0e10cSrcweir return m_aMemPass; 153cdf0e10cSrcweir 154cdf0e10cSrcweir return ::std::vector< ::rtl::OUString >(); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir GetPersPasswords() const157cdf0e10cSrcweir ::rtl::OUString GetPersPasswords() const 158cdf0e10cSrcweir { 159cdf0e10cSrcweir if ( m_bHasPersPass ) 160cdf0e10cSrcweir return m_aPersPass; 161cdf0e10cSrcweir 162cdf0e10cSrcweir return ::rtl::OUString(); 163cdf0e10cSrcweir } 164cdf0e10cSrcweir SetMemPasswords(const::std::vector<::rtl::OUString> & aMemList)165cdf0e10cSrcweir void SetMemPasswords( const ::std::vector< ::rtl::OUString >& aMemList ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir m_aMemPass = aMemList; 168cdf0e10cSrcweir m_bHasMemPass = sal_True; 169cdf0e10cSrcweir } 170cdf0e10cSrcweir SetPersPasswords(const::rtl::OUString & aPersList)171cdf0e10cSrcweir void SetPersPasswords( const ::rtl::OUString& aPersList ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir m_aPersPass = aPersList; 174cdf0e10cSrcweir m_bHasPersPass = sal_True; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir RemovePasswords(sal_Int8 nStatus)177cdf0e10cSrcweir void RemovePasswords( sal_Int8 nStatus ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir if ( nStatus == MEMORY_RECORD ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir m_bHasMemPass = sal_False; 182cdf0e10cSrcweir m_aMemPass.clear(); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir else if ( nStatus == PERSISTENT_RECORD ) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir m_bHasPersPass = sal_False; 187cdf0e10cSrcweir m_aPersPass = ::rtl::OUString(); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir }; 192cdf0e10cSrcweir 193cdf0e10cSrcweir //---------------------------------------------------------------------------------- 194cdf0e10cSrcweir 195cdf0e10cSrcweir typedef ::std::pair< const ::rtl::OUString, ::std::list< NamePassRecord > > PairUrlRecord; 196cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, ::std::list< NamePassRecord > > PassMap; 197cdf0e10cSrcweir 198cdf0e10cSrcweir //---------------------------------------------------------------------------------- 199cdf0e10cSrcweir 200cdf0e10cSrcweir class PasswordContainer; 201cdf0e10cSrcweir 202cdf0e10cSrcweir class StorageItem : public ::utl::ConfigItem { 203cdf0e10cSrcweir PasswordContainer* mainCont; 204cdf0e10cSrcweir sal_Bool hasEncoded; 205cdf0e10cSrcweir ::rtl::OUString mEncoded; 206cdf0e10cSrcweir public: StorageItem(PasswordContainer * point,const::rtl::OUString & path)207cdf0e10cSrcweir StorageItem( PasswordContainer* point, const ::rtl::OUString& path ) : 208cdf0e10cSrcweir ConfigItem( path, CONFIG_MODE_IMMEDIATE_UPDATE ), 209cdf0e10cSrcweir mainCont( point ), 210cdf0e10cSrcweir hasEncoded( sal_False ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > aNode( 1 ); 213cdf0e10cSrcweir *aNode.getArray() = path; 214cdf0e10cSrcweir *aNode.getArray() += ::rtl::OUString::createFromAscii( "/Store" ); 215cdf0e10cSrcweir EnableNotification( aNode ); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir PassMap getInfo(); 219cdf0e10cSrcweir void update( const ::rtl::OUString& url, const NamePassRecord& rec ); 220cdf0e10cSrcweir void remove( const ::rtl::OUString& url, const ::rtl::OUString& rec ); 221cdf0e10cSrcweir void clear(); 222cdf0e10cSrcweir 223cdf0e10cSrcweir sal_Bool getEncodedMP( ::rtl::OUString& aResult ); 224cdf0e10cSrcweir void setEncodedMP( const ::rtl::OUString& aResult, sal_Bool bAcceptEnmpty = sal_False ); 225cdf0e10cSrcweir void setUseStorage( sal_Bool bUse ); 226cdf0e10cSrcweir sal_Bool useStorage(); 227cdf0e10cSrcweir 228cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ); 229cdf0e10cSrcweir virtual void Commit(); 230cdf0e10cSrcweir }; 231cdf0e10cSrcweir 232cdf0e10cSrcweir //---------------------------------------------------------------------------------- 233cdf0e10cSrcweir 234cdf0e10cSrcweir enum PasswordState { 235cdf0e10cSrcweir no_password, 236cdf0e10cSrcweir entered, 237cdf0e10cSrcweir cancelled 238cdf0e10cSrcweir }; 239cdf0e10cSrcweir 240cdf0e10cSrcweir class PasswordContainer : public ::cppu::WeakImplHelper5< 241cdf0e10cSrcweir ::com::sun::star::task::XPasswordContainer, 242cdf0e10cSrcweir ::com::sun::star::task::XMasterPasswordHandling2, 243cdf0e10cSrcweir ::com::sun::star::task::XUrlContainer, 244cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo, 245cdf0e10cSrcweir ::com::sun::star::lang::XEventListener > 246cdf0e10cSrcweir { 247cdf0e10cSrcweir private: 248cdf0e10cSrcweir PassMap m_aContainer; 249cdf0e10cSrcweir StorageItem* m_pStorageFile; 250cdf0e10cSrcweir ::osl::Mutex mMutex; 251cdf0e10cSrcweir ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty 252*154e49a8Scbmarcum /// True if we detected the older password encoding (pre-4.1.13) 253*154e49a8Scbmarcum bool mOldPasswordEncoding; 254cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent; 255cdf0e10cSrcweir SysCredentialsConfig mUrlContainer; 256cdf0e10cSrcweir 257cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence( 258cdf0e10cSrcweir const ::std::list< NamePassRecord >& original, 259cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 260cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 261cdf0e10cSrcweir 262cdf0e10cSrcweir ::com::sun::star::task::UserRecord CopyToUserRecord( 263cdf0e10cSrcweir const NamePassRecord& aRecord, 264cdf0e10cSrcweir sal_Bool& io_bTryToDecode, 265cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ); 266cdf0e10cSrcweir 267cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > FindUsr( 268cdf0e10cSrcweir const ::std::list< NamePassRecord >& userlist, 269cdf0e10cSrcweir const ::rtl::OUString& name, 270cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 271cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 272cdf0e10cSrcweir bool createUrlRecord( 273*154e49a8Scbmarcum const PairUrlRecord & rPair, 274cdf0e10cSrcweir bool bName, 275cdf0e10cSrcweir const ::rtl::OUString & aName, 276cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler, 277cdf0e10cSrcweir ::com::sun::star::task::UrlRecord & rRec ) 278cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 279cdf0e10cSrcweir 280cdf0e10cSrcweir ::com::sun::star::task::UrlRecord find( 281cdf0e10cSrcweir const ::rtl::OUString& aURL, 282cdf0e10cSrcweir const ::rtl::OUString& aName, 283cdf0e10cSrcweir bool bName, // only needed to support empty user names 284cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException); 285cdf0e10cSrcweir 286cdf0e10cSrcweir ::rtl::OUString GetDefaultMasterPassword(); 287cdf0e10cSrcweir 288cdf0e10cSrcweir ::rtl::OUString RequestPasswordFromUser( 289cdf0e10cSrcweir ::com::sun::star::task::PasswordRequestMode aRMode, 290cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 291cdf0e10cSrcweir 292cdf0e10cSrcweir ::rtl::OUString GetMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 293cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 294cdf0e10cSrcweir 295cdf0e10cSrcweir void UpdateVector( const ::rtl::OUString& url, ::std::list< NamePassRecord >& toUpdate, NamePassRecord& rec, sal_Bool writeFile ) 296cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 297cdf0e10cSrcweir 298cdf0e10cSrcweir void PrivateAdd( const ::rtl::OUString& aUrl, 299cdf0e10cSrcweir const ::rtl::OUString& aUserName, 300cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, 301cdf0e10cSrcweir char aMode, 302cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 303cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 304cdf0e10cSrcweir 305*154e49a8Scbmarcum /** Decode passwords on a line with the given master password. 306*154e49a8Scbmarcum * 307*154e49a8Scbmarcum * @param aName name for the passwords. It can be a user name, for example. 308*154e49a8Scbmarcum * @param aLine line with passwords to decode. 309*154e49a8Scbmarcum * @param aMasterPassword master password to use. 310*154e49a8Scbmarcum * 311*154e49a8Scbmarcum * The encoding is selected by mOldPasswordEncoding. 312*154e49a8Scbmarcum * 313*154e49a8Scbmarcum * @return the decoded passwords. 314*154e49a8Scbmarcum */ 315*154e49a8Scbmarcum ::std::vector< ::rtl::OUString > DecodePasswords( const ::rtl::OUString& aName, const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPassword ) 316cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 317cdf0e10cSrcweir 318*154e49a8Scbmarcum /** Encode passwords on a line with the given master password. 319*154e49a8Scbmarcum * 320*154e49a8Scbmarcum * @param aName name for the passwords. It can be a user name, for example. 321*154e49a8Scbmarcum * @param lines lines with passwords to decode. 322*154e49a8Scbmarcum * @param aMasterPassword master password to use. 323*154e49a8Scbmarcum * 324*154e49a8Scbmarcum * The encoding is selected by mOldPasswordEncoding. 325*154e49a8Scbmarcum * 326*154e49a8Scbmarcum * @return the decoded passwords. 327*154e49a8Scbmarcum */ 328*154e49a8Scbmarcum ::rtl::OUString EncodePasswords( const ::rtl::OUString& aName, ::std::vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPassword ) 329cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 330*154e49a8Scbmarcum 331*154e49a8Scbmarcum /** Actually change the master password, re-encoding all stored passwords. 332*154e49a8Scbmarcum * 333*154e49a8Scbmarcum * @param apass new password to set. 334*154e49a8Scbmarcum * 335*154e49a8Scbmarcum * Updates m_aMasterPasswd. 336*154e49a8Scbmarcum */ 337*154e49a8Scbmarcum void doChangeMasterPassword(const ::rtl::OUString& aPass); 338cdf0e10cSrcweir public: 339cdf0e10cSrcweir PasswordContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); 340cdf0e10cSrcweir ~PasswordContainer(); 341cdf0e10cSrcweir 342cdf0e10cSrcweir virtual void SAL_CALL add( const ::rtl::OUString& aUrl, 343cdf0e10cSrcweir const ::rtl::OUString& aUserName, 344cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, 345cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 346cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 347cdf0e10cSrcweir 348cdf0e10cSrcweir virtual void SAL_CALL addPersistent( const ::rtl::OUString& aUrl, 349cdf0e10cSrcweir const ::rtl::OUString& aUserName, 350cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, 351cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 352cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 353cdf0e10cSrcweir 354cdf0e10cSrcweir virtual ::com::sun::star::task::UrlRecord SAL_CALL 355cdf0e10cSrcweir find( const ::rtl::OUString& aUrl, 356cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 357cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 358cdf0e10cSrcweir 359cdf0e10cSrcweir virtual ::com::sun::star::task::UrlRecord SAL_CALL 360cdf0e10cSrcweir findForName( const ::rtl::OUString& aUrl, 361cdf0e10cSrcweir const ::rtl::OUString& aUserName, 362cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) 363cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 364cdf0e10cSrcweir 365cdf0e10cSrcweir virtual void SAL_CALL remove( const ::rtl::OUString& aUrl, 366cdf0e10cSrcweir const ::rtl::OUString& aUserName ) 367cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 368cdf0e10cSrcweir 369cdf0e10cSrcweir virtual void SAL_CALL removePersistent( const ::rtl::OUString& aUrl, 370cdf0e10cSrcweir const ::rtl::OUString& aUserName ) 371cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 372cdf0e10cSrcweir 373cdf0e10cSrcweir virtual void SAL_CALL removeAllPersistent() throw(::com::sun::star::uno::RuntimeException); 374cdf0e10cSrcweir 375cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::task::UrlRecord > SAL_CALL 376cdf0e10cSrcweir getAllPersistent( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); 377cdf0e10cSrcweir 378cdf0e10cSrcweir 379cdf0e10cSrcweir // provide factory 380cdf0e10cSrcweir static ::rtl::OUString SAL_CALL impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 381cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 382cdf0e10cSrcweir impl_getStaticSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 383cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL 384cdf0e10cSrcweir impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException); 385cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 386cdf0e10cSrcweir impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException ); 387cdf0e10cSrcweir 388cdf0e10cSrcweir // XServiceInfo 389cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 390cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 391cdf0e10cSrcweir 392cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 393cdf0e10cSrcweir getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 394cdf0e10cSrcweir 395cdf0e10cSrcweir // XEventListener 396cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 397cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 398cdf0e10cSrcweir 399cdf0e10cSrcweir // XMasterPasswordHandling 400cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL authorizateWithMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) 401cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 402cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL changeMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 403cdf0e10cSrcweir virtual void SAL_CALL removeMasterPassword() throw (::com::sun::star::uno::RuntimeException); 404cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasMasterPassword( ) throw (::com::sun::star::uno::RuntimeException); 405cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL allowPersistentStoring( ::sal_Bool bAllow ) throw (::com::sun::star::uno::RuntimeException); 406cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isPersistentStoringAllowed( ) throw (::com::sun::star::uno::RuntimeException); 407cdf0e10cSrcweir 408cdf0e10cSrcweir // XMasterPasswordHandling2 409cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 410cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); 411cdf0e10cSrcweir 412cdf0e10cSrcweir // XUrlContainer 413cdf0e10cSrcweir virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException); 414cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); 415cdf0e10cSrcweir virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); 416cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException); 417cdf0e10cSrcweir 418cdf0e10cSrcweir void Notify(); 419cdf0e10cSrcweir }; 420cdf0e10cSrcweir 421cdf0e10cSrcweir //---------------------------------------------------------------------------------- 422cdf0e10cSrcweir 423cdf0e10cSrcweir class MasterPasswordRequest_Impl : public ucbhelper::InteractionRequest 424cdf0e10cSrcweir { 425cdf0e10cSrcweir ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier; 426cdf0e10cSrcweir 427cdf0e10cSrcweir public: 428cdf0e10cSrcweir MasterPasswordRequest_Impl( ::com::sun::star::task::PasswordRequestMode Mode ); 429cdf0e10cSrcweir 430cdf0e10cSrcweir const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & getAuthenticationSupplier() const431cdf0e10cSrcweir getAuthenticationSupplier() const { return m_xAuthSupplier; } 432cdf0e10cSrcweir 433cdf0e10cSrcweir }; 434cdf0e10cSrcweir 435cdf0e10cSrcweir //---------------------------------------------------------------------------------- 436cdf0e10cSrcweir 437cdf0e10cSrcweir class RW_SvMemoryStream : public SvMemoryStream { 438cdf0e10cSrcweir public: RW_SvMemoryStream(void * Buf,sal_uLong Size,StreamMode eMode)439cdf0e10cSrcweir RW_SvMemoryStream( void* Buf, sal_uLong Size, StreamMode eMode ): 440cdf0e10cSrcweir SvMemoryStream( Buf, Size, eMode){} 441cdf0e10cSrcweir RW_SvMemoryStream(sal_uLong InitSize=512,sal_uLong Resize=64)442cdf0e10cSrcweir RW_SvMemoryStream( sal_uLong InitSize=512, sal_uLong Resize=64 ): 443cdf0e10cSrcweir SvMemoryStream( InitSize, Resize ){} 444cdf0e10cSrcweir getActualSize()445cdf0e10cSrcweir sal_uLong getActualSize(){ return nEndOfData; } 446cdf0e10cSrcweir }; 447cdf0e10cSrcweir 448cdf0e10cSrcweir 449cdf0e10cSrcweir 450cdf0e10cSrcweir #endif // #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX 451cdf0e10cSrcweir 452