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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 @file MHTTPAuthenticationCallback.h
18 @warning : This file contains Rose Model ID comments - please do not delete
21 #ifndef __MHTTPAUTHENTICATIONCALLBACK_H__
22 #define __MHTTPAUTHENTICATIONCALLBACK_H__
26 #include <stringpool.h>
27 #include <http/rhttpsession.h>
28 #include <http/cauthenticationfilterinterface.h>
31 //##ModelId=3B1E52A50151
32 class MHTTPAuthenticationCallback
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.
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
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
61 //##ModelId=3B1E52A5015D
62 virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm,
63 RStringF aAuthenticationType,
65 RString& aPassword) = 0;
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
72 @param aSession the session to install the filter into.
73 @leave KErrNoMemory There was not enough memory.
75 //##ModelId=3B1E52A5015B
76 inline void InstallAuthenticationL(RHTTPSession aSession);
79 inline void MHTTPAuthenticationCallback::InstallAuthenticationL(RHTTPSession aSession)
81 CAuthenticationFilterInterface::InstallFilterL(aSession, this);
85 #endif // __MHTTPAUTHENTICATIONCALLBACK_H__