|
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: Keep all constanece within WSTar Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 #ifndef CONSPLUGIN_H |
|
28 #define CONSPLUGIN_H |
|
29 |
|
30 #include "senpointermap.h" |
|
31 #include "SenXmlElement.h" |
|
32 |
|
33 typedef RSenPointerMap<TDesC8, TInt> RMapInt; |
|
34 typedef RSenPointerMap<TDesC8, TDesC8> RMapDescriptors; |
|
35 |
|
36 namespace WSOviConfig |
|
37 { |
|
38 _LIT8(KFrameworkVersion, "1.0"); |
|
39 _LIT8(KFrameworkXMLNS, "urn:com.nokia.ws.ovi.config.1.0"); |
|
40 _LIT8(KFrameworkCue, "com.nokia.ws.ovi.OviFramework"); |
|
41 _LIT8(KFrameworkLocalName, "Framework"); |
|
42 _LIT8(KHandlerLocalName, "Handler"); |
|
43 _LIT8(KNameAttr, "name"); |
|
44 |
|
45 _LIT8(KClassAttr, "class"); |
|
46 _LIT8(KIMSILocalName, "IMSI"); |
|
47 _LIT8(KIMSIDigestAttr, "digest"); |
|
48 _LIT8(KVersionAttr, "version"); |
|
49 _LIT8(KRegisterValue, "urn:com.nokia.ws.ovi.handler.register"); |
|
50 _LIT8(KValidateValue, "urn:com.nokia.ws.ovi.handler.validate"); |
|
51 _LIT8(KDeviceValue, "urn:com.nokia.ws.ovi.handler.device"); |
|
52 _LIT8(KCredentialCollectorValue, "urn:com.nokia.ws.ovi.handler.credentialCollector"); |
|
53 _LIT8(KSecurityValue, "urn:com.nokia.ws.ovi.handler.security"); |
|
54 _LIT8(KEncoderValue, "urn:com.nokia.ws.ovi.handler.encoder"); |
|
55 _LIT8(KServiceUpdateValue, "urn:com.nokia.ws.ovi.handler.serviceUpdate"); |
|
56 |
|
57 _LIT8(KValidateHandlerVersion, "http://account.nokia.com/schemas/rest/v1_0"); |
|
58 |
|
59 } |
|
60 |
|
61 namespace WSOviSession |
|
62 { |
|
63 //in seconds |
|
64 const TInt KCounterMax = 3; |
|
65 const TInt KMaxHttpTimeOut = 60; |
|
66 |
|
67 const TInt KSubmitStateOK = 1; |
|
68 const TInt KSubmitStateInvalidCredentials = 2; |
|
69 const TInt KSubmitStateRevalidationAttempted = 3; |
|
70 _LIT8(KDateHttpHeader, "Date"); |
|
71 |
|
72 |
|
73 _LIT8(KTokenEndpointSuffix, "tokens"); |
|
74 } |
|
75 namespace OAuth |
|
76 { |
|
77 _LIT8(KUnReserveChars, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~"); |
|
78 |
|
79 //header |
|
80 _LIT8(KAuthHttpHeader, "Authorization"); |
|
81 _LIT8(KComma, ","); |
|
82 _LIT8(KSpace, " "); |
|
83 _LIT8(KQtMark, "\""); |
|
84 _LIT8(KEqual, "="); |
|
85 _LIT8(KAmpMark, "&"); |
|
86 _LIT8(KPercent, "%"); |
|
87 |
|
88 _LIT8(KFormUrlEncoded, "application/x-www-form-urlencoded"); |
|
89 |
|
90 |
|
91 _LIT8(KXmlContentEqual, "XMLContent="); |
|
92 |
|
93 |
|
94 |
|
95 //##### parameter names |
|
96 //device |
|
97 _LIT8(KParNokiaAuth, "OAuth"); |
|
98 _LIT8(KParVersion, "oauth_version"); |
|
99 _LIT8(KParConsumerKey, "oauth_consumer_key"); |
|
100 |
|
101 |
|
102 //credential collector |
|
103 _LIT8(KParToken, "oauth_token"); |
|
104 |
|
105 //security |
|
106 _LIT8(KParRealm, "realm"); |
|
107 _LIT8(KParSignMethod, "oauth_signature_method"); |
|
108 _LIT8(KParTimestamp, "oauth_timestamp"); |
|
109 _LIT8(KParSignature, "oauth_signature"); |
|
110 _LIT8(KParNonce, "oauth_nonce"); |
|
111 _LIT8(KParHttpMethodPost, "POST"); |
|
112 _LIT8(KParHttpMethodGet, "GET"); |
|
113 _LIT8(KParHttpMethodPut, "PUT"); |
|
114 _LIT8(KParHttpMethodDelete, "DELETE"); |
|
115 |
|
116 _LIT8(KEndpointKey, "endpoint"); |
|
117 |
|
118 _LIT8(KNeedSecurity,"NeedSecurity"); |
|
119 //parameter values |
|
120 |
|
121 _LIT8(KParValVersion, "1.0"); |
|
122 _LIT8(KParValHMACSHA, "HMAC-SHA1"); |
|
123 _LIT8(KParValRealm, "https://account.nokia.com"); |
|
124 |
|
125 |
|
126 //body |
|
127 _LIT8(KCreationRequestFormat8, |
|
128 // "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
|
129 "<tokenCreationRequest xmlns=\"%S\">" |
|
130 "<digestAuth>" |
|
131 "<username>%S</username>" |
|
132 "<nonce>%S</nonce>" |
|
133 "<created>%S</created>" |
|
134 "<digest>%S</digest>" |
|
135 "</digestAuth>" |
|
136 /* " <scope>\n" |
|
137 " <resource>\n" |
|
138 " <type>path</type>\n" |
|
139 " <id>/accounts/%S/</id>\n" |
|
140 " </resource>\n" |
|
141 " </scope>\n" |
|
142 */ "</tokenCreationRequest>"); |
|
143 } |
|
144 namespace WSOviContextKeys |
|
145 { |
|
146 //SESSION KEYS |
|
147 //--keys for discovery phase |
|
148 //-----register handler |
|
149 _LIT8(KRegisterAction, "action"); |
|
150 _LIT8(KServiceDescription, "serviceDescription"); |
|
151 |
|
152 //--keys for validation phase (handler) |
|
153 _LIT8(KServiceSession, "serviceSession"); |
|
154 _LIT8(KRemoteConsumer, "RemoteConsumer"); |
|
155 _LIT8(KReAuthNeeded, "ReAuthNeeded"); |
|
156 _LIT8(KRetryNeeded, "Retry"); |
|
157 |
|
158 _LIT8(KErrMessage, "ErrorMessage"); |
|
159 |
|
160 |
|
161 _LIT8(KMessageBody,"messageBody"); |
|
162 _LIT8(KTP,"TP"); |
|
163 |
|
164 |
|
165 _LIT8(KTTL,"TTL"); |
|
166 _LIT8(KTokenCreationTime,"TokenCreationTime"); |
|
167 _LIT8( KTokenSecret, "TokenSecret"); |
|
168 _LIT8( KToken, "Token"); |
|
169 _LIT8(KOnlySharing, "OnlySharing"); |
|
170 _LIT8(KErrCode, "ErrorCode"); |
|
171 |
|
172 |
|
173 //MARKERS |
|
174 } |
|
175 |
|
176 namespace WSOviContextValues |
|
177 { |
|
178 //--values for discovery phase |
|
179 //-----register handler |
|
180 _LIT8(KActionRegister, "register"); |
|
181 _LIT8(KActionUnregister, "unregister"); |
|
182 } |
|
183 |
|
184 namespace WSOviResponse |
|
185 { |
|
186 _LIT8(KTokenTag, "<token>"); |
|
187 _LIT8(KTokenTagEnd, "</token>"); |
|
188 _LIT8(KTokenLocalName, "token"); |
|
189 _LIT8(KTokenSecretTag, "<tokenSecret>"); |
|
190 _LIT8(KTokenSecretTagEnd, "</tokenSecret>"); |
|
191 _LIT8(KTokenCreationResponseLocalName, "tokenCreationResponse"); |
|
192 _LIT8(KTokenSecretLocalName, "tokenSecret"); |
|
193 _LIT8(KTTLLocalName, "ttl"); |
|
194 _LIT8(KTokenInfoLocalName,"tokenInfo"); |
|
195 _LIT8(KErrorNode, "error"); |
|
196 _LIT8(KErrorCode, "errorCode"); |
|
197 _LIT8(KErrorText, "errorText"); |
|
198 _LIT8(KErrorCodeInvalidAccessToken, "invalidAccessToken"); |
|
199 _LIT8(KErrorCodeUnauthorized, "notAuthorized"); |
|
200 |
|
201 _LIT8(KUserInfoLocalName,"userInfo"); |
|
202 _LIT8(KUserNameLocalName,"username"); |
|
203 |
|
204 } |
|
205 |
|
206 #endif // CONSPLUGIN_H |
|
207 |