19#ifndef INCLUDED_SVL_SOURCE_PASSWORDCONTAINER_PASSWORDCONTAINER_HXX
20#define INCLUDED_SVL_SOURCE_PASSWORDCONTAINER_PASSWORDCONTAINER_HXX
27#include <com/sun/star/task/XPasswordContainer2.hpp>
28#include <com/sun/star/task/PasswordRequestMode.hpp>
29#include <com/sun/star/lang/XServiceInfo.hpp>
30#include <com/sun/star/lang/XEventListener.hpp>
31#include <com/sun/star/lang/XComponent.hpp>
32#include <com/sun/star/uno/XComponentContext.hpp>
38#include <rtl/random.h>
40#include <osl/mutex.hxx>
44#define MEMORY_RECORD 0
45#define PERSISTENT_RECORD 1
61 void InitArrays(
bool bHasMemoryList, ::std::vector< OUString >&& aMemoryList,
62 bool bHasPersistentList,
const OUString& aPersistentList,
const OUString& aPersistentIV )
69 if ( bHasPersistentList )
105 if (
this != &aRecord)
138 return ::std::vector< OUString >();
188typedef ::std::pair< const OUString, ::std::vector< NamePasswordRecord > >
PairUrlRecord;
189typedef ::std::map< OUString, ::std::vector< NamePasswordRecord > >
PasswordMap;
215 css::uno::Sequence< OUString > aNode { path +
"/Store" };
221 void remove(
const OUString& url,
const OUString& rec );
231 virtual void Notify(
const css::uno::Sequence< OUString >& aPropertyNames )
override;
236 css::task::XPasswordContainer2,
237 css::lang::XServiceInfo,
238 css::lang::XEventListener >
273 const ::std::vector< NamePasswordRecord >& original,
274 const css::uno::Reference< css::task::XInteractionHandler >& Handler );
278 bool& io_bTryToDecode,
279 const css::uno::Reference< css::task::XInteractionHandler >& aHandler );
282 css::uno::Sequence< css::task::UserRecord >
FindUsr(
283 const ::std::vector< NamePasswordRecord >& userlist,
284 std::u16string_view name,
285 const css::uno::Reference< css::task::XInteractionHandler >& Handler );
288 const PasswordMap::iterator & rIter,
290 std::u16string_view aName,
291 const css::uno::Reference< css::task::XInteractionHandler >& aHandler,
292 css::task::UrlRecord & rRec );
296 const OUString& aURL,
297 std::u16string_view aName,
299 const css::uno::Reference< css::task::XInteractionHandler >& aHandler );
304 css::task::PasswordRequestMode aRMode,
305 const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
308 OUString
const &
GetMasterPassword(
const css::uno::Reference< css::task::XInteractionHandler >& Handler );
315 const OUString& aUserName,
316 const css::uno::Sequence< OUString >& aPasswords,
318 const css::uno::Reference< css::task::XInteractionHandler >& Handler );
321 static ::std::vector< OUString >
DecodePasswords( std::u16string_view aLine, std::u16string_view aIV, std::u16string_view aMasterPassword, css::task::PasswordRequestMode mode );
324 static OUString
EncodePasswords(
const std::vector< OUString >& lines, std::u16string_view aIV, std::u16string_view aMasterPassword );
330 virtual void SAL_CALL
add(
const OUString& aUrl,
331 const OUString& aUserName,
332 const css::uno::Sequence< OUString >& aPasswords,
333 const css::uno::Reference< css::task::XInteractionHandler >& Handler )
override;
336 const OUString& aUserName,
337 const css::uno::Sequence< OUString >& aPasswords,
338 const css::uno::Reference< css::task::XInteractionHandler >& Handler )
override;
340 virtual css::task::UrlRecord SAL_CALL
342 const css::uno::Reference< css::task::XInteractionHandler >& Handler )
override;
344 virtual css::task::UrlRecord SAL_CALL
346 const OUString& aUserName,
347 const css::uno::Reference< css::task::XInteractionHandler >& Handler )
override;
349 virtual void SAL_CALL
remove(
const OUString& aUrl,
350 const OUString& aUserName )
override;
353 const OUString& aUserName )
override;
357 virtual css::uno::Sequence< css::task::UrlRecord > SAL_CALL
358 getAllPersistent(
const css::uno::Reference< css::task::XInteractionHandler >& Handler )
override;
364 virtual css::uno::Sequence< OUString > SAL_CALL
368 virtual void SAL_CALL
disposing(
const css::lang::EventObject& Source )
override;
383 virtual void SAL_CALL
addUrl(
const OUString& Url,
sal_Bool MakePersistent )
override;
384 virtual OUString SAL_CALL
findUrl(
const OUString& Url )
override;
385 virtual void SAL_CALL
removeUrl(
const OUString& Url )
override;
386 virtual css::uno::Sequence< OUString > SAL_CALL
getUrls(
sal_Bool OnlyPersistent )
override;
402 const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > &
const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & getAuthenticationSupplier() const
MasterPasswordRequest_Impl(css::task::PasswordRequestMode Mode)
::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier
::std::vector< OUString > GetMemoryPasswords() const
bool HasPasswords(sal_Int8 nStatus) const
void InitArrays(bool bHasMemoryList, ::std::vector< OUString > &&aMemoryList, bool bHasPersistentList, const OUString &aPersistentList, const OUString &aPersistentIV)
void RemovePasswords(sal_Int8 nStatus)
OUString GetPersistentPasswords() const
bool m_bHasPersistentPassword
::std::vector< OUString > m_aMemoryPasswords
NamePasswordRecord(OUString aName, OUString aPersistentList, OUString aPersistentIV)
NamePasswordRecord & operator=(const NamePasswordRecord &aRecord)
NamePasswordRecord(OUString aName)
OUString m_aPersistentPassword
void SetMemoryPasswords(::std::vector< OUString > &&aMemList)
bool m_bHasMemoryPasswords
void SetPersistentPasswords(const OUString &aPersList, const OUString &aPersIV)
OUString GetPersistentIV() const
const OUString & GetUserName() const
NamePasswordRecord(const NamePasswordRecord &aRecord)
rtlRandomPool m_aRandomPool
SysCredentialsConfig mUrlContainer
css::uno::Sequence< css::task::UserRecord > CopyToUserRecordSequence(const ::std::vector< NamePasswordRecord > &original, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void PrivateAdd(const OUString &aUrl, const OUString &aUserName, const css::uno::Sequence< OUString > &aPasswords, char aMode, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
static OUString GetDefaultMasterPassword()
static OUString RequestPasswordFromUser(css::task::PasswordRequestMode aRMode, const css::uno::Reference< css::task::XInteractionHandler > &xHandler)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void UpdateVector(const OUString &url, ::std::vector< NamePasswordRecord > &toUpdate, NamePasswordRecord const &rec, bool writeFile)
std::optional< StorageItem > m_xStorageFile
bool createUrlRecord(const PasswordMap::iterator &rIter, bool bName, std::u16string_view aName, const css::uno::Reference< css::task::XInteractionHandler > &aHandler, css::task::UrlRecord &rRec)
virtual void SAL_CALL removeUrl(const OUString &Url) override
virtual void SAL_CALL removeMasterPassword() override
virtual sal_Bool SAL_CALL useDefaultMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler) override
virtual css::uno::Sequence< OUString > SAL_CALL getUrls(sal_Bool OnlyPersistent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::lang::XComponent > mComponent
static ::std::vector< OUString > DecodePasswords(std::u16string_view aLine, std::u16string_view aIV, std::u16string_view aMasterPassword, css::task::PasswordRequestMode mode)
virtual sal_Bool SAL_CALL isDefaultMasterPasswordUsed() override
virtual css::task::UrlRecord SAL_CALL find(const OUString &aUrl, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual OUString SAL_CALL findUrl(const OUString &Url) override
virtual void SAL_CALL removePersistent(const OUString &aUrl, const OUString &aUserName) override
virtual void SAL_CALL remove(const OUString &aUrl, const OUString &aUserName) override
PasswordContainer(const css::uno::Reference< css::uno::XComponentContext > &)
virtual sal_Bool SAL_CALL changeMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler) override
OUString m_aMasterPassword
css::task::UserRecord CopyToUserRecord(const NamePasswordRecord &aRecord, bool &io_bTryToDecode, const css::uno::Reference< css::task::XInteractionHandler > &aHandler)
virtual void SAL_CALL removeAllPersistent() override
virtual void SAL_CALL addPersistent(const OUString &aUrl, const OUString &aUserName, const css::uno::Sequence< OUString > &aPasswords, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual ~PasswordContainer() override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL addUrl(const OUString &Url, sal_Bool MakePersistent) override
css::task::UrlRecord find(const OUString &aURL, std::u16string_view aName, bool bName, const css::uno::Reference< css::task::XInteractionHandler > &aHandler)
virtual sal_Bool SAL_CALL isPersistentStoringAllowed() override
OUString const & GetMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &Handler)
static OUString EncodePasswords(const std::vector< OUString > &lines, std::u16string_view aIV, std::u16string_view aMasterPassword)
virtual void SAL_CALL add(const OUString &aUrl, const OUString &aUserName, const css::uno::Sequence< OUString > &aPasswords, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual sal_Bool SAL_CALL allowPersistentStoring(sal_Bool bAllow) override
virtual sal_Bool SAL_CALL hasMasterPassword() override
css::uno::Sequence< css::task::UserRecord > FindUsr(const ::std::vector< NamePasswordRecord > &userlist, std::u16string_view name, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
virtual sal_Bool SAL_CALL authorizateWithMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler) override
virtual css::uno::Sequence< css::task::UrlRecord > SAL_CALL getAllPersistent(const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual css::task::UrlRecord SAL_CALL findForName(const OUString &aUrl, const OUString &aUserName, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
void setEncodedMasterPassword(const OUString &aResult, const OUString &aResultIV, bool bAcceptEmpty=false)
void remove(const OUString &url, const OUString &rec)
bool getEncodedMasterPassword(OUString &aResult, OUString &aResultIV)
void update(const OUString &url, const NamePasswordRecord &rec)
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual void ImplCommit() override
PasswordContainer * mainCont
void setUseStorage(bool bUse)
StorageItem(PasswordContainer *point, const OUString &path)
sal_Int32 getStorageVersion()
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
ConfigItem(ConfigItem const &)=default
constexpr sal_Int32 nCurrentStorageVersion
::std::pair< const OUString, ::std::vector< NamePasswordRecord > > PairUrlRecord
#define PERSISTENT_RECORD
::std::map< OUString, ::std::vector< NamePasswordRecord > > PasswordMap