diff options
author | sb <sb@openoffice.org> | 2009-07-02 15:29:21 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2009-07-02 15:29:21 +0200 |
commit | d790c0c2dd77875626abc306f4c2871b02695350 (patch) | |
tree | eedf08a6e286eddbda1480265e11f6526305dd4f /ucbhelper | |
parent | #i101955# XStringEscape is optional, so should not trigger OSL_ENUSREs (diff) | |
parent | undoing r273933 which was accidently commited on master m51 (diff) | |
download | core-d790c0c2dd77875626abc306f4c2871b02695350.tar.gz core-d790c0c2dd77875626abc306f4c2871b02695350.zip |
merged in DEV300_m51
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx | 60 | ||||
-rw-r--r-- | ucbhelper/prj/build.lst | 2 | ||||
-rw-r--r-- | ucbhelper/source/provider/simpleauthenticationrequest.cxx | 137 |
3 files changed, 166 insertions, 33 deletions
diff --git a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx index e4190da641e5..ddb2e655de8b 100644 --- a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx +++ b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx @@ -33,6 +33,7 @@ #include <rtl/ref.hxx> #include <ucbhelper/interactionrequest.hxx> +#include <com/sun/star/ucb/AuthenticationRequest.hpp> #include "ucbhelper/ucbhelperdllapi.h" namespace ucbhelper { @@ -61,6 +62,14 @@ class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest : public ucbhelper::Intera rtl::Reference< 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 ); + public: /** Specification whether some entity (realm, username, password, account) is either not applicable at all, has a fixed value, or is modifiable. @@ -94,6 +103,26 @@ public: * Constructor. * * @param rServerName contains a server name. + * @param rRealm contains a realm, if applicable. + * @param rUserName contains a username, if available (for instance from + * a previous try). + * @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 + */ + SimpleAuthenticationRequest( const rtl::OUString & rServerName, + const rtl::OUString & rRealm, + const rtl::OUString & rUserName, + const rtl::OUString & rPassword, + const rtl::OUString & rAccount, + const sal_Bool & bAllowPersistentStoring); + + + /** + * Constructor. + * + * @param rServerName contains a server name. * @param eRealmType specifies whether a realm is applicable and modifiable. * @param rRealm contains a realm, if applicable. @@ -120,6 +149,37 @@ public: const rtl::OUString & rAccount = rtl::OUString() ); + /** + * Constructor. + * + * @param rServerName contains a server name. + * @param eRealmType specifies whether a realm is applicable and + modifiable. + * @param rRealm contains a realm, if applicable. + * @param eUserNameType specifies whether a username is applicable and + modifiable. + * @param rUserName contains a username, if available (for instance from + * a previous try). + * @param ePasswordType specifies whether a password is applicable and + modifiable. + * @param rPassword contains a password, if available (for instance from + * a previous try). + * @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 + */ + SimpleAuthenticationRequest( const rtl::OUString & rServerName, + EntityType eRealmType, + const rtl::OUString & rRealm, + EntityType eUserNameType, + const rtl::OUString & rUserName, + EntityType ePasswordType, + const rtl::OUString & rPassword, + EntityType eAccountType, + const rtl::OUString & rAccount, + const sal_Bool & bAllowPersistentStoring); + /** * This method returns the supplier for the missing authentication data, * that, for instance can be used to query the password supplied by the diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst index fb9e7d7ab45f..3f49d69c987f 100644 --- a/ucbhelper/prj/build.lst +++ b/ucbhelper/prj/build.lst @@ -1,4 +1,4 @@ -uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL +uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL uh ucbhelper usr1 - all uh_mkout NULL uh ucbhelper\inc nmake - all uh_inc NULL uh ucbhelper\source\client nmake - all uh_client uh_inc NULL diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx index c70dc40db2f7..16570f7f012d 100644 --- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx +++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucbhelper.hxx" -#include <com/sun/star/ucb/AuthenticationRequest.hpp> +#include <com/sun/star/task/XMasterPasswordHandling.hpp> #include <ucbhelper/simpleauthenticationrequest.hxx> using namespace com::sun::star; @@ -44,7 +44,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( const rtl::OUString & rPassword, const rtl::OUString & rAccount ) { - // Fill request... + // Fill request... ucb::AuthenticationRequest aRequest; // aRequest.Message = // OUString // aRequest.Context = // XInterface @@ -62,20 +62,73 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( if ( aRequest.HasAccount ) aRequest.Account = rAccount; + initialize(aRequest, + sal_False, + sal_True, + sal_True, + aRequest.HasAccount, + sal_False); +} +//========================================================================= +SimpleAuthenticationRequest::SimpleAuthenticationRequest( + const rtl::OUString & rServerName, + const rtl::OUString & rRealm, + const rtl::OUString & rUserName, + const rtl::OUString & rPassword, + const rtl::OUString & rAccount, + const sal_Bool & bAllowPersistentStoring ) +{ + + // Fill request... + ucb::AuthenticationRequest aRequest; +// aRequest.Message = // OUString +// aRequest.Context = // XInterface + aRequest.Classification = task::InteractionClassification_ERROR; + aRequest.ServerName = rServerName; +// aRequest.Diagnostic = // OUString + aRequest.HasRealm = ( rRealm.getLength() > 0 ); + if ( aRequest.HasRealm ) + aRequest.Realm = rRealm; + aRequest.HasUserName = sal_True; + aRequest.UserName = rUserName; + aRequest.HasPassword = sal_True; + aRequest.Password = rPassword; + aRequest.HasAccount = ( rAccount.getLength() > 0 ); + if ( aRequest.HasAccount ) + aRequest.Account = rAccount; + + 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( 2 ); + 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, - sal_False, // bCanSetRealm - sal_True, // bCanSetUserName - sal_True, // bCanSetPassword - aRequest.HasAccount, // bCanSetAccount + bCanSetRealm, + bCanSetUserName, + bCanSetPassword, + bCanSetAccount, aRememberModes, // rRememberPasswordModes ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode aRememberModes, // rRememberAccountModes @@ -123,31 +176,51 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( if ( aRequest.HasAccount ) aRequest.Account = rAccount; - setRequest( uno::makeAny( aRequest ) ); - - // Fill continuations... - uno::Sequence< ucb::RememberAuthentication > aRememberModes( 2 ); - aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; - aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION; - - m_xAuthSupplier - = new InteractionSupplyAuthentication( - this, - eRealmType == ENTITY_MODIFY, // bCanSetRealm - eUserNameType == ENTITY_MODIFY, // bCanSetUserName - ePasswordType == ENTITY_MODIFY, // bCanSetPassword - eAccountType == ENTITY_MODIFY, // bCanSetAccount - aRememberModes, // rRememberPasswordModes - ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode - aRememberModes, // rRememberAccountModes - ucb::RememberAuthentication_SESSION // eDefaultRememberAccountMode - ); + initialize(aRequest, + eRealmType == ENTITY_MODIFY, + eUserNameType == ENTITY_MODIFY, + ePasswordType == ENTITY_MODIFY, + eAccountType == ENTITY_MODIFY, + sal_False); +} - uno::Sequence< - uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); - aContinuations[ 0 ] = new InteractionAbort( this ); - aContinuations[ 1 ] = new InteractionRetry( this ); - aContinuations[ 2 ] = m_xAuthSupplier.get(); +//========================================================================= +SimpleAuthenticationRequest::SimpleAuthenticationRequest( + const rtl::OUString & rServerName, + EntityType eRealmType, + const rtl::OUString & rRealm, + EntityType eUserNameType, + const rtl::OUString & rUserName, + EntityType ePasswordType, + const rtl::OUString & rPassword, + EntityType eAccountType, + const rtl::OUString & rAccount, + const sal_Bool & bAllowPersistentStoring ) +{ + // Fill request... + ucb::AuthenticationRequest aRequest; +// aRequest.Message = // OUString +// aRequest.Context = // XInterface + aRequest.Classification = task::InteractionClassification_ERROR; + aRequest.ServerName = rServerName; +// aRequest.Diagnostic = // OUString + aRequest.HasRealm = eRealmType != ENTITY_NA; + if ( aRequest.HasRealm ) + aRequest.Realm = rRealm; + aRequest.HasUserName = eUserNameType != ENTITY_NA; + if ( aRequest.HasUserName ) + aRequest.UserName = rUserName; + aRequest.HasPassword = ePasswordType != ENTITY_NA; + if ( aRequest.HasPassword ) + aRequest.Password = rPassword; + aRequest.HasAccount = eAccountType != ENTITY_NA; + if ( aRequest.HasAccount ) + aRequest.Account = rAccount; - setContinuations( aContinuations ); + initialize(aRequest, + eRealmType == ENTITY_MODIFY, + eUserNameType == ENTITY_MODIFY, + ePasswordType == ENTITY_MODIFY, + eAccountType == ENTITY_MODIFY, + bAllowPersistentStoring); } |