summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svtools/source/inc/passwordcontainer.hxx28
-rw-r--r--svtools/source/misc1/makefile.mk1
-rw-r--r--svtools/source/passwordcontainer/makefile.mk3
-rw-r--r--svtools/source/passwordcontainer/passwordcontainer.cxx151
-rw-r--r--ucbhelper/inc/ucbhelper/interactionrequest.hxx40
-rw-r--r--ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx49
-rw-r--r--ucbhelper/source/provider/interactionrequest.cxx32
-rw-r--r--ucbhelper/source/provider/simpleauthenticationrequest.cxx125
8 files changed, 294 insertions, 135 deletions
diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx
index a6edea49f699..a067672f3cf6 100644
--- a/svtools/source/inc/passwordcontainer.hxx
+++ b/svtools/source/inc/passwordcontainer.hxx
@@ -34,13 +34,14 @@
#include <vector>
#include <map>
#include <com/sun/star/task/XPasswordContainer.hpp>
+#include <com/sun/star/task/XUrlContainer.hpp>
#include <com/sun/star/task/PasswordRequestMode.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/task/XMasterPasswordHandling2.hpp>
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/factory.hxx>
@@ -52,6 +53,8 @@
#include <rtl/ref.hxx>
#include <osl/mutex.hxx>
+#include "syscreds.hxx"
+
#define MEMORY_RECORD 0
#define PERSISTENT_RECORD 1
@@ -241,9 +244,10 @@ enum PasswordState {
cancelled
};
-class PasswordContainer : public ::cppu::WeakImplHelper4<
+class PasswordContainer : public ::cppu::WeakImplHelper5<
::com::sun::star::task::XPasswordContainer,
::com::sun::star::task::XMasterPasswordHandling2,
+ ::com::sun::star::task::XUrlContainer,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XEventListener >
{
@@ -253,6 +257,7 @@ private:
::osl::Mutex mMutex;
::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent;
+ SysCredentialsConfig mUrlContainer;
::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence(
const ::std::list< NamePassRecord >& original,
@@ -269,6 +274,19 @@ private:
const ::rtl::OUString& name,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
throw(::com::sun::star::uno::RuntimeException);
+bool createUrlRecord(
+ const PassMap::iterator & rIter,
+ bool bName,
+ const ::rtl::OUString & aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler,
+ ::com::sun::star::task::UrlRecord & rRec )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::task::UrlRecord find(
+ const ::rtl::OUString& aURL,
+ const ::rtl::OUString& aName,
+ bool bName, // only needed to support empty user names
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString GetDefaultMasterPassword();
@@ -369,6 +387,12 @@ public:
virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException);
+ // XUrlContainer
+ virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException);
+
void Notify();
};
diff --git a/svtools/source/misc1/makefile.mk b/svtools/source/misc1/makefile.mk
index e74afd81d83c..dd143ea4e972 100644
--- a/svtools/source/misc1/makefile.mk
+++ b/svtools/source/misc1/makefile.mk
@@ -54,7 +54,6 @@ SLOFILES=\
$(SLO)$/inettype.obj \
$(SLO)$/iniadrtk.obj \
$(SLO)$/lngmisc.obj \
- $(SLO)$/loginerr.obj \
$(SLO)$/PasswordHelper.obj
SRS1NAME=$(TARGET)
diff --git a/svtools/source/passwordcontainer/makefile.mk b/svtools/source/passwordcontainer/makefile.mk
index 70692ecbf06b..31e1336ad966 100644
--- a/svtools/source/passwordcontainer/makefile.mk
+++ b/svtools/source/passwordcontainer/makefile.mk
@@ -43,7 +43,8 @@ DLLPRE=
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/passwordcontainer.obj
+ $(SLO)$/passwordcontainer.obj\
+ $(SLO)$/syscreds.obj
SHL1TARGET= $(TARGET)
SHL1IMPLIB= i$(TARGET)
diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx
index 9855e7e3c487..cebde0705f12 100644
--- a/svtools/source/passwordcontainer/passwordcontainer.cxx
+++ b/svtools/source/passwordcontainer/passwordcontainer.cxx
@@ -152,10 +152,17 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd )
static sal_Bool shorterUrl( ::rtl::OUString& aURL )
{
sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) );
- if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 )
+
+ if( aInd > 0 )
{
- aURL = aURL.copy( 0, aInd );
- return sal_True;
+ sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd );
+ if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) )
+ != aPrevInd - 2 ||
+ aInd != aURL.getLength() - 1 )
+ {
+ aURL = aURL.copy( 0, aInd );
+ return sal_True;
+ }
}
return sal_False;
@@ -753,37 +760,14 @@ void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUS
UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
{
- ::osl::MutexGuard aGuard( mMutex );
-
- if( !m_aContainer.empty() )
- {
- ::rtl::OUString aUrl( aURL );
- PassMap::iterator aIter = m_aContainer.find( aUrl );
-
- if( aIter != m_aContainer.end() )
- return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) );
-
- // each iteration remove last '/...' section from the aUrl
- // while it's possible, up to the most left '://'
- while( shorterUrl( aUrl ) )
- {
- // first look for <url>/somename and then look for <url>/somename/...
- aIter = m_aContainer.find( aUrl );
- if( aIter != m_aContainer.end() )
- return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) );
- else
- {
- ::rtl::OUString tmpUrl( aUrl );
- tmpUrl += ::rtl::OUString::createFromAscii( "/" );
+ return find( aURL, rtl::OUString(), false, aHandler );
+}
- aIter = m_aContainer.lower_bound( aUrl );
- if( aIter != m_aContainer.end() )
- return UrlRecord( aIter->first, CopyToUserRecordSequence( aIter->second, aHandler ) );
- }
- }
- }
+//-------------------------------------------------------------------------
- return UrlRecord();
+UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
+{
+ return find( aURL, aName, true, aHandler );
}
//-------------------------------------------------------------------------
@@ -810,48 +794,76 @@ Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >&
//-------------------------------------------------------------------------
-UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
+bool PasswordContainer::createUrlRecord(
+ const PassMap::iterator & rIter,
+ bool bName,
+ const ::rtl::OUString & aName,
+ const Reference< XInteractionHandler >& aHandler,
+ UrlRecord & rRec )
+ throw( RuntimeException )
{
+ if ( bName )
+ {
+ Sequence< UserRecord > aUsrRec
+ = FindUsr( rIter->second, aName, aHandler );
+ if( aUsrRec.getLength() )
+ {
+ rRec = UrlRecord( rIter->first, aUsrRec );
+ return true;
+ }
+ }
+ else
+ {
+ rRec = UrlRecord(
+ rIter->first,
+ CopyToUserRecordSequence( rIter->second, aHandler ) );
+ return true;
+ }
+ return false;
+}
+
+//-------------------------------------------------------------------------
+UrlRecord PasswordContainer::find(
+ const ::rtl::OUString& aURL,
+ const ::rtl::OUString& aName,
+ bool bName, // only needed to support empty user names
+ const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
+{
::osl::MutexGuard aGuard( mMutex );
- if( !m_aContainer.empty() )
+
+ if( !m_aContainer.empty() && aURL.getLength() )
{
::rtl::OUString aUrl( aURL );
- PassMap::iterator aIter = m_aContainer.find( aUrl );
-
- if( aIter != m_aContainer.end() )
- {
- Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- return UrlRecord( aIter->first, aUsrRec );
- }
// each iteration remove last '/...' section from the aUrl
// while it's possible, up to the most left '://'
- while( shorterUrl( aUrl ) )
+ do
{
// first look for <url>/somename and then look for <url>/somename/...
- aIter = m_aContainer.find( aUrl );
+ PassMap::iterator aIter = m_aContainer.find( aUrl );
if( aIter != m_aContainer.end() )
{
- Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- return UrlRecord( aIter->first, aUsrRec );
+ UrlRecord aRec;
+ if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) )
+ return aRec;
}
else
{
::rtl::OUString tmpUrl( aUrl );
- tmpUrl += ::rtl::OUString::createFromAscii( "/" );
+ if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
+ tmpUrl += ::rtl::OUString::createFromAscii( "/" );
- aIter = m_aContainer.lower_bound( aUrl );
- if( aIter != m_aContainer.end() )
+ aIter = m_aContainer.lower_bound( tmpUrl );
+ if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) )
{
- Sequence< UserRecord > aUsrRec = FindUsr( aIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- return UrlRecord( aIter->first, aUsrRec );
+ UrlRecord aRec;
+ if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) )
+ return aRec;
}
}
}
+ while( shorterUrl( aUrl ) && aUrl.getLength() );
}
return UrlRecord();
@@ -1355,6 +1367,35 @@ void SAL_CALL PasswordContainer::removeMasterPassword()
return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() );
}
+
+//-------------------------------------------------------------------------
+void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent )
+ throw (uno::RuntimeException)
+{
+ mUrlContainer.add( Url, MakePersistent );
+}
+
+//-------------------------------------------------------------------------
+::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url )
+ throw (uno::RuntimeException)
+{
+ return mUrlContainer.find( Url );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url )
+ throw (uno::RuntimeException)
+{
+ mUrlContainer.remove( Url );
+}
+
+//-------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent )
+ throw (uno::RuntimeException)
+{
+ return mUrlContainer.list( OnlyPersistent );
+}
+
//-------------------------------------------------------------------------
void PasswordContainer::Notify()
@@ -1487,7 +1528,9 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode
aRememberModes, // rRememberPasswordModes
RememberAuthentication_NO, // eDefaultRememberPasswordMode
aRememberModes, // rRememberAccountModes
- RememberAuthentication_NO // eDefaultRememberAccountMode
+ RememberAuthentication_NO, // eDefaultRememberAccountMode
+ sal_False, // bCanUseSystemCredentials
+ sal_False // bDefaultUseSystemCredentials
);
Sequence<
diff --git a/ucbhelper/inc/ucbhelper/interactionrequest.hxx b/ucbhelper/inc/ucbhelper/interactionrequest.hxx
index b66a07caceb7..f23041d0caa2 100644
--- a/ucbhelper/inc/ucbhelper/interactionrequest.hxx
+++ b/ucbhelper/inc/ucbhelper/interactionrequest.hxx
@@ -38,7 +38,7 @@
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionDisapprove.hpp>
#include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
-#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
#include <com/sun/star/ucb/XInteractionSupplyName.hpp>
#include <rtl/ref.hxx>
#include <cppuhelper/weak.hxx>
@@ -342,7 +342,7 @@ public:
class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
public InteractionContinuation,
public com::sun::star::lang::XTypeProvider,
- public com::sun::star::ucb::XInteractionSupplyAuthentication
+ public com::sun::star::ucb::XInteractionSupplyAuthentication2
{
com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
m_aRememberPasswordModes;
@@ -360,6 +360,9 @@ class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
unsigned m_bCanSetUserName : 1;
unsigned m_bCanSetPassword : 1;
unsigned m_bCanSetAccount : 1;
+ unsigned m_bCanUseSystemCredentials : 1;
+ unsigned m_bDefaultUseSystemCredentials : 1;
+ unsigned m_bUseSystemCredentials : 1;
public:
/**
@@ -382,7 +385,7 @@ public:
sal_Bool bCanSetRealm,
sal_Bool bCanSetUserName,
sal_Bool bCanSetPassword,
- sal_Bool bCanSetAccount );
+ sal_Bool bCanSetAccount);
/**
* Constructor.
*
@@ -408,6 +411,11 @@ public:
* @param eDefaultRememberAccountMode specifies the default
* authentication-remember-mode for accounts preferred by the
* requesting client.
+ * @param bCanUseSystemCredentials indicates whether issuer of the
+ * authetication request can obtain and use system credentials
+ * for authentication.
+ * @param bDefaultUseSystemCredentials specifies the default system
+ * credentials usage preferred by the requesting client
*
* @see com::sun::star::ucb::AuthenticationRequest
* @see com::sun::star::ucb::RememberAuthentication
@@ -427,7 +435,9 @@ public:
com::sun::star::ucb::RememberAuthentication > &
rRememberAccountModes,
const com::sun::star::ucb::RememberAuthentication
- eDefaultRememberAccountMode );
+ eDefaultRememberAccountMode,
+ sal_Bool bCanUseSystemCredentials,
+ sal_Bool bDefaultUseSystemCredentials );
// XInterface
virtual com::sun::star::uno::Any SAL_CALL
@@ -497,6 +507,12 @@ public:
setRememberAccount( com::sun::star::ucb::RememberAuthentication Remember )
throw( com::sun::star::uno::RuntimeException );
+ // XInteractionSupplyAuthentication2
+ virtual ::sal_Bool SAL_CALL canUseSystemCredentials( ::sal_Bool& Default )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setUseSystemCredentials( ::sal_Bool UseSystemCredentials )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
// Non-interface methods.
/**
@@ -548,6 +564,8 @@ public:
*/
const com::sun::star::ucb::RememberAuthentication &
getRememberAccountMode() const { return m_eRememberAccountMode; }
+
+ sal_Bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
};
//============================================================================
@@ -571,7 +589,10 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
m_bCanSetRealm( bCanSetRealm ),
m_bCanSetUserName( bCanSetUserName ),
m_bCanSetPassword( bCanSetPassword ),
- m_bCanSetAccount( bCanSetAccount )
+ m_bCanSetAccount( bCanSetAccount ),
+ m_bCanUseSystemCredentials( sal_False ),
+ m_bDefaultUseSystemCredentials( sal_False ),
+ m_bUseSystemCredentials( sal_False )
{
m_aRememberPasswordModes[ 0 ]
= com::sun::star::ucb::RememberAuthentication_NO;
@@ -593,7 +614,9 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
const com::sun::star::uno::Sequence<
com::sun::star::ucb::RememberAuthentication > & rRememberAccountModes,
const com::sun::star::ucb::RememberAuthentication
- eDefaultRememberAccountMode )
+ eDefaultRememberAccountMode,
+ sal_Bool bCanUseSystemCredentials,
+ sal_Bool bDefaultUseSystemCredentials )
: InteractionContinuation( pRequest ),
m_aRememberPasswordModes( rRememberPasswordModes ),
m_aRememberAccountModes( rRememberAccountModes ),
@@ -604,7 +627,10 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
m_bCanSetRealm( bCanSetRealm ),
m_bCanSetUserName( bCanSetUserName ),
m_bCanSetPassword( bCanSetPassword ),
- m_bCanSetAccount( bCanSetAccount )
+ m_bCanSetAccount( bCanSetAccount ),
+ m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
+ m_bDefaultUseSystemCredentials( bDefaultUseSystemCredentials ),
+ m_bUseSystemCredentials( bDefaultUseSystemCredentials & bCanUseSystemCredentials )
{
}
diff --git a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
index ddb2e655de8b..13061ca0238f 100644
--- a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
+++ b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
@@ -33,9 +33,12 @@
#include <rtl/ref.hxx>
#include <ucbhelper/interactionrequest.hxx>
-#include <com/sun/star/ucb/AuthenticationRequest.hpp>
#include "ucbhelper/ucbhelperdllapi.h"
+namespace com { namespace sun { namespace star { namespace ucb {
+ class URLAuthenticationRequest;
+} } } }
+
namespace ucbhelper {
/**
@@ -63,12 +66,13 @@ class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest : public ucbhelper::Intera
ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
private:
- void initialize( ::com::sun::star::ucb::AuthenticationRequest aRequest,
- const sal_Bool & bCanSetRealm,
- const sal_Bool & bCanSetUserName,
- const sal_Bool & bCanSetPassword,
- const sal_Bool & bCanSetAccount,
- const sal_Bool & bAllowPersistentStoring );
+ void initialize( const ::com::sun::star::ucb::URLAuthenticationRequest & rRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount,
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials );
public:
/** Specification whether some entity (realm, username, password, account)
@@ -84,6 +88,7 @@ public:
/**
* Constructor.
*
+ * @param rURL contains a URL for which authentication is requested.
* @param rServerName contains a server name.
* @param rRealm contains a realm, if applicable.
* @param rUserName contains a username, if available (for instance from
@@ -92,7 +97,8 @@ public:
* a previous try).
* @param rAccount contains an account, if applicable.
*/
- SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ SimpleAuthenticationRequest( const rtl::OUString & rURL,
+ const rtl::OUString & rServerName,
const rtl::OUString & rRealm,
const rtl::OUString & rUserName,
const rtl::OUString & rPassword,
@@ -102,6 +108,7 @@ public:
/**
* Constructor.
*
+ * @param rURL contains a URL for which authentication is requested.
* @param rServerName contains a server name.
* @param rRealm contains a realm, if applicable.
* @param rUserName contains a username, if available (for instance from
@@ -109,14 +116,19 @@ public:
* @param rPassword contains a password, if available (for instance from
* a previous try).
* @param rAccount contains an account, if applicable.
- * @param bAllowPersistentStoring specifies if the credentials should stored in the passowrd container persistently
+ * @param bAllowPersistentStoring specifies if the credentials should
+ * be stored in the passowrd container persistently
+ * @param bAllowUseSystemCredntials specifies if requesting client is
+ * able to obtain and use system credentials for authentication
*/
- SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ SimpleAuthenticationRequest( const rtl::OUString & rURL,
+ const rtl::OUString & rServerName,
const rtl::OUString & rRealm,
const rtl::OUString & rUserName,
const rtl::OUString & rPassword,
const rtl::OUString & rAccount,
- const sal_Bool & bAllowPersistentStoring);
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials );
/**
@@ -138,7 +150,8 @@ public:
modifiable.
* @param rAccount contains an account, if applicable.
*/
- SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ SimpleAuthenticationRequest( const rtl::OUString & rURL,
+ const rtl::OUString & rServerName,
EntityType eRealmType,
const rtl::OUString & rRealm,
EntityType eUserNameType,
@@ -152,6 +165,7 @@ public:
/**
* Constructor.
*
+ * @param rURL contains a URL for which authentication is requested.
* @param rServerName contains a server name.
* @param eRealmType specifies whether a realm is applicable and
modifiable.
@@ -167,9 +181,13 @@ public:
* @param eAccountType specifies whether an account is applicable and
modifiable.
* @param rAccount contains an account, if applicable.
- * @param bAllowPersistentStoring specifies if the credentials should stored in the passowrd container persistently
+ * @param bAllowPersistentStoring specifies if the credentials should
+ * be stored in the passowrd container persistently
+ * @param bAllowUseSystemCredntials specifies if requesting client is
+ * able to obtain and use system credentials for authentication
*/
- SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ SimpleAuthenticationRequest( const rtl::OUString & rURL,
+ const rtl::OUString & rServerName,
EntityType eRealmType,
const rtl::OUString & rRealm,
EntityType eUserNameType,
@@ -178,7 +196,8 @@ public:
const rtl::OUString & rPassword,
EntityType eAccountType,
const rtl::OUString & rAccount,
- const sal_Bool & bAllowPersistentStoring);
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials );
/**
* This method returns the supplier for the missing authentication data,
diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx
index 8bfb4461d6f3..df91c47dc8fe 100644
--- a/ucbhelper/source/provider/interactionrequest.cxx
+++ b/ucbhelper/source/provider/interactionrequest.cxx
@@ -704,7 +704,8 @@ InteractionSupplyAuthentication::queryInterface( const uno::Type & rType )
uno::Any aRet = cppu::queryInterface( rType,
static_cast< lang::XTypeProvider * >( this ),
static_cast< task::XInteractionContinuation * >( this ),
- static_cast< ucb::XInteractionSupplyAuthentication * >( this ) );
+ static_cast< ucb::XInteractionSupplyAuthentication * >( this ),
+ static_cast< ucb::XInteractionSupplyAuthentication2 * >( this ));
return aRet.hasValue()
? aRet : InteractionContinuation::queryInterface( rType );
@@ -750,7 +751,7 @@ uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes()
uno::Reference< lang::XTypeProvider > * >( 0 ) ),
getCppuType( static_cast<
uno::Reference<
- ucb::XInteractionSupplyAuthentication > * >( 0 ) ) );
+ ucb::XInteractionSupplyAuthentication2 > * >( 0 ) ) );
pCollection = &collection;
}
}
@@ -905,6 +906,33 @@ void SAL_CALL InteractionSupplyAuthentication::setRememberAccount(
}
//=========================================================================
+//
+// XInteractionSupplyAuthentication2 methods.
+//
+//=========================================================================
+
+// virtual
+::sal_Bool SAL_CALL
+InteractionSupplyAuthentication::canUseSystemCredentials(
+ ::sal_Bool& Default )
+ throw ( uno::RuntimeException )
+{
+ Default = m_bDefaultUseSystemCredentials;
+ return m_bCanUseSystemCredentials;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionSupplyAuthentication::setUseSystemCredentials(
+ ::sal_Bool UseSystemCredentials )
+ throw ( uno::RuntimeException )
+{
+ if ( m_bCanUseSystemCredentials )
+ m_bUseSystemCredentials = UseSystemCredentials;
+}
+
+
+//=========================================================================
//=========================================================================
//
// InteractionSupplyName Implementation.
diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
index 16570f7f012d..c5d7448fa29b 100644
--- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx
+++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucbhelper.hxx"
#include <com/sun/star/task/XMasterPasswordHandling.hpp>
+#include <com/sun/star/ucb/URLAuthenticationRequest.hpp>
#include <ucbhelper/simpleauthenticationrequest.hxx>
using namespace com::sun::star;
@@ -38,14 +39,15 @@ using namespace ucbhelper;
//=========================================================================
SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rURL,
const rtl::OUString & rServerName,
const rtl::OUString & rRealm,
const rtl::OUString & rUserName,
const rtl::OUString & rPassword,
const rtl::OUString & rAccount )
{
- // Fill request...
- ucb::AuthenticationRequest aRequest;
+ // Fill request...
+ ucb::URLAuthenticationRequest aRequest;
// aRequest.Message = // OUString
// aRequest.Context = // XInterface
aRequest.Classification = task::InteractionClassification_ERROR;
@@ -61,26 +63,30 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
aRequest.HasAccount = ( rAccount.getLength() > 0 );
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
+ aRequest.URL = rURL;
- initialize(aRequest,
+ initialize(aRequest,
sal_False,
sal_True,
sal_True,
aRequest.HasAccount,
- sal_False);
+ sal_False,
+ sal_False );
}
//=========================================================================
SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rURL,
const rtl::OUString & rServerName,
const rtl::OUString & rRealm,
const rtl::OUString & rUserName,
const rtl::OUString & rPassword,
const rtl::OUString & rAccount,
- const sal_Bool & bAllowPersistentStoring )
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials )
{
- // Fill request...
- ucb::AuthenticationRequest aRequest;
+ // Fill request...
+ ucb::URLAuthenticationRequest aRequest;
// aRequest.Message = // OUString
// aRequest.Context = // XInterface
aRequest.Classification = task::InteractionClassification_ERROR;
@@ -96,56 +102,20 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
aRequest.HasAccount = ( rAccount.getLength() > 0 );
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
+ aRequest.URL = rURL;
- initialize(aRequest,
+ initialize(aRequest,
sal_False,
sal_True,
sal_True,
aRequest.HasAccount,
- bAllowPersistentStoring);
-}
-
-void SimpleAuthenticationRequest::initialize(
- ucb::AuthenticationRequest aRequest,
- const sal_Bool & bCanSetRealm,
- const sal_Bool & bCanSetUserName,
- const sal_Bool & bCanSetPassword,
- const sal_Bool & bCanSetAccount,
- const sal_Bool & bAllowPersistentStoring )
-{
- setRequest( uno::makeAny( aRequest ) );
-
- // Fill continuations...
- uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 );
- aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
- aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
- if (bAllowPersistentStoring)
- aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT;
-
- m_xAuthSupplier
- = new InteractionSupplyAuthentication(
- this,
- bCanSetRealm,
- bCanSetUserName,
- bCanSetPassword,
- bCanSetAccount,
- aRememberModes, // rRememberPasswordModes
- ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
- aRememberModes, // rRememberAccountModes
- ucb::RememberAuthentication_SESSION // eDefaultRememberAccountMode
- );
-
- uno::Sequence<
- uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
- aContinuations[ 0 ] = new InteractionAbort( this );
- aContinuations[ 1 ] = new InteractionRetry( this );
- aContinuations[ 2 ] = m_xAuthSupplier.get();
-
- setContinuations( aContinuations );
+ bAllowPersistentStoring,
+ bAllowUseSystemCredentials );
}
//=========================================================================
SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rURL,
const rtl::OUString & rServerName,
EntityType eRealmType,
const rtl::OUString & rRealm,
@@ -157,7 +127,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
const rtl::OUString & rAccount )
{
// Fill request...
- ucb::AuthenticationRequest aRequest;
+ ucb::URLAuthenticationRequest aRequest;
// aRequest.Message = // OUString
// aRequest.Context = // XInterface
aRequest.Classification = task::InteractionClassification_ERROR;
@@ -175,17 +145,20 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
aRequest.HasAccount = eAccountType != ENTITY_NA;
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
+ aRequest.URL = rURL;
initialize(aRequest,
eRealmType == ENTITY_MODIFY,
eUserNameType == ENTITY_MODIFY,
ePasswordType == ENTITY_MODIFY,
eAccountType == ENTITY_MODIFY,
- sal_False);
+ sal_False,
+ sal_False );
}
//=========================================================================
SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rURL,
const rtl::OUString & rServerName,
EntityType eRealmType,
const rtl::OUString & rRealm,
@@ -195,10 +168,11 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
const rtl::OUString & rPassword,
EntityType eAccountType,
const rtl::OUString & rAccount,
- const sal_Bool & bAllowPersistentStoring )
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials )
{
// Fill request...
- ucb::AuthenticationRequest aRequest;
+ ucb::URLAuthenticationRequest aRequest;
// aRequest.Message = // OUString
// aRequest.Context = // XInterface
aRequest.Classification = task::InteractionClassification_ERROR;
@@ -216,11 +190,56 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
aRequest.HasAccount = eAccountType != ENTITY_NA;
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
+ aRequest.URL = rURL;
initialize(aRequest,
eRealmType == ENTITY_MODIFY,
eUserNameType == ENTITY_MODIFY,
ePasswordType == ENTITY_MODIFY,
eAccountType == ENTITY_MODIFY,
- bAllowPersistentStoring);
+ bAllowPersistentStoring,
+ bAllowUseSystemCredentials );
+}
+
+//=========================================================================
+void SimpleAuthenticationRequest::initialize(
+ const ucb::URLAuthenticationRequest & rRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount,
+ sal_Bool bAllowPersistentStoring,
+ sal_Bool bAllowUseSystemCredentials )
+{
+ setRequest( uno::makeAny( rRequest ) );
+
+ // Fill continuations...
+ uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 );
+ aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
+ aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
+ if (bAllowPersistentStoring)
+ aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT;
+
+ m_xAuthSupplier
+ = new InteractionSupplyAuthentication(
+ this,
+ bCanSetRealm,
+ bCanSetUserName,
+ bCanSetPassword,
+ bCanSetAccount,
+ aRememberModes, // rRememberPasswordModes
+ ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
+ aRememberModes, // rRememberAccountModes
+ ucb::RememberAuthentication_SESSION, // eDefaultRememberAccountMode
+ bAllowUseSystemCredentials, // bCanUseSystemCredentials,
+ false // bDefaultUseSystemCredentials
+ );
+
+ uno::Sequence<
+ uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+ aContinuations[ 0 ] = new InteractionAbort( this );
+ aContinuations[ 1 ] = new InteractionRetry( this );
+ aContinuations[ 2 ] = m_xAuthSupplier.get();
+
+ setContinuations( aContinuations );
}