229 TTime time; |
229 TTime time; |
230 time.UniversalTime(); |
230 time.UniversalTime(); |
231 |
231 |
232 TPtrC8 userName(KNullDesC8); |
232 TPtrC8 userName(KNullDesC8); |
233 TPtrC8 password(KNullDesC8); |
233 TPtrC8 password(KNullDesC8); |
|
234 TPtrC8 validator(KNullDesC8); |
234 if ( authenticationInfoPromptedFromUser ) |
235 if ( authenticationInfoPromptedFromUser ) |
235 { |
236 { |
|
237 TLSLOG_L(KSenCoreServiceManagerLogChannelBase , KMinLogLevel," --- Setting username/password from authenticationInfoPromptedFromUser"); |
236 userName.Set(authInfo().iUsername); |
238 userName.Set(authInfo().iUsername); |
237 password.Set(authInfo().iPassword); |
239 password.Set(authInfo().iPassword); |
238 } |
240 } |
239 else |
241 else |
240 { |
242 { |
|
243 TLSLOG_L(KSenCoreServiceManagerLogChannelBase , KMinLogLevel," --- Setting username/password from IDP"); |
241 userName.Set(iIdentityProvider->UserName()); |
244 userName.Set(iIdentityProvider->UserName()); |
242 password.Set(iIdentityProvider->Password()); |
245 password.Set(iIdentityProvider->Password()); |
|
246 |
|
247 /* Below code will be required when we need to get validator from IDP but Now Crashes */ |
|
248 /*CSenElement* validatorTag(NULL); |
|
249 if (iIdentityProvider->FrameworkId() == KDefaultOviFrameworkID) |
|
250 { |
|
251 CSenElement* el( NULL ); |
|
252 iIdentityProvider->AccountExtensions( el ); |
|
253 if (el) |
|
254 { |
|
255 _LIT8(KWSAccAttrAccountValidator, "Validator"); |
|
256 validatorTag = el->Element(KWSAccAttrAccountValidator); |
|
257 validator.Set(validatorTag->Content()); |
|
258 TLSLOG_L(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,"CWSOviOAuthClient::ValidateL() - NCIM Valiadtor read successfully"); |
|
259 } |
|
260 }*/ |
243 } |
261 } |
244 HBufC8* created(NULL); |
262 HBufC8* created(NULL); |
245 //CWSOviSessionContext* sessioncontext = iWSOviServiceSession->SessionContext(); |
263 //CWSOviSessionContext* sessioncontext = iWSOviServiceSession->SessionContext(); |
246 const TInt* diffHandlerContext = iHndCtx->GetIntL(HandlerContextKey::KDiff); |
264 const TInt* diffHandlerContext = iHndCtx->GetIntL(HandlerContextKey::KDiff); |
247 if( diffHandlerContext && *diffHandlerContext > 0 ) |
265 if( diffHandlerContext && *diffHandlerContext > 0 ) |
370 TTimeIntervalMinutes minutes(*diffContext); |
389 TTimeIntervalMinutes minutes(*diffContext); |
371 TTime diff = time-minutes; |
390 TTime diff = time-minutes; |
372 time -= TTimeIntervalMicroSeconds(diff.Int64()); |
391 time -= TTimeIntervalMicroSeconds(diff.Int64()); |
373 HBufC8* created = SenCryptoUtils::GetTimestampL(time); |
392 HBufC8* created = SenCryptoUtils::GetTimestampL(time); |
374 CleanupStack::PushL(created); |
393 CleanupStack::PushL(created); |
|
394 |
375 CreateBodyL(*version, |
395 CreateBodyL(*version, |
376 userName, |
396 userName, |
377 password, |
397 password, |
378 *created); |
398 *created/*, |
|
399 validator*/); |
379 CleanupStack::PopAndDestroy(created); |
400 CleanupStack::PopAndDestroy(created); |
380 retVal = iAuthSession->SubmitL(*iBody, *transPropAsXml, *this, response); |
401 retVal = iAuthSession->SubmitL(*iBody, *transPropAsXml, *this, response); |
381 aSession.SetTransportL(ipTransport);//ownership moved |
402 aSession.SetTransportL(ipTransport);//ownership moved |
382 ipTransport = NULL; |
403 ipTransport = NULL; |
383 } |
404 } |
731 } |
752 } |
732 } |
753 } |
733 return retVal; |
754 return retVal; |
734 } |
755 } |
735 |
756 |
736 void CWSOviOAuthClient::CreateBodyL(const TDesC8& aXmlNs, const TDesC8& aUsername, const TDesC8& aPassword, const TDesC8& aCreated) |
757 void CWSOviOAuthClient::CreateBodyL(const TDesC8& aXmlNs, const TDesC8& aUsername, const TDesC8& aPassword, const TDesC8& aCreated, const TDesC8& aValidator) |
737 { |
758 { |
738 if(aPassword == KNullDesC8()) |
759 if(aPassword == KNullDesC8()) |
739 { |
760 { |
740 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviOAuthClient::CreateBodyL() - aPassword == KNullDesC8"))); |
761 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviOAuthClient::CreateBodyL() - aPassword == KNullDesC8"))); |
741 } |
762 } |
742 delete iBody; |
763 delete iBody; |
743 iBody = NULL; |
764 iBody = NULL; |
744 HBufC8* nonce = SenCryptoUtils::GetRandomNonceL(); |
765 HBufC8* nonce = SenCryptoUtils::GetRandomNonceL(); |
745 CleanupStack::PushL(nonce); |
766 CleanupStack::PushL(nonce); |
746 HBufC8* passDec = SenXmlUtils::DecodeHttpCharactersLC( aPassword ); |
767 HBufC8* passDec = SenXmlUtils::DecodeHttpCharactersLC( aPassword ); |
747 HBufC8* digest = CWSOviUtils::DigestAuthStringL(*nonce, aCreated, aUsername, *passDec); |
768 HBufC8* digest = CWSOviUtils::DigestAuthStringL(*nonce, aCreated, aUsername, *passDec, aValidator); |
|
769 |
748 CleanupStack::PopAndDestroy(passDec); |
770 CleanupStack::PopAndDestroy(passDec); |
749 CleanupStack::PushL(digest); |
771 CleanupStack::PushL(digest); |
750 |
772 |
751 iBody = HBufC8::NewL(KCreationRequestFormat8().Length() |
773 iBody = HBufC8::NewL(KCreationRequestFormat8().Length() |
752 + aXmlNs.Length() |
774 + aXmlNs.Length() |