summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-11 19:09:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-11 19:09:24 +0200
commit8963c350986fc57cb0cf98387d7bd1c7bf6420a1 (patch)
tree6fc8a0b83e9406bfaac91a0026466a94d28e8624 /uui
parent77897f5994bd18c3b771e51abce5ee6be01322fc (diff)
Improvement on previous commit
Change-Id: I10984b6ac4128ad46f512dade0f4e0084d0b9348
Diffstat (limited to 'uui')
-rw-r--r--uui/source/passwordcontainer.cxx60
-rw-r--r--uui/source/passwordcontainer.hxx4
2 files changed, 15 insertions, 49 deletions
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
index bf54620cf342..546d795bded4 100644
--- a/uui/source/passwordcontainer.cxx
+++ b/uui/source/passwordcontainer.cxx
@@ -21,12 +21,9 @@
#include "cppuhelper/factory.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-#include "com/sun/star/task/PasswordContainer.hpp"
#include "com/sun/star/task/NoMasterException.hpp"
+#include "com/sun/star/task/PasswordContainer.hpp"
#include "com/sun/star/task/XInteractionHandler.hpp"
-#include "com/sun/star/task/XMasterPasswordHandling.hpp"
-#include "com/sun/star/task/XPasswordContainer.hpp"
-#include "com/sun/star/task/XUrlContainer.hpp"
#include "com/sun/star/ucb/AuthenticationRequest.hpp"
#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
@@ -113,22 +110,9 @@ namespace uui {
//=========================================================================
PasswordContainerHelper::PasswordContainerHelper(
- uno::Reference< uno::XComponentContext > const & xContext )
-{
- OSL_ENSURE(xContext.is(), "no service factory given!");
- if (xContext.is())
- try
- {
- m_xPasswordContainer
- = uno::Reference< task::XPasswordContainer >(
- task::PasswordContainer::create(xContext),
- uno::UNO_QUERY);
- }
- catch (uno::Exception const &)
- {}
- OSL_ENSURE(m_xPasswordContainer.is(),
- "unable to instanciate password container service");
-}
+ uno::Reference< uno::XComponentContext > const & xContext ):
+ m_xPasswordContainer(task::PasswordContainer::create(xContext))
+{}
//=========================================================================
bool PasswordContainerHelper::handleAuthenticationRequest(
@@ -153,20 +137,11 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
bDefaultUseSystemCredentials );
}
- uno::Reference< task::XPasswordContainer > xContainer(
- m_xPasswordContainer );
- uno::Reference< task::XUrlContainer > xUrlContainer(
- m_xPasswordContainer, uno::UNO_QUERY );
- OSL_ENSURE( xUrlContainer.is(), "Got no XUrlContainer!" );
-
- if ( !xContainer.is() || !xUrlContainer.is() )
- return false;
-
if ( bCanUseSystemCredentials )
{
// Runtime / Persistent info avail for current auth request?
- rtl::OUString aResult = xUrlContainer->findUrl(
+ rtl::OUString aResult = m_xPasswordContainer->findUrl(
rURL.isEmpty() ? rRequest.ServerName : rURL );
if ( !aResult.isEmpty() )
{
@@ -183,7 +158,7 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
}
}
- // xContainer works with userName passwdSequences pairs:
+ // m_xPasswordContainer works with userName passwdSequences pairs:
if (rRequest.HasUserName && rRequest.HasPassword)
{
try
@@ -192,12 +167,12 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
{
task::UrlRecord aRec;
if ( !rURL.isEmpty() )
- aRec = xContainer->find(rURL, xIH);
+ aRec = m_xPasswordContainer->find(rURL, xIH);
if ( aRec.UserList.getLength() == 0 )
{
// compat: try server name.
- aRec = xContainer->find(rRequest.ServerName, xIH);
+ aRec = m_xPasswordContainer->find(rRequest.ServerName, xIH);
}
if ( fillContinuation( false,
@@ -215,13 +190,13 @@ bool PasswordContainerHelper::handleAuthenticationRequest(
{
task::UrlRecord aRec;
if ( !rURL.isEmpty() )
- aRec = xContainer->findForName(
+ aRec = m_xPasswordContainer->findForName(
rURL, rRequest.UserName, xIH);
if ( aRec.UserList.getLength() == 0 )
{
// compat: try server name.
- aRec = xContainer->findForName(
+ aRec = m_xPasswordContainer->findForName(
rRequest.ServerName, rRequest.UserName, xIH);
}
@@ -263,13 +238,10 @@ bool PasswordContainerHelper::addRecord(
if ( bPersist )
{
- uno::Reference< task::XMasterPasswordHandling > xMPH(
- m_xPasswordContainer, uno::UNO_QUERY_THROW );
-
// If persistent storing of passwords is not yet
// allowed, enable it.
- if ( !xMPH->isPersistentStoringAllowed() )
- xMPH->allowPersistentStoring( sal_True );
+ if ( !m_xPasswordContainer->isPersistentStoringAllowed() )
+ m_xPasswordContainer->allowPersistentStoring( sal_True );
m_xPasswordContainer->addPersistent( rURL,
rUsername,
@@ -284,13 +256,7 @@ bool PasswordContainerHelper::addRecord(
}
else
{
- uno::Reference< task::XUrlContainer >
- xContainer( m_xPasswordContainer, uno::UNO_QUERY );
- OSL_ENSURE( xContainer.is(), "Got no XUrlContainer!" );
- if ( !xContainer.is() )
- return false;
-
- xContainer->addUrl( rURL, bPersist );
+ m_xPasswordContainer->addUrl( rURL, bPersist );
}
}
catch ( task::NoMasterException const & )
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
index a755fc5115ec..31434a3f0da1 100644
--- a/uui/source/passwordcontainer.hxx
+++ b/uui/source/passwordcontainer.hxx
@@ -25,7 +25,7 @@
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/XSingleServiceFactory.hpp"
#include "com/sun/star/task/XInteractionHandler.hpp"
-#include "com/sun/star/task/XPasswordContainer.hpp"
+#include "com/sun/star/task/XPasswordContainer2.hpp"
namespace com {
namespace sun {
@@ -133,7 +133,7 @@ public:
private:
com::sun::star::uno::Reference<
- com::sun::star::task::XPasswordContainer > m_xPasswordContainer;
+ com::sun::star::task::XPasswordContainer2 > m_xPasswordContainer;
};
// ============================================================================