|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Name : CSIPSecDigestPlugin.h |
|
16 * Part of : SIPSec/DigestPlugin |
|
17 * Version : SIP/6.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef __CSIPSEC_DIGESTPLUGIN_H__ |
|
29 #define __CSIPSEC_DIGESTPLUGIN_H__ |
|
30 |
|
31 // INCLUDES |
|
32 #include "sipsecsecuritymechanism.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class RStringF; |
|
36 class CSIPSecDigest; |
|
37 class CSIPSecDigestCache; |
|
38 class CSIPSecUserRecord; |
|
39 class CSIPAuthenticationInfoHeader; |
|
40 class MTimerManager; |
|
41 class CSIPSecurityVerifyHeader; |
|
42 class CSIPAuthHeaderBase; |
|
43 class CSIPAuthorizationHeader; |
|
44 class MSIPSecEngineContext; |
|
45 class CSIPMessage; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 /** |
|
50 * @brief Class implements SIP-sec mechanism, and is ECOM plugin |
|
51 * |
|
52 * @class CSIPSecDigestPlugin CSIPSecDigestPlugin.h "CSIPSecDigestPlugin.h" |
|
53 */ |
|
54 class CSIPSecDigestPlugin : public CSIPSecSecurityMechanism |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /** |
|
59 * Constructs the object. |
|
60 * @param aInitParams Initialization parameters |
|
61 * @return Return New CSIPSecDigest object, ownership is transferred. |
|
62 */ |
|
63 static CSIPSecDigestPlugin* NewL( TAny* aInitParams ); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 ~CSIPSecDigestPlugin(); |
|
69 |
|
70 public: // From MSIPSecSecurityMechanism |
|
71 |
|
72 const TDesC8& Name() const; |
|
73 |
|
74 void InitializeSecurityClientL( CSIPSecurityClientHeader& aSecurityClient ); |
|
75 |
|
76 void ProcessSecurityVerifyL( TSIPTransportParams& aTransportParams, |
|
77 CSIPRequest& aRequest, |
|
78 TInetAddr& aNextHop, |
|
79 const CUri8& aRemoteTarget, |
|
80 const TDesC8& aOutboundProxy, |
|
81 MSIPSecUser* aUser, |
|
82 TRegistrationId aRegistrationId, |
|
83 RPointerArray<CSIPSecurityServerHeader>& aSecurityServer, |
|
84 RPointerArray<CSIPSecurityVerifyHeader>& aSecurityVerify ); |
|
85 |
|
86 void AddSecurityParamsL( TSIPTransportParams& aTransportParams, |
|
87 CSIPRequest& aRequest, |
|
88 TRegistrationId aRegistrationId, |
|
89 TTransactionId aTransactionId, |
|
90 TInetAddr& aNextHop, |
|
91 const CUri8& aRemoteTarget, |
|
92 const TDesC8& aOutboundProxy, |
|
93 MSIPSecUser* aUser ); |
|
94 |
|
95 TBool ResponseReceivedL( TSIPTransportParams& aTransportParams, |
|
96 CSIPResponse& aResponse, |
|
97 CSIPRequest& aRequest, |
|
98 TRegistrationId aRegistrationId, |
|
99 TTransactionId aTransactionId, |
|
100 TInetAddr& aNextHop, |
|
101 const CUri8& aRemoteTarget, |
|
102 const TDesC8& aOutboundProxy, |
|
103 MSIPSecUser* aUser, |
|
104 MSIPSecSecurityMechanismObserver& aObserver ); |
|
105 |
|
106 TBool IsServerInitiatedSecAgreeAllowed() const; |
|
107 |
|
108 TBool ParametersUpdatedL(MSIPSecUser* aUser); |
|
109 |
|
110 void CancelPendingOperations( MSIPSecSecurityMechanismObserver* aObserver ); |
|
111 |
|
112 void ClearCache(MSIPSecUser* aUser); |
|
113 |
|
114 void SetCredentialsL( TTransactionId aTransactionId, |
|
115 const TDesC8& aRealm, |
|
116 const TDesC8& aOutboundProxy, |
|
117 const TDesC8& aUserName, |
|
118 const TDesC8& aPassword); |
|
119 |
|
120 void SetCredentialsL( const MSIPSecUser& aUser, |
|
121 const TDesC8& aRealm, |
|
122 const TDesC8& aOutboundProxy, |
|
123 const TDesC8& aUserName, |
|
124 const TDesC8& aPassword ); |
|
125 |
|
126 TInt IgnoreChallenge( TTransactionId aTransactionId, |
|
127 const TDesC8& aRealm, |
|
128 const MSIPSecUser* aTrustedUser ); |
|
129 |
|
130 TInt RemoveCredentials( const TDesC8& aRealm ); |
|
131 |
|
132 public: // New functions |
|
133 |
|
134 /* |
|
135 * Returns engine context |
|
136 * @return SIPSec engine context |
|
137 */ |
|
138 MSIPSecEngineContext& EngineContext(); |
|
139 |
|
140 TBool EmptyResponseAfterSqnFailure() const; |
|
141 |
|
142 private: // New functions, for internal use |
|
143 |
|
144 /* |
|
145 * Two phase constructor |
|
146 * @param aTimerMgr a timer manager |
|
147 */ |
|
148 void ConstructL( MTimerManager& aTimerMgr ); |
|
149 |
|
150 /* |
|
151 * Constructor |
|
152 * @param aEngineContext SIPSec engine context |
|
153 */ |
|
154 CSIPSecDigestPlugin( MSIPSecEngineContext& aEngineContext ); |
|
155 |
|
156 /* |
|
157 * Returns authentication info from response, if any. |
|
158 * @param aResponse the response |
|
159 * @return Authentication info, ownership is not transferred. |
|
160 */ |
|
161 CSIPAuthenticationInfoHeader* |
|
162 AuthenticationInfo( CSIPResponse& aResponse ) const; |
|
163 |
|
164 /* |
|
165 * Prepares outgoing request by removing all headers, which must be removed |
|
166 * @param aSIPRequest SIP request |
|
167 * @return Authorization header, which was set by digest, or NULL. |
|
168 * Ownership is not transferred. |
|
169 */ |
|
170 CSIPAuthorizationHeader* PrepareRequestL( CSIPRequest& aSIPRequest ) const; |
|
171 |
|
172 /* |
|
173 * Set credentials to the user record and update cache. |
|
174 * @param aRecord User record to be updated |
|
175 * @param aOutboundProxy Outbound proxy |
|
176 * @param aUserName Username |
|
177 * @param aPassword Password |
|
178 */ |
|
179 void SetCredentialsToRecordL( CSIPSecUserRecord& aRecord, |
|
180 const TDesC8& aOutboundProxy, |
|
181 const TDesC8& aUserName, |
|
182 const TDesC8& aPassword ); |
|
183 |
|
184 private: // Data |
|
185 |
|
186 // Digest, owned. |
|
187 CSIPSecDigest* iDigestMechanism; |
|
188 |
|
189 // Cache, owned. |
|
190 CSIPSecDigestCache* iCache; |
|
191 |
|
192 // SIPSec Engine context |
|
193 MSIPSecEngineContext& iEngineContext; |
|
194 |
|
195 // If ETrue, an empty Response-parameter is sent if AKA authentication |
|
196 // results an SQN failure. |
|
197 // If EFalse, the Response-parameter is computed using an empty password, |
|
198 // if AKA authentication results an SQN failure. |
|
199 TBool iSendEmptyResponseParameterAfterSqnFailure; |
|
200 |
|
201 // For testing purposes |
|
202 #ifdef CPPUNIT_TEST |
|
203 friend class CSIPSecDigestTest; |
|
204 friend class CSIPSecCredentialsTest; |
|
205 friend class CSIPSecUserCredentialsTest; |
|
206 friend class CSIPSecResolverTest; |
|
207 friend class CSIPSecRequestDataTest; |
|
208 friend class CSIPSecSIMCredentialsProviderTest; |
|
209 #endif |
|
210 }; |
|
211 |
|
212 #endif //end of __CSIPSEC_DIGESTPLUGIN_H__ |
|
213 |
|
214 // End of File |