williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: // All rights reserved.
williamr@2: // This component and the accompanying materials are made available
williamr@4: // under the terms of "Eclipse Public License v1.0"
williamr@2: // which accompanies this distribution, and is available
williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2: //
williamr@2: // Initial Contributors:
williamr@2: // Nokia Corporation - initial contribution.
williamr@2: //
williamr@2: // Contributors:
williamr@2: //
williamr@2: // Description:
williamr@2: //
williamr@2: 
williamr@2: /**
williamr@2:  @file MHTTPAuthenticationCallback.h
williamr@2:  @warning : This file contains Rose Model ID comments - please do not delete
williamr@2: */
williamr@2: 
williamr@2: #ifndef	__MHTTPAUTHENTICATIONCALLBACK_H__
williamr@2: #define	__MHTTPAUTHENTICATIONCALLBACK_H__ 
williamr@2: 
williamr@2: // System includes
williamr@2: #include <uri8.h>
williamr@2: #include <stringpool.h>
williamr@2: #include <http/rhttpsession.h>
williamr@2: #include <http/cauthenticationfilterinterface.h>
williamr@2: 
williamr@2: 
williamr@2: //##ModelId=3B1E52A50151
williamr@2: class MHTTPAuthenticationCallback
williamr@2: /** 
williamr@2: The mixin that needs to be implemented if authentication is to be
williamr@2: supported. This supplies the username and password when they are
williamr@2: needed for authentication.
williamr@2: To use, subclass off this class and implement GetCredentialsL. To install
williamr@2: the class into a session, call InstallAuthenticationL.
williamr@2: @publishedAll
williamr@2: @released
williamr@2: */
williamr@2: 	{
williamr@2:  public:
williamr@2: 	/** Gets some credentials. Note that the first 3 parameters are
williamr@2: 		informational and many clients may not have a use for
williamr@2: 		them. Clients may want to display some or all of these
williamr@2: 		parameters to the user, so that the user knows who they are
williamr@2: 		giving their credentials to, and how securely they will be
williamr@2: 		transmitted.
williamr@2: 		@param aURI The URI being requested
williamr@2: 		@param aRealm The realm being requested
williamr@2: 		@param aAuthenticationType The type of authentication (basic or digest)
williamr@2: 		@param aUsername The username is returned in this parameter. 
williamr@2: 		The caller will close the returned string.
williamr@2: 		@param aPassword The password is returned in this parameter
williamr@2: 		The caller will close the returned string.
williamr@2: 		@return True if credentials have been obtained. 
williamr@2: 		@leave Anything. If this function leaves the transaction will be 
williamr@2: 		failed. 
williamr@2: 	*/
williamr@2: 	//##ModelId=3B1E52A5015D
williamr@2: 	virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm, 
williamr@2: 								  RStringF aAuthenticationType,
williamr@2: 								  RString& aUsername, 
williamr@2: 								  RString& aPassword) = 0;
williamr@2: 
williamr@2: 	/** Installs the callback into the session.
williamr@2: 		Typicaly called from the implementation class's ConstructL().
williamr@2: 		@pre The session is opened, but no transactions have been created on it
williamr@2: 		@post The session supports authentication, and uses this API to
williamr@2: 		get its credentials.
williamr@2: 		@param aSession the session to install the filter into.
williamr@2: 		@leave KErrNoMemory There was not enough memory.
williamr@2: 	 */
williamr@2: 	//##ModelId=3B1E52A5015B
williamr@2: 	inline void InstallAuthenticationL(RHTTPSession aSession);
williamr@2: 	};
williamr@2: 
williamr@2: inline void MHTTPAuthenticationCallback::InstallAuthenticationL(RHTTPSession aSession)
williamr@2: 	{
williamr@2: 	CAuthenticationFilterInterface::InstallFilterL(aSession, this);
williamr@2: 	}
williamr@2: 
williamr@2: 
williamr@2: #endif //	__MHTTPAUTHENTICATIONCALLBACK_H__