1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/task/DocumentPasswordRequest.hpp>
21 #include <com/sun/star/task/DocumentPasswordRequest2.hpp>
22 #include <com/sun/star/task/DocumentMSPasswordRequest.hpp>
23 #include <com/sun/star/task/DocumentMSPasswordRequest2.hpp>
24 #include <com/sun/star/task/MasterPasswordRequest.hpp>
25 #include <com/sun/star/task/XInteractionAbort.hpp>
26 #include <com/sun/star/task/XInteractionPassword.hpp>
27 #include <com/sun/star/task/XInteractionPassword2.hpp>
28 #include <com/sun/star/task/XInteractionRetry.hpp>
29 #include <com/sun/star/ucb/XInteractionAuthFallback.hpp>
30 #include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
31 #include <com/sun/star/ucb/URLAuthenticationRequest.hpp>
33 #include <osl/diagnose.h>
34 #include <rtl/digest.h>
35 #include <rtl/ustrbuf.hxx>
36 #include <unotools/resmgr.hxx>
37 #include <vcl/errinf.hxx>
38 #include <vcl/abstdlg.hxx>
39 #include <vcl/svapp.hxx>
40 #include <sal/log.hxx>
42 #include "authfallbackdlg.hxx"
43 #include <strings.hrc>
44 #include "getcontinuations.hxx"
45 #include "passwordcontainer.hxx"
46 #include "loginerr.hxx"
47 #include "logindlg.hxx"
48 #include "masterpasscrtdlg.hxx"
49 #include "masterpassworddlg.hxx"
50 #include "passworddlg.hxx"
56 using namespace com::sun::star
;
62 weld::Window
* pParent
,
63 LoginErrorInfo
& rInfo
,
64 OUString
const & rRealm
)
66 SolarMutexGuard aGuard
;
68 bool bAccount
= (rInfo
.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT
) != 0;
69 bool bSavePassword
= rInfo
.GetCanRememberPassword();
70 bool bCanUseSysCreds
= rInfo
.GetCanUseSystemCredentials();
72 LoginFlags nFlags
= LoginFlags::NONE
;
73 if (rInfo
.GetErrorText().isEmpty())
74 nFlags
|= LoginFlags::NoErrorText
;
76 nFlags
|= LoginFlags::NoAccount
;
77 if (!(rInfo
.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME
))
78 nFlags
|= LoginFlags::UsernameReadonly
;
81 nFlags
|= LoginFlags::NoSavePassword
;
84 nFlags
|= LoginFlags::NoUseSysCreds
;
86 LoginDialog
aDialog(pParent
, nFlags
, rInfo
.GetServer(), rRealm
);
87 if (!rInfo
.GetErrorText().isEmpty())
88 aDialog
.SetErrorText(rInfo
.GetErrorText());
89 aDialog
.SetName(rInfo
.GetUserName());
91 aDialog
.ClearAccount();
93 aDialog
.ClearPassword();
94 aDialog
.SetPassword(rInfo
.GetPassword());
98 std::locale
aLocale(Translate::Create("uui"));
99 aDialog
.SetSavePasswordText(
100 Translate::get(rInfo
.GetIsRememberPersistent()
105 aDialog
.SetSavePassword(rInfo
.GetIsRememberPassword());
108 if ( bCanUseSysCreds
)
109 aDialog
.SetUseSystemCredentials( rInfo
.GetIsUseSystemCredentials() );
111 rInfo
.SetResult(aDialog
.run() == RET_OK
? DialogMask::ButtonsOk
:
112 DialogMask::ButtonsCancel
);
113 rInfo
.SetUserName(aDialog
.GetName());
114 rInfo
.SetPassword(aDialog
.GetPassword());
115 rInfo
.SetAccount(aDialog
.GetAccount());
116 rInfo
.SetIsRememberPassword(aDialog
.IsSavePassword());
118 if ( bCanUseSysCreds
)
119 rInfo
.SetIsUseSystemCredentials( aDialog
.IsUseSystemCredentials() );
122 void getRememberModes(
123 uno::Sequence
< ucb::RememberAuthentication
> const & rRememberModes
,
124 ucb::RememberAuthentication
& rPreferredMode
,
125 ucb::RememberAuthentication
& rAlternateMode
)
127 sal_Int32 nCount
= rRememberModes
.getLength();
128 OSL_ENSURE( (nCount
> 0) && (nCount
< 4),
129 "ucb::RememberAuthentication sequence size mismatch!" );
132 rPreferredMode
= rAlternateMode
= rRememberModes
[ 0 ];
137 bool bHasRememberModeSession
= false;
138 bool bHasRememberModePersistent
= false;
140 for (const auto& rRememberMode
: rRememberModes
)
142 switch ( rRememberMode
)
144 case ucb::RememberAuthentication_NO
:
146 case ucb::RememberAuthentication_SESSION
:
147 bHasRememberModeSession
= true;
149 case ucb::RememberAuthentication_PERSISTENT
:
150 bHasRememberModePersistent
= true;
153 SAL_WARN( "uui", "Unsupported RememberAuthentication value" << static_cast<sal_Int32
>(rRememberMode
) );
158 if (bHasRememberModePersistent
)
160 rPreferredMode
= ucb::RememberAuthentication_PERSISTENT
;
161 if (bHasRememberModeSession
)
162 rAlternateMode
= ucb::RememberAuthentication_SESSION
;
164 rAlternateMode
= ucb::RememberAuthentication_NO
;
168 rPreferredMode
= ucb::RememberAuthentication_SESSION
;
169 rAlternateMode
= ucb::RememberAuthentication_NO
;
175 handleAuthenticationRequest_(
176 weld::Window
* pParent
,
177 uno::Reference
< task::XInteractionHandler2
> const & xIH
,
178 uno::Reference
< uno::XComponentContext
> const & xContext
,
179 ucb::AuthenticationRequest
const & rRequest
,
180 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
182 const OUString
& rURL
)
184 uno::Reference
< task::XInteractionRetry
> xRetry
;
185 uno::Reference
< task::XInteractionAbort
> xAbort
;
186 uno::Reference
< ucb::XInteractionSupplyAuthentication
>
187 xSupplyAuthentication
;
188 uno::Reference
< ucb::XInteractionSupplyAuthentication2
>
189 xSupplyAuthentication2
;
190 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xSupplyAuthentication
);
191 if (xSupplyAuthentication
.is())
192 xSupplyAuthentication2
.set(xSupplyAuthentication
, uno::UNO_QUERY
);
195 // First, try to obtain credentials from password container service.
196 uui::PasswordContainerHelper
aPwContainerHelper(xContext
);
197 if (aPwContainerHelper
.handleAuthenticationRequest(rRequest
,
198 xSupplyAuthentication
,
202 xSupplyAuthentication
->select();
207 // Second, try to obtain credentials from user via password dialog.
208 ucb::RememberAuthentication eDefaultRememberMode
209 = ucb::RememberAuthentication_SESSION
;
210 ucb::RememberAuthentication ePreferredRememberMode
211 = eDefaultRememberMode
;
212 ucb::RememberAuthentication eAlternateRememberMode
213 = ucb::RememberAuthentication_NO
;
215 if (xSupplyAuthentication
.is())
218 xSupplyAuthentication
->getRememberPasswordModes(
219 eDefaultRememberMode
),
220 ePreferredRememberMode
,
221 eAlternateRememberMode
);
224 bool bCanUseSystemCredentials
;
225 sal_Bool bDefaultUseSystemCredentials
;
226 if (xSupplyAuthentication2
.is())
228 bCanUseSystemCredentials
229 = xSupplyAuthentication2
->canUseSystemCredentials(
230 bDefaultUseSystemCredentials
);
234 bCanUseSystemCredentials
= false;
235 bDefaultUseSystemCredentials
= false;
238 LoginErrorInfo aInfo
;
239 aInfo
.SetServer(rRequest
.ServerName
);
240 if (rRequest
.HasAccount
)
241 aInfo
.SetAccount(rRequest
.Account
);
242 if (rRequest
.HasUserName
)
243 aInfo
.SetUserName(rRequest
.UserName
);
244 if (rRequest
.HasPassword
)
245 aInfo
.SetPassword(rRequest
.Password
);
246 aInfo
.SetErrorText(rRequest
.Diagnostic
);
248 aInfo
.SetCanRememberPassword(
249 ePreferredRememberMode
!= eAlternateRememberMode
);
250 aInfo
.SetIsRememberPassword(
251 ePreferredRememberMode
== eDefaultRememberMode
);
252 aInfo
.SetIsRememberPersistent(
253 ePreferredRememberMode
== ucb::RememberAuthentication_PERSISTENT
);
255 aInfo
.SetCanUseSystemCredentials(bCanUseSystemCredentials
);
256 aInfo
.SetIsUseSystemCredentials( bDefaultUseSystemCredentials
);
257 aInfo
.SetModifyAccount(rRequest
.HasAccount
258 && xSupplyAuthentication
.is()
259 && xSupplyAuthentication
->canSetAccount());
260 aInfo
.SetModifyUserName(rRequest
.HasUserName
261 && xSupplyAuthentication
.is()
262 && xSupplyAuthentication
->canSetUserName());
263 executeLoginDialog(pParent
,
265 rRequest
.HasRealm
? rRequest
.Realm
: OUString());
266 switch (aInfo
.GetResult())
268 case DialogMask::ButtonsOk
:
269 if (xSupplyAuthentication
.is())
271 if (xSupplyAuthentication
->canSetUserName())
272 xSupplyAuthentication
->setUserName(aInfo
.GetUserName());
273 if (xSupplyAuthentication
->canSetPassword())
274 xSupplyAuthentication
->setPassword(aInfo
.GetPassword());
276 if (ePreferredRememberMode
!= eAlternateRememberMode
)
278 // user had the choice.
279 if (aInfo
.GetIsRememberPassword())
280 xSupplyAuthentication
->setRememberPassword(
281 ePreferredRememberMode
);
283 xSupplyAuthentication
->setRememberPassword(
284 eAlternateRememberMode
);
288 // user had no choice.
289 xSupplyAuthentication
->setRememberPassword(
290 ePreferredRememberMode
);
293 if (rRequest
.HasRealm
)
295 if (xSupplyAuthentication
->canSetRealm())
296 xSupplyAuthentication
->setRealm(aInfo
.GetAccount());
298 else if (xSupplyAuthentication
->canSetAccount())
299 xSupplyAuthentication
->setAccount(aInfo
.GetAccount());
301 if ( xSupplyAuthentication2
.is() && bCanUseSystemCredentials
)
302 xSupplyAuthentication2
->setUseSystemCredentials(
303 aInfo
.GetIsUseSystemCredentials() );
305 xSupplyAuthentication
->select();
309 // Third, store credentials in password container.
311 if ( aInfo
.GetIsUseSystemCredentials() )
313 if (aInfo
.GetIsRememberPassword())
315 if (!aPwContainerHelper
.addRecord(
316 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
317 OUString(), // empty u/p -> sys creds
318 uno::Sequence
< OUString
>(),
320 ePreferredRememberMode
321 == ucb::RememberAuthentication_PERSISTENT
))
323 xSupplyAuthentication
->setRememberPassword(
324 ucb::RememberAuthentication_NO
);
327 else if (eAlternateRememberMode
328 == ucb::RememberAuthentication_SESSION
)
330 if (!aPwContainerHelper
.addRecord(
331 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
332 OUString(), // empty u/p -> sys creds
333 uno::Sequence
< OUString
>(),
335 false /* SESSION */))
337 xSupplyAuthentication
->setRememberPassword(
338 ucb::RememberAuthentication_NO
);
342 // Empty user name can not be valid:
343 else if (!aInfo
.GetUserName().isEmpty())
345 uno::Sequence
< OUString
>
346 aPassList(aInfo
.GetAccount().isEmpty() ? 1 : 2);
347 auto pPassList
= aPassList
.getArray();
348 pPassList
[0] = aInfo
.GetPassword();
349 if (!aInfo
.GetAccount().isEmpty())
350 pPassList
[1] = aInfo
.GetAccount();
352 if (aInfo
.GetIsRememberPassword())
354 if (!aPwContainerHelper
.addRecord(
355 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
359 ePreferredRememberMode
360 == ucb::RememberAuthentication_PERSISTENT
))
362 xSupplyAuthentication
->setRememberPassword(
363 ucb::RememberAuthentication_NO
);
366 else if (eAlternateRememberMode
367 == ucb::RememberAuthentication_SESSION
)
369 if (!aPwContainerHelper
.addRecord(
370 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
374 false /* SESSION */))
376 xSupplyAuthentication
->setRememberPassword(
377 ucb::RememberAuthentication_NO
);
383 case DialogMask::ButtonsRetry
:
396 executeMasterPasswordDialog(
397 weld::Window
* pParent
,
398 LoginErrorInfo
& rInfo
,
399 task::PasswordRequestMode nMode
)
403 SolarMutexGuard aGuard
;
405 std::locale
aResLocale(Translate::Create("uui"));
406 if( nMode
== task::PasswordRequestMode_PASSWORD_CREATE
)
408 MasterPasswordCreateDialog
aDialog(pParent
, aResLocale
);
409 rInfo
.SetResult(aDialog
.run()
410 == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
411 aMaster
= OUStringToOString(
412 aDialog
.GetMasterPassword(), RTL_TEXTENCODING_UTF8
);
416 MasterPasswordDialog
aDialog(pParent
, nMode
, aResLocale
);
417 rInfo
.SetResult(aDialog
.run()
418 == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
419 aMaster
= OUStringToOString(
420 aDialog
.GetMasterPassword(), RTL_TEXTENCODING_UTF8
);
424 sal_uInt8 aKey
[RTL_DIGEST_LENGTH_MD5
];
425 // FIXME this is subject to the SHA1-bug tdf#114939 - but this
426 // MasterPassword stuff is just stored in the UserInstallation,
427 // so no interop concerns
428 rtl_digest_PBKDF2(aKey
,
429 RTL_DIGEST_LENGTH_MD5
,
430 reinterpret_cast< sal_uInt8
const * >(aMaster
.getStr()),
432 reinterpret_cast< sal_uInt8
const * >(
433 "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
437 OUStringBuffer aBuffer
;
438 for (sal_uInt8 i
: aKey
)
440 // match PasswordContainer::DecodePasswords aMasterPasswd.copy(index * 2, 2).toUInt32(16));
441 aBuffer
.append(OUString::number(i
>> 4, 16) + OUString::number(i
& 15, 16));
443 rInfo
.SetPassword(aBuffer
.makeStringAndClear());
447 handleMasterPasswordRequest_(
448 weld::Window
* pParent
,
449 task::PasswordRequestMode nMode
,
450 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
453 uno::Reference
< task::XInteractionRetry
> xRetry
;
454 uno::Reference
< task::XInteractionAbort
> xAbort
;
455 uno::Reference
< ucb::XInteractionSupplyAuthentication
>
456 xSupplyAuthentication
;
457 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xSupplyAuthentication
);
458 LoginErrorInfo aInfo
;
460 // in case of master password a hash code is returned
461 executeMasterPasswordDialog(pParent
, aInfo
, nMode
);
463 switch (aInfo
.GetResult())
465 case DialogMask::ButtonsOk
:
466 if (xSupplyAuthentication
.is())
468 if (xSupplyAuthentication
->canSetPassword())
469 xSupplyAuthentication
->setPassword(aInfo
.GetPassword());
470 xSupplyAuthentication
->select();
474 case DialogMask::ButtonsRetry
:
487 executePasswordDialog(
488 weld::Window
* pParent
,
489 LoginErrorInfo
& rInfo
,
490 task::PasswordRequestMode nMode
,
491 const OUString
& aDocName
,
492 sal_uInt16 nMaxPasswordLen
,
493 bool bIsPasswordToModify
,
494 bool bIsSimplePasswordRequest
)
496 SolarMutexGuard aGuard
;
498 std::locale
aResLocale(Translate::Create("uui"));
499 if( nMode
== task::PasswordRequestMode_PASSWORD_CREATE
)
501 if (bIsSimplePasswordRequest
)
503 std::unique_ptr
<PasswordDialog
> xDialog(new PasswordDialog(pParent
, nMode
,
504 aResLocale
, aDocName
, bIsPasswordToModify
, bIsSimplePasswordRequest
));
505 xDialog
->SetMinLen(0);
507 rInfo
.SetResult(xDialog
->run() == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
508 rInfo
.SetPassword(xDialog
->GetPassword());
512 VclAbstractDialogFactory
* pFact
= VclAbstractDialogFactory::Create();
513 ScopedVclPtr
<AbstractPasswordToOpenModifyDialog
> const pDialog(
514 pFact
->CreatePasswordToOpenModifyDialog(pParent
, nMaxPasswordLen
, bIsPasswordToModify
));
516 rInfo
.SetResult( pDialog
->Execute() == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
517 rInfo
.SetPassword( pDialog
->GetPasswordToOpen() );
518 rInfo
.SetPasswordToModify( pDialog
->GetPasswordToModify() );
519 rInfo
.SetRecommendToOpenReadonly( pDialog
->IsRecommendToOpenReadonly() );
522 else // enter password or reenter password
524 std::unique_ptr
<PasswordDialog
> xDialog(new PasswordDialog(pParent
, nMode
,
525 aResLocale
, aDocName
, bIsPasswordToModify
, bIsSimplePasswordRequest
));
526 xDialog
->SetMinLen(0);
528 rInfo
.SetResult(xDialog
->run() == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
529 rInfo
.SetPassword(bIsPasswordToModify
? OUString() : xDialog
->GetPassword());
530 rInfo
.SetPasswordToModify(bIsPasswordToModify
? xDialog
->GetPassword() : OUString());
535 handlePasswordRequest_(
536 weld::Window
* pParent
,
537 task::PasswordRequestMode nMode
,
538 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
540 const OUString
& aDocumentName
,
541 sal_uInt16 nMaxPasswordLen
,
542 bool bIsPasswordToModify
,
543 bool bIsSimplePasswordRequest
= false )
545 uno::Reference
< task::XInteractionRetry
> xRetry
;
546 uno::Reference
< task::XInteractionAbort
> xAbort
;
547 uno::Reference
< task::XInteractionPassword
> xPassword
;
548 uno::Reference
< task::XInteractionPassword2
> xPassword2
;
549 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xPassword2
, &xPassword
);
551 if ( xPassword2
.is() && !xPassword
.is() )
552 xPassword
.set( xPassword2
, uno::UNO_QUERY_THROW
);
554 LoginErrorInfo aInfo
;
556 executePasswordDialog( pParent
, aInfo
, nMode
,
557 aDocumentName
, nMaxPasswordLen
, bIsPasswordToModify
, bIsSimplePasswordRequest
);
559 switch (aInfo
.GetResult())
561 case DialogMask::ButtonsOk
:
562 OSL_ENSURE( !bIsPasswordToModify
|| xPassword2
.is(), "PasswordToModify is requested, but there is no Interaction!" );
567 xPassword2
->setPasswordToModify( aInfo
.GetPasswordToModify() );
568 xPassword2
->setRecommendReadOnly( aInfo
.IsRecommendToOpenReadonly() );
571 xPassword
->setPassword(aInfo
.GetPassword());
576 case DialogMask::ButtonsRetry
:
591 UUIInteractionHelper::handleAuthenticationRequest(
592 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
594 uno::Any
aAnyRequest(rRequest
->getRequest());
595 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
597 ucb::URLAuthenticationRequest aURLAuthenticationRequest
;
598 if (aAnyRequest
>>= aURLAuthenticationRequest
)
600 handleAuthenticationRequest_(Application::GetFrameWeld(xParent
),
601 getInteractionHandler(),
603 aURLAuthenticationRequest
,
604 rRequest
->getContinuations(),
605 aURLAuthenticationRequest
.URL
);
609 ucb::AuthenticationRequest aAuthenticationRequest
;
610 if (aAnyRequest
>>= aAuthenticationRequest
)
612 handleAuthenticationRequest_(Application::GetFrameWeld(xParent
),
613 getInteractionHandler(),
615 aAuthenticationRequest
,
616 rRequest
->getContinuations(),
624 UUIInteractionHelper::handleMasterPasswordRequest(
625 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
627 uno::Any
aAnyRequest(rRequest
->getRequest());
629 task::MasterPasswordRequest aMasterPasswordRequest
;
630 if (aAnyRequest
>>= aMasterPasswordRequest
)
632 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
634 handleMasterPasswordRequest_(Application::GetFrameWeld(xParent
),
635 aMasterPasswordRequest
.Mode
,
636 rRequest
->getContinuations());
643 UUIInteractionHelper::handlePasswordRequest(
644 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
646 // parameters to be filled for the call to handlePasswordRequest_
647 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
648 task::PasswordRequestMode nMode
= task::PasswordRequestMode_PASSWORD_ENTER
;
649 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const & rContinuations
= rRequest
->getContinuations();
650 OUString aDocumentName
;
651 sal_uInt16 nMaxPasswordLen
= 0; // any length
652 bool bIsPasswordToModify
= false;
654 bool bDoHandleRequest
= false;
656 uno::Any
aAnyRequest(rRequest
->getRequest());
660 task::DocumentPasswordRequest2 aDocumentPasswordRequest2
;
661 if (aAnyRequest
>>= aDocumentPasswordRequest2
)
663 nMode
= aDocumentPasswordRequest2
.Mode
;
664 aDocumentName
= aDocumentPasswordRequest2
.Name
;
665 bIsPasswordToModify
= aDocumentPasswordRequest2
.IsRequestPasswordToModify
;
667 bDoHandleRequest
= true;
671 task::DocumentPasswordRequest aDocumentPasswordRequest
;
672 if (aAnyRequest
>>= aDocumentPasswordRequest
)
674 nMode
= aDocumentPasswordRequest
.Mode
;
675 aDocumentName
= aDocumentPasswordRequest
.Name
;
677 bDoHandleRequest
= true;
681 task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2
;
682 if (aAnyRequest
>>= aDocumentMSPasswordRequest2
)
684 nMode
= aDocumentMSPasswordRequest2
.Mode
;
685 aDocumentName
= aDocumentMSPasswordRequest2
.Name
;
686 nMaxPasswordLen
= 15;
687 bIsPasswordToModify
= aDocumentMSPasswordRequest2
.IsRequestPasswordToModify
;
689 bDoHandleRequest
= true;
693 task::DocumentMSPasswordRequest aDocumentMSPasswordRequest
;
694 if (aAnyRequest
>>= aDocumentMSPasswordRequest
)
696 nMode
= aDocumentMSPasswordRequest
.Mode
;
697 aDocumentName
= aDocumentMSPasswordRequest
.Name
;
698 nMaxPasswordLen
= 15;
700 bDoHandleRequest
= true;
706 if (bDoHandleRequest
)
708 handlePasswordRequest_( Application::GetFrameWeld(xParent
), nMode
, rContinuations
,
709 aDocumentName
, nMaxPasswordLen
, bIsPasswordToModify
);
713 task::PasswordRequest aPasswordRequest
;
714 if( aAnyRequest
>>= aPasswordRequest
)
716 handlePasswordRequest_(Application::GetFrameWeld(xParent
),
717 aPasswordRequest
.Mode
,
718 rRequest
->getContinuations(),
720 0 /* sal_uInt16 nMaxPasswordLen */,
721 false /* bool bIsPasswordToModify */,
722 true /* bool bIsSimplePasswordRequest */ );
730 UUIInteractionHelper::handleAuthFallbackRequest( const OUString
& instructions
,
731 const OUString
& url
,
732 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const & rContinuations
)
734 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
735 AuthFallbackDlg
dlg(Application::GetFrameWeld(xParent
), instructions
, url
);
736 int retCode
= dlg
.run();
737 uno::Reference
< task::XInteractionAbort
> xAbort
;
738 uno::Reference
< ucb::XInteractionAuthFallback
> xAuthFallback
;
739 getContinuations(rContinuations
, &xAbort
, &xAuthFallback
);
741 if( retCode
== RET_OK
&& xAuthFallback
.is( ) )
743 xAuthFallback
->setCode(dlg
.GetCode());
744 xAuthFallback
->select( );
748 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */