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 <unotools/resmgr.hxx>
36 #include <vcl/errcode.hxx>
37 #include <vcl/errinf.hxx>
38 #include <vcl/abstdlg.hxx>
39 #include <vcl/svapp.hxx>
41 #include "authfallbackdlg.hxx"
42 #include <strings.hrc>
43 #include "getcontinuations.hxx"
44 #include "passwordcontainer.hxx"
45 #include "loginerr.hxx"
46 #include "logindlg.hxx"
47 #include "masterpasscrtdlg.hxx"
48 #include "masterpassworddlg.hxx"
49 #include "passworddlg.hxx"
55 using namespace com::sun::star
;
61 weld::Window
* pParent
,
62 LoginErrorInfo
& rInfo
,
63 OUString
const & rRealm
)
65 SolarMutexGuard aGuard
;
67 bool bAccount
= (rInfo
.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT
) != 0;
68 bool bSavePassword
= rInfo
.GetCanRememberPassword();
69 bool bCanUseSysCreds
= rInfo
.GetCanUseSystemCredentials();
71 LoginFlags nFlags
= LoginFlags::NONE
;
72 if (rInfo
.GetErrorText().isEmpty())
73 nFlags
|= LoginFlags::NoErrorText
;
75 nFlags
|= LoginFlags::NoAccount
;
76 if (!(rInfo
.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME
))
77 nFlags
|= LoginFlags::UsernameReadonly
;
80 nFlags
|= LoginFlags::NoSavePassword
;
83 nFlags
|= LoginFlags::NoUseSysCreds
;
85 LoginDialog
aDialog(pParent
, nFlags
, rInfo
.GetServer(), rRealm
);
86 if (!rInfo
.GetErrorText().isEmpty())
87 aDialog
.SetErrorText(rInfo
.GetErrorText());
88 aDialog
.SetName(rInfo
.GetUserName());
90 aDialog
.ClearAccount();
92 aDialog
.ClearPassword();
93 aDialog
.SetPassword(rInfo
.GetPassword());
97 std::locale
aLocale(Translate::Create("uui"));
98 aDialog
.SetSavePasswordText(
99 Translate::get(rInfo
.GetIsRememberPersistent()
104 aDialog
.SetSavePassword(rInfo
.GetIsRememberPassword());
107 if ( bCanUseSysCreds
)
108 aDialog
.SetUseSystemCredentials( rInfo
.GetIsUseSystemCredentials() );
110 rInfo
.SetResult(aDialog
.run() == RET_OK
? DialogMask::ButtonsOk
:
111 DialogMask::ButtonsCancel
);
112 rInfo
.SetUserName(aDialog
.GetName());
113 rInfo
.SetPassword(aDialog
.GetPassword());
114 rInfo
.SetAccount(aDialog
.GetAccount());
115 rInfo
.SetIsRememberPassword(aDialog
.IsSavePassword());
117 if ( bCanUseSysCreds
)
118 rInfo
.SetIsUseSystemCredentials( aDialog
.IsUseSystemCredentials() );
121 void getRememberModes(
122 uno::Sequence
< ucb::RememberAuthentication
> const & rRememberModes
,
123 ucb::RememberAuthentication
& rPreferredMode
,
124 ucb::RememberAuthentication
& rAlternateMode
)
126 sal_Int32 nCount
= rRememberModes
.getLength();
127 OSL_ENSURE( (nCount
> 0) && (nCount
< 4),
128 "ucb::RememberAuthentication sequence size mismatch!" );
131 rPreferredMode
= rAlternateMode
= rRememberModes
[ 0 ];
136 bool bHasRememberModeSession
= false;
137 bool bHasRememberModePersistent
= false;
139 for (sal_Int32 i
= 0; i
< nCount
; ++i
)
141 switch ( rRememberModes
[i
] )
143 case ucb::RememberAuthentication_NO
:
145 case ucb::RememberAuthentication_SESSION
:
146 bHasRememberModeSession
= true;
148 case ucb::RememberAuthentication_PERSISTENT
:
149 bHasRememberModePersistent
= true;
152 SAL_WARN( "uui", "Unsupported RememberAuthentication value" << static_cast<sal_Int32
>(rRememberModes
[i
]) );
157 if (bHasRememberModePersistent
)
159 rPreferredMode
= ucb::RememberAuthentication_PERSISTENT
;
160 if (bHasRememberModeSession
)
161 rAlternateMode
= ucb::RememberAuthentication_SESSION
;
163 rAlternateMode
= ucb::RememberAuthentication_NO
;
167 rPreferredMode
= ucb::RememberAuthentication_SESSION
;
168 rAlternateMode
= ucb::RememberAuthentication_NO
;
174 handleAuthenticationRequest_(
175 weld::Window
* pParent
,
176 uno::Reference
< task::XInteractionHandler2
> const & xIH
,
177 uno::Reference
< uno::XComponentContext
> const & xContext
,
178 ucb::AuthenticationRequest
const & rRequest
,
179 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
181 const OUString
& rURL
)
183 uno::Reference
< task::XInteractionRetry
> xRetry
;
184 uno::Reference
< task::XInteractionAbort
> xAbort
;
185 uno::Reference
< ucb::XInteractionSupplyAuthentication
>
186 xSupplyAuthentication
;
187 uno::Reference
< ucb::XInteractionSupplyAuthentication2
>
188 xSupplyAuthentication2
;
189 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xSupplyAuthentication
);
190 if (xSupplyAuthentication
.is())
191 xSupplyAuthentication2
.set(xSupplyAuthentication
, uno::UNO_QUERY
);
194 // First, try to obtain credentials from password container service.
195 uui::PasswordContainerHelper
aPwContainerHelper(xContext
);
196 if (aPwContainerHelper
.handleAuthenticationRequest(rRequest
,
197 xSupplyAuthentication
,
201 xSupplyAuthentication
->select();
206 // Second, try to obtain credentials from user via password dialog.
207 ucb::RememberAuthentication eDefaultRememberMode
208 = ucb::RememberAuthentication_SESSION
;
209 ucb::RememberAuthentication ePreferredRememberMode
210 = eDefaultRememberMode
;
211 ucb::RememberAuthentication eAlternateRememberMode
212 = ucb::RememberAuthentication_NO
;
214 if (xSupplyAuthentication
.is())
217 xSupplyAuthentication
->getRememberPasswordModes(
218 eDefaultRememberMode
),
219 ePreferredRememberMode
,
220 eAlternateRememberMode
);
223 bool bCanUseSystemCredentials
;
224 sal_Bool bDefaultUseSystemCredentials
;
225 if (xSupplyAuthentication2
.is())
227 bCanUseSystemCredentials
228 = xSupplyAuthentication2
->canUseSystemCredentials(
229 bDefaultUseSystemCredentials
);
233 bCanUseSystemCredentials
= false;
234 bDefaultUseSystemCredentials
= false;
237 LoginErrorInfo aInfo
;
238 aInfo
.SetTitle(rRequest
.ServerName
);
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 aPassList
[0] = aInfo
.GetPassword();
348 if (!aInfo
.GetAccount().isEmpty())
349 aPassList
[1] = aInfo
.GetAccount();
351 if (aInfo
.GetIsRememberPassword())
353 if (!aPwContainerHelper
.addRecord(
354 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
358 ePreferredRememberMode
359 == ucb::RememberAuthentication_PERSISTENT
))
361 xSupplyAuthentication
->setRememberPassword(
362 ucb::RememberAuthentication_NO
);
365 else if (eAlternateRememberMode
366 == ucb::RememberAuthentication_SESSION
)
368 if (!aPwContainerHelper
.addRecord(
369 !rURL
.isEmpty() ? rURL
: rRequest
.ServerName
,
373 false /* SESSION */))
375 xSupplyAuthentication
->setRememberPassword(
376 ucb::RememberAuthentication_NO
);
382 case DialogMask::ButtonsRetry
:
395 executeMasterPasswordDialog(
396 weld::Window
* pParent
,
397 LoginErrorInfo
& rInfo
,
398 task::PasswordRequestMode nMode
)
402 SolarMutexGuard aGuard
;
404 std::locale
aResLocale(Translate::Create("uui"));
405 if( nMode
== task::PasswordRequestMode_PASSWORD_CREATE
)
407 MasterPasswordCreateDialog
aDialog(pParent
, aResLocale
);
408 rInfo
.SetResult(aDialog
.run()
409 == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
410 aMaster
= OUStringToOString(
411 aDialog
.GetMasterPassword(), RTL_TEXTENCODING_UTF8
);
415 MasterPasswordDialog
aDialog(pParent
, nMode
, aResLocale
);
416 rInfo
.SetResult(aDialog
.run()
417 == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
418 aMaster
= OUStringToOString(
419 aDialog
.GetMasterPassword(), RTL_TEXTENCODING_UTF8
);
423 sal_uInt8 aKey
[RTL_DIGEST_LENGTH_MD5
];
424 // FIXME this is subject to the SHA1-bug tdf#114939 - but this
425 // MasterPassword stuff is just stored in the UserInstallation,
426 // so no interop concerns
427 rtl_digest_PBKDF2(aKey
,
428 RTL_DIGEST_LENGTH_MD5
,
429 reinterpret_cast< sal_uInt8
const * >(aMaster
.getStr()),
431 reinterpret_cast< sal_uInt8
const * >(
432 "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
436 OUStringBuffer aBuffer
;
437 for (sal_uInt8 i
: aKey
)
439 aBuffer
.append(static_cast< sal_Unicode
>('a' + (i
>> 4)));
440 aBuffer
.append(static_cast< sal_Unicode
>('a' + (i
& 15)));
442 rInfo
.SetPassword(aBuffer
.makeStringAndClear());
446 handleMasterPasswordRequest_(
447 weld::Window
* pParent
,
448 task::PasswordRequestMode nMode
,
449 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
452 uno::Reference
< task::XInteractionRetry
> xRetry
;
453 uno::Reference
< task::XInteractionAbort
> xAbort
;
454 uno::Reference
< ucb::XInteractionSupplyAuthentication
>
455 xSupplyAuthentication
;
456 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xSupplyAuthentication
);
457 LoginErrorInfo aInfo
;
459 // in case of master password a hash code is returned
460 executeMasterPasswordDialog(pParent
, aInfo
, nMode
);
462 switch (aInfo
.GetResult())
464 case DialogMask::ButtonsOk
:
465 if (xSupplyAuthentication
.is())
467 if (xSupplyAuthentication
->canSetPassword())
468 xSupplyAuthentication
->setPassword(aInfo
.GetPassword());
469 xSupplyAuthentication
->select();
473 case DialogMask::ButtonsRetry
:
486 executePasswordDialog(
487 weld::Window
* pParent
,
488 LoginErrorInfo
& rInfo
,
489 task::PasswordRequestMode nMode
,
490 const OUString
& aDocName
,
492 bool bIsPasswordToModify
,
493 bool bIsSimplePasswordRequest
)
495 SolarMutexGuard aGuard
;
497 std::locale
aResLocale(Translate::Create("uui"));
498 if( nMode
== task::PasswordRequestMode_PASSWORD_CREATE
)
500 if (bIsSimplePasswordRequest
)
502 std::unique_ptr
<PasswordDialog
> xDialog(new PasswordDialog(pParent
, nMode
,
503 aResLocale
, aDocName
, bIsPasswordToModify
, bIsSimplePasswordRequest
));
504 xDialog
->SetMinLen(0);
506 rInfo
.SetResult(xDialog
->run() == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
507 rInfo
.SetPassword(xDialog
->GetPassword());
511 const sal_uInt16 nMaxPasswdLen
= bMSCryptoMode
? 15 : 0; // 0 -> allow any length
513 VclAbstractDialogFactory
* pFact
= VclAbstractDialogFactory::Create();
514 ScopedVclPtr
<AbstractPasswordToOpenModifyDialog
> const pDialog(
515 pFact
->CreatePasswordToOpenModifyDialog(pParent
, nMaxPasswdLen
, bIsPasswordToModify
));
517 rInfo
.SetResult( pDialog
->Execute() == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
518 rInfo
.SetPassword( pDialog
->GetPasswordToOpen() );
519 rInfo
.SetPasswordToModify( pDialog
->GetPasswordToModify() );
520 rInfo
.SetRecommendToOpenReadonly( pDialog
->IsRecommendToOpenReadonly() );
523 else // enter password or reenter password
525 std::unique_ptr
<PasswordDialog
> xDialog(new PasswordDialog(pParent
, nMode
,
526 aResLocale
, aDocName
, bIsPasswordToModify
, bIsSimplePasswordRequest
));
527 xDialog
->SetMinLen(0);
529 rInfo
.SetResult(xDialog
->run() == RET_OK
? DialogMask::ButtonsOk
: DialogMask::ButtonsCancel
);
530 rInfo
.SetPassword(bIsPasswordToModify
? OUString() : xDialog
->GetPassword());
531 rInfo
.SetPasswordToModify(bIsPasswordToModify
? xDialog
->GetPassword() : OUString());
536 handlePasswordRequest_(
537 weld::Window
* pParent
,
538 task::PasswordRequestMode nMode
,
539 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const &
541 const OUString
& aDocumentName
,
543 bool bIsPasswordToModify
,
544 bool bIsSimplePasswordRequest
= false )
546 uno::Reference
< task::XInteractionRetry
> xRetry
;
547 uno::Reference
< task::XInteractionAbort
> xAbort
;
548 uno::Reference
< task::XInteractionPassword
> xPassword
;
549 uno::Reference
< task::XInteractionPassword2
> xPassword2
;
550 getContinuations(rContinuations
, &xRetry
, &xAbort
, &xPassword2
, &xPassword
);
552 if ( xPassword2
.is() && !xPassword
.is() )
553 xPassword
.set( xPassword2
, uno::UNO_QUERY_THROW
);
555 LoginErrorInfo aInfo
;
557 executePasswordDialog( pParent
, aInfo
, nMode
,
558 aDocumentName
, bMSCryptoMode
, bIsPasswordToModify
, bIsSimplePasswordRequest
);
560 switch (aInfo
.GetResult())
562 case DialogMask::ButtonsOk
:
563 OSL_ENSURE( !bIsPasswordToModify
|| xPassword2
.is(), "PasswordToModify is requested, but there is no Interaction!" );
568 xPassword2
->setPasswordToModify( aInfo
.GetPasswordToModify() );
569 xPassword2
->setRecommendReadOnly( aInfo
.IsRecommendToOpenReadonly() );
572 xPassword
->setPassword(aInfo
.GetPassword());
577 case DialogMask::ButtonsRetry
:
592 UUIInteractionHelper::handleAuthenticationRequest(
593 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
595 uno::Any
aAnyRequest(rRequest
->getRequest());
596 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
598 ucb::URLAuthenticationRequest aURLAuthenticationRequest
;
599 if (aAnyRequest
>>= aURLAuthenticationRequest
)
601 handleAuthenticationRequest_(Application::GetFrameWeld(xParent
),
602 getInteractionHandler(),
604 aURLAuthenticationRequest
,
605 rRequest
->getContinuations(),
606 aURLAuthenticationRequest
.URL
);
610 ucb::AuthenticationRequest aAuthenticationRequest
;
611 if (aAnyRequest
>>= aAuthenticationRequest
)
613 handleAuthenticationRequest_(Application::GetFrameWeld(xParent
),
614 getInteractionHandler(),
616 aAuthenticationRequest
,
617 rRequest
->getContinuations(),
625 UUIInteractionHelper::handleMasterPasswordRequest(
626 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
628 uno::Any
aAnyRequest(rRequest
->getRequest());
630 task::MasterPasswordRequest aMasterPasswordRequest
;
631 if (aAnyRequest
>>= aMasterPasswordRequest
)
633 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
635 handleMasterPasswordRequest_(Application::GetFrameWeld(xParent
),
636 aMasterPasswordRequest
.Mode
,
637 rRequest
->getContinuations());
644 UUIInteractionHelper::handlePasswordRequest(
645 uno::Reference
< task::XInteractionRequest
> const & rRequest
)
647 // parameters to be filled for the call to handlePasswordRequest_
648 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
649 task::PasswordRequestMode nMode
= task::PasswordRequestMode_PASSWORD_ENTER
;
650 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const & rContinuations
= rRequest
->getContinuations();
651 OUString aDocumentName
;
652 bool bMSCryptoMode
= false;
653 bool bIsPasswordToModify
= false;
655 bool bDoHandleRequest
= false;
657 uno::Any
aAnyRequest(rRequest
->getRequest());
659 task::DocumentPasswordRequest2 aDocumentPasswordRequest2
;
660 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentPasswordRequest2
))
662 nMode
= aDocumentPasswordRequest2
.Mode
;
663 aDocumentName
= aDocumentPasswordRequest2
.Name
;
664 OSL_ENSURE( !bMSCryptoMode
, "bMSCryptoMode should be false" );
665 bIsPasswordToModify
= aDocumentPasswordRequest2
.IsRequestPasswordToModify
;
667 bDoHandleRequest
= true;
670 task::DocumentPasswordRequest aDocumentPasswordRequest
;
671 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentPasswordRequest
))
673 nMode
= aDocumentPasswordRequest
.Mode
;
674 aDocumentName
= aDocumentPasswordRequest
.Name
;
675 OSL_ENSURE( !bMSCryptoMode
, "bMSCryptoMode should be false" );
676 OSL_ENSURE( !bIsPasswordToModify
, "bIsPasswordToModify should be false" );
678 bDoHandleRequest
= true;
681 task::DocumentMSPasswordRequest2 aDocumentMSPasswordRequest2
;
682 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentMSPasswordRequest2
))
684 nMode
= aDocumentMSPasswordRequest2
.Mode
;
685 aDocumentName
= aDocumentMSPasswordRequest2
.Name
;
686 bMSCryptoMode
= true;
687 bIsPasswordToModify
= aDocumentMSPasswordRequest2
.IsRequestPasswordToModify
;
689 bDoHandleRequest
= true;
692 task::DocumentMSPasswordRequest aDocumentMSPasswordRequest
;
693 if (!bDoHandleRequest
&& (aAnyRequest
>>= aDocumentMSPasswordRequest
))
695 nMode
= aDocumentMSPasswordRequest
.Mode
;
696 aDocumentName
= aDocumentMSPasswordRequest
.Name
;
697 bMSCryptoMode
= true;
698 OSL_ENSURE( !bIsPasswordToModify
, "bIsPasswordToModify should be false" );
700 bDoHandleRequest
= true;
703 if (bDoHandleRequest
)
705 handlePasswordRequest_( Application::GetFrameWeld(xParent
), nMode
, rContinuations
,
706 aDocumentName
, bMSCryptoMode
, bIsPasswordToModify
);
710 task::PasswordRequest aPasswordRequest
;
711 if( aAnyRequest
>>= aPasswordRequest
)
713 handlePasswordRequest_(Application::GetFrameWeld(xParent
),
714 aPasswordRequest
.Mode
,
715 rRequest
->getContinuations(),
717 false /* bool bMSCryptoMode */,
718 false /* bool bIsPasswordToModify */,
719 true /* bool bIsSimplePasswordRequest */ );
727 UUIInteractionHelper::handleAuthFallbackRequest( OUString
& instructions
,
729 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > const & rContinuations
)
731 uno::Reference
<awt::XWindow
> xParent
= getParentXWindow();
732 AuthFallbackDlg
dlg(Application::GetFrameWeld(xParent
), instructions
, url
);
733 int retCode
= dlg
.run();
734 uno::Reference
< task::XInteractionAbort
> xAbort
;
735 uno::Reference
< ucb::XInteractionAuthFallback
> xAuthFallback
;
736 getContinuations(rContinuations
, &xAbort
, &xAuthFallback
);
738 if( retCode
== RET_OK
&& xAuthFallback
.is( ) )
740 xAuthFallback
->setCode(dlg
.GetCode());
741 xAuthFallback
->select( );
747 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */