summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2009-09-25 15:27:34 +0200
committersb <sb@openoffice.org>2009-09-25 15:27:34 +0200
commit6da618739964d7a9ea38293ec8b3c2f5e0b7c9b8 (patch)
treed9dadce2766459422adab55791e1f2c1c767f681 /ucbhelper
parentc763ddce153dbb73707680874ef9d2f011caaeeb (diff)
parent728c8eb458b5613eb5b8bbe8201dfc33a8a9cd78 (diff)
merged in DEV300_m60
Diffstat (limited to 'ucbhelper')
-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
4 files changed, 169 insertions, 77 deletions
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 );
}