diff options
author | Stephan Bergmann <sb@openoffice.org> | 2001-07-13 11:49:57 +0000 |
---|---|---|
committer | Stephan Bergmann <sb@openoffice.org> | 2001-07-13 11:49:57 +0000 |
commit | a49b997c0cf3e39d3b6fcf3329713fc9ccd784e3 (patch) | |
tree | 0f3f340a23ff0b46485d04538d70a57733a409cf /ucbhelper | |
parent | 4ee05f1a278a396d2a5483dfab409ebfd0b6850e (diff) |
#88969# Added more detailed constructor.
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx | 45 | ||||
-rw-r--r-- | ucbhelper/source/provider/simpleauthenticationrequest.cxx | 63 |
2 files changed, 104 insertions, 4 deletions
diff --git a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx index b2c0ccde3c8c..0b7d89679329 100644 --- a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx +++ b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx @@ -2,9 +2,9 @@ * * $RCSfile: simpleauthenticationrequest.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2001-05-28 12:42:26 $ + * last change: $Author: sb $ $Date: 2001-07-13 12:46:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,23 +96,64 @@ class SimpleAuthenticationRequest : public ucbhelper::InteractionRequest ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier; public: + /** Specification whether some entity (realm, username, password, account) + is either not applicable at all, has a fixed value, or is modifiable. + */ + enum EntityType + { + ENTITY_NA, + ENTITY_FIXED, + ENTITY_MODIFY + }; + + /** + * 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. + */ + SimpleAuthenticationRequest( const rtl::OUString & rServerName, + const rtl::OUString & rRealm, + const rtl::OUString & rUserName, + const rtl::OUString & rPassword, + 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. */ 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 = ENTITY_NA, const rtl::OUString & rAccount = rtl::OUString() ); + /** * 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/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx index 315434406762..112b3909321c 100644 --- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx +++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx @@ -2,9 +2,9 @@ * * $RCSfile: simpleauthenticationrequest.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2001-05-28 12:42:46 $ + * last change: $Author: sb $ $Date: 2001-07-13 12:49:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -124,3 +124,62 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( setContinuations( aContinuations ); } +//========================================================================= +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 ) +{ + // 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; + + setRequest( uno::makeAny( aRequest ) ); + + // Fill continuations... + uno::Sequence< ucb::RememberAuthentication > aRememberModes( 1 ); + aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; + + 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_NO, // eDefaultRememberPasswordMode + aRememberModes, // rRememberAccountModes + ucb::RememberAuthentication_NO // 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 ); +} |