applayerprotocols/httptransportfw/inc/http/mhttpauthenticationcallback.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file MHTTPAuthenticationCallback.h
       
    18  @warning : This file contains Rose Model ID comments - please do not delete
       
    19 */
       
    20 
       
    21 #ifndef	__MHTTPAUTHENTICATIONCALLBACK_H__
       
    22 #define	__MHTTPAUTHENTICATIONCALLBACK_H__ 
       
    23 
       
    24 // System includes
       
    25 #include <uri8.h>
       
    26 #include <stringpool.h>
       
    27 #include <http/rhttpsession.h>
       
    28 #include <http/cauthenticationfilterinterface.h>
       
    29 
       
    30 
       
    31 //##ModelId=3B1E52A50151
       
    32 class MHTTPAuthenticationCallback
       
    33 /** 
       
    34 The mixin that needs to be implemented if authentication is to be
       
    35 supported. This supplies the username and password when they are
       
    36 needed for authentication.
       
    37 To use, subclass off this class and implement GetCredentialsL. To install
       
    38 the class into a session, call InstallAuthenticationL.
       
    39 @publishedAll
       
    40 @released
       
    41 */
       
    42 	{
       
    43  public:
       
    44 	/** Gets some credentials. Note that the first 3 parameters are
       
    45 		informational and many clients may not have a use for
       
    46 		them. Clients may want to display some or all of these
       
    47 		parameters to the user, so that the user knows who they are
       
    48 		giving their credentials to, and how securely they will be
       
    49 		transmitted.
       
    50 		@param aURI The URI being requested
       
    51 		@param aRealm The realm being requested
       
    52 		@param aAuthenticationType The type of authentication (basic or digest)
       
    53 		@param aUsername The username is returned in this parameter. 
       
    54 		The caller will close the returned string.
       
    55 		@param aPassword The password is returned in this parameter
       
    56 		The caller will close the returned string.
       
    57 		@return True if credentials have been obtained. 
       
    58 		@leave Anything. If this function leaves the transaction will be 
       
    59 		failed. 
       
    60 	*/
       
    61 	//##ModelId=3B1E52A5015D
       
    62 	virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm, 
       
    63 								  RStringF aAuthenticationType,
       
    64 								  RString& aUsername, 
       
    65 								  RString& aPassword) = 0;
       
    66 
       
    67 	/** Installs the callback into the session.
       
    68 		Typicaly called from the implementation class's ConstructL().
       
    69 		@pre The session is opened, but no transactions have been created on it
       
    70 		@post The session supports authentication, and uses this API to
       
    71 		get its credentials.
       
    72 		@param aSession the session to install the filter into.
       
    73 		@leave KErrNoMemory There was not enough memory.
       
    74 	 */
       
    75 	//##ModelId=3B1E52A5015B
       
    76 	inline void InstallAuthenticationL(RHTTPSession aSession);
       
    77 	};
       
    78 
       
    79 inline void MHTTPAuthenticationCallback::InstallAuthenticationL(RHTTPSession aSession)
       
    80 	{
       
    81 	CAuthenticationFilterInterface::InstallFilterL(aSession, this);
       
    82 	}
       
    83 
       
    84 
       
    85 #endif //	__MHTTPAUTHENTICATIONCALLBACK_H__