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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @file MHTTPAuthenticationCallback.h
20 @warning : This file contains Rose Model ID comments - please do not delete
23 #ifndef __MHTTPAUTHENTICATIONCALLBACK_H__
24 #define __MHTTPAUTHENTICATIONCALLBACK_H__
28 #include <stringpool.h>
29 #include <http/rhttpsession.h>
30 #include <http/cauthenticationfilterinterface.h>
33 //##ModelId=3B1E52A50151
34 class MHTTPAuthenticationCallback
36 The mixin that needs to be implemented if authentication is to be
37 supported. This supplies the username and password when they are
38 needed for authentication.
39 To use, subclass off this class and implement GetCredentialsL. To install
40 the class into a session, call InstallAuthenticationL.
46 /** Gets some credentials. Note that the first 3 parameters are
47 informational and many clients may not have a use for
48 them. Clients may want to display some or all of these
49 parameters to the user, so that the user knows who they are
50 giving their credentials to, and how securely they will be
52 @param aURI The URI being requested
53 @param aRealm The realm being requested
54 @param aAuthenticationType The type of authentication (basic or digest)
55 @param aUsername The username is returned in this parameter.
56 The caller will close the returned string.
57 @param aPassword The password is returned in this parameter
58 The caller will close the returned string.
59 @return True if credentials have been obtained.
60 @leave Anything. If this function leaves the transaction will be
63 //##ModelId=3B1E52A5015D
64 virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm,
65 RStringF aAuthenticationType,
67 RString& aPassword) = 0;
69 /** Installs the callback into the session.
70 Typicaly called from the implementation class's ConstructL().
71 @pre The session is opened, but no transactions have been created on it
72 @post The session supports authentication, and uses this API to
74 @param aSession the session to install the filter into.
75 @leave KErrNoMemory There was not enough memory.
77 //##ModelId=3B1E52A5015B
78 inline void InstallAuthenticationL(RHTTPSession aSession);
81 inline void MHTTPAuthenticationCallback::InstallAuthenticationL(RHTTPSession aSession)
83 CAuthenticationFilterInterface::InstallFilterL(aSession, this);
87 #endif // __MHTTPAUTHENTICATIONCALLBACK_H__