|
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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef Authentication_CLIENT_H |
|
25 #define Authentication_CLIENT_H |
|
26 |
|
27 // INCLUDES |
|
28 #include <e32base.h> |
|
29 #include <flogger.h> |
|
30 #include <e32math.h> |
|
31 |
|
32 #include "seninternalserviceconsumer.h" |
|
33 #include "SenXmlElement.h" |
|
34 #include "sentransportbase.h" |
|
35 #include "wsovihandlercontext.h" |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CWSOviServiceSession; |
|
39 |
|
40 /** |
|
41 * Class: CWSOviOAuthClient |
|
42 * |
|
43 * Description: Consumer which communicate with real NAUTH. |
|
44 * Client will try obtain credentail based on WS-Authentication specification. |
|
45 */ |
|
46 class CWSOviOAuthClient : public CSenInternalServiceConsumer |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Standard 2 phase constructor |
|
52 * @param aSIF SIF implementation used in contructor of internal consumer |
|
53 * @param aLogger logger used for logs in debug mode |
|
54 * @return new instance of Authentication client |
|
55 */ |
|
56 static CWSOviOAuthClient* NewL( CSIF& aSIF); |
|
57 /** |
|
58 * Standard 2 phase constructor |
|
59 * @since Series60 4.0 |
|
60 * @param aSIF SIF implementation used in contructor of internal consumer |
|
61 * @param aLogger logger used for logs in debug mode |
|
62 * @return new instance of Authentication client which is pushed into CleanupStack |
|
63 */ |
|
64 static CWSOviOAuthClient* NewLC(CSIF& aSIF); |
|
65 |
|
66 /** |
|
67 * Normal destructor. Destroy NAUTH session. |
|
68 */ |
|
69 ~CWSOviOAuthClient(); |
|
70 |
|
71 |
|
72 /** |
|
73 * The most siginificant method of this class. Make validation of session, |
|
74 * credentails obtained if needed. |
|
75 * @param aSession session which is validated |
|
76 * @param aRemoteConsumer consumer of validated session, holds transport entryPoint |
|
77 */ |
|
78 TInt ValidateL(CWSOviServiceSession& aSession, |
|
79 HBufC8*& aErrorMessage, |
|
80 TBool aOnlySharing ); |
|
81 |
|
82 |
|
83 void SetStatus(TInt aStatus); |
|
84 /** |
|
85 * Sets identyProvider for Authentication client |
|
86 * @param aIdentityProvider identity provider representation of NAUTH |
|
87 */ |
|
88 void SetAccount(CSenIdentityProvider* aIdentityProvicer); |
|
89 |
|
90 //-----derived from CSenWSDescription, |
|
91 //in fact we expose info from NAUTHsession which is holded by that client. |
|
92 // Method have to overwrited becouse of core, which use those methods during registering |
|
93 TPtrC8 Endpoint(); |
|
94 TPtrC8 Contract(); |
|
95 TPtrC8 ProviderID(); |
|
96 TPtrC8 FrameworkId(); |
|
97 MSenServicePolicy* ServicePolicy(); |
|
98 TInt IapId(TUint32& aCurrentIapId); |
|
99 void WriteAsXMLToL(RWriteStream& aWriteStream); |
|
100 |
|
101 /** |
|
102 * Getter for validate session (not NAUTH session) |
|
103 */ |
|
104 virtual CSenServiceSession* ServiceSession(); |
|
105 |
|
106 /** |
|
107 * Getter for transport (used coreManger as Factory for transport) |
|
108 */ |
|
109 virtual MSenTransport& TransportL(); |
|
110 |
|
111 /** |
|
112 * Sets NAUTH session, used during registering NAUTH which is not initiated. |
|
113 * Clear NAUTHsession will be created and assign during registering. |
|
114 * @param aSession - clear NAUTH session assign to this Authentication clint |
|
115 */ |
|
116 void SetAuthSessionL(CWSOviServiceSession* aSession); |
|
117 |
|
118 void SetHandlerCtx(MSenHandlerContext* aHndCtx); |
|
119 |
|
120 TBool HasSuperClass( TDescriptionClassType aType ); |
|
121 void CreateBodyL(const TDesC8& aXmlNs, const TDesC8& aUsername, const TDesC8& aPassword, const TDesC8& aCreated); |
|
122 |
|
123 protected://methods |
|
124 |
|
125 /** |
|
126 * C++ default constructor. |
|
127 */ |
|
128 CWSOviOAuthClient( CSIF& aSIF, |
|
129 TDescriptionClassType aType); |
|
130 /** |
|
131 * By default Symbian 2nd phase constructor is private. |
|
132 */ |
|
133 void BaseConstructL(); |
|
134 // from MSenServiceDescription |
|
135 virtual TBool Matches(MSenServiceDescription& aPattern); |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 private: //methods |
|
141 |
|
142 // Add ProviderID to primary keys (in addition to Endpoint, Contract and FrameworkID): |
|
143 TBool HasEqualPrimaryKeysL(MSenServiceDescription& aCandidate); |
|
144 |
|
145 private: // Data |
|
146 CWSOviServiceSession* iWSOviServiceSession; // Not owned, session which we validate |
|
147 CWSOviServiceSession* iAuthSession; //auth session, owned |
|
148 |
|
149 CSenIdentityProvider* iIdentityProvider; // Not owned, comes from validation phase |
|
150 |
|
151 CSenTransportBase* ipTransport;//now owned, ownership moved to validated session |
|
152 MSenHandlerContext* iHndCtx; //not owned |
|
153 HBufC8* iBody; |
|
154 TTime iDiff; |
|
155 |
|
156 }; |
|
157 |
|
158 #endif // Authentication_CLIENT_H |
|
159 |
|
160 // End of File |
|
161 |