|
1 /* |
|
2 * Copyright (c) 2008 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 #include "wsovicredentialcollectorhandler.h" |
|
28 #include "senlogger.h" |
|
29 #include <SenDateUtils.h> |
|
30 using namespace OAuth; |
|
31 using namespace WSOviResponse; |
|
32 // Create instance of concrete ECOM interface implementation |
|
33 CWSOviCredentialCollectorHandler* CWSOviCredentialCollectorHandler::NewL(TAny* aHandlerCtx) |
|
34 { |
|
35 |
|
36 MSenHandlerContext* handlerCtx = |
|
37 reinterpret_cast<MSenHandlerContext*>(aHandlerCtx); |
|
38 CWSOviCredentialCollectorHandler* self = |
|
39 new(ELeave)CWSOviCredentialCollectorHandler(*handlerCtx); |
|
40 CleanupStack::PushL (self); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // Constructor |
|
47 CWSOviCredentialCollectorHandler::CWSOviCredentialCollectorHandler(MSenHandlerContext& aCtx) |
|
48 :CSenMessageHandler(aCtx) |
|
49 { |
|
50 } |
|
51 |
|
52 // Destructor |
|
53 CWSOviCredentialCollectorHandler::~CWSOviCredentialCollectorHandler() |
|
54 { |
|
55 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviCredentialCollectorHandler::\ |
|
56 ~CWSOviCredentialCollectorHandler()"))); |
|
57 } |
|
58 |
|
59 // Second phase construction. |
|
60 void CWSOviCredentialCollectorHandler::ConstructL() |
|
61 { |
|
62 } |
|
63 |
|
64 TInt CWSOviCredentialCollectorHandler::InvokeL(MSenMessageContext& aCtx) |
|
65 { |
|
66 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviCredentialCollectorHandler::InvokeL(MSenMessageContext& aCtx)"))); |
|
67 |
|
68 const TDesC8* token = aCtx.GetDesC8L(WSOviContextKeys::KToken()); |
|
69 if (token && aCtx.Direction()==SenContext::EOutgoing) |
|
70 { |
|
71 TPtrC8 tokenPtr(token->Mid(KTokenTag().Length())); |
|
72 tokenPtr.Set(tokenPtr.Left(tokenPtr.Length() - KTokenTagEnd().Length())); |
|
73 |
|
74 RMapDescriptors& headerProperties = ((CWSOviMessageContext&)aCtx).OAuthProperies(); |
|
75 headerProperties.Insert(&KParToken, tokenPtr.AllocL()); |
|
76 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviCredentialCollectorHandler::InvokeL\ |
|
77 (MSenMessageContext& aCtx) - \ |
|
78 Token added to OAuth parameters"))); |
|
79 ((CWSOviMessageContext&)aCtx).Update(WSOviContextKeys::KToken(), tokenPtr); |
|
80 return KErrNone; |
|
81 } |
|
82 else |
|
83 { |
|
84 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviCredentialCollectorHandler::InvokeL\ |
|
85 (MSenMessageContext& aCtx) - \ |
|
86 Token in message context not exists"))); |
|
87 return KErrNotFound; |
|
88 } |
|
89 } |
|
90 |
|
91 TInt CWSOviCredentialCollectorHandler::InitL(MSenHandlerContext& aCtx) |
|
92 { |
|
93 iHandlerContext = aCtx; |
|
94 return KErrNone; |
|
95 } |
|
96 |
|
97 SenHandler::THandlerDirection CWSOviCredentialCollectorHandler::Direction() const |
|
98 { |
|
99 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviCredentialCollectorHandler::Direction()"))); |
|
100 return SenHandler::EOutgoing; |
|
101 }; |
|
102 SenHandler::THandlerPhase CWSOviCredentialCollectorHandler::Phase() |
|
103 { |
|
104 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviCredentialCollectorHandler::Phase()"))); |
|
105 return SenHandler::EMessage; |
|
106 }; |
|
107 |
|
108 // END OF FILE |
|
109 |