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); |
|
235 if ( authenticationInfoPromptedFromUser ) |
234 if ( authenticationInfoPromptedFromUser ) |
236 { |
235 { |
237 TLSLOG_L(KSenCoreServiceManagerLogChannelBase , KMinLogLevel," --- Setting username/password from authenticationInfoPromptedFromUser"); |
|
238 userName.Set(authInfo().iUsername); |
236 userName.Set(authInfo().iUsername); |
239 password.Set(authInfo().iPassword); |
237 password.Set(authInfo().iPassword); |
240 } |
238 } |
241 else |
239 else |
242 { |
240 { |
243 TLSLOG_L(KSenCoreServiceManagerLogChannelBase , KMinLogLevel," --- Setting username/password from IDP"); |
|
244 userName.Set(iIdentityProvider->UserName()); |
241 userName.Set(iIdentityProvider->UserName()); |
245 password.Set(iIdentityProvider->Password()); |
242 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 }*/ |
|
261 } |
243 } |
262 HBufC8* created(NULL); |
244 HBufC8* created(NULL); |
263 //CWSOviSessionContext* sessioncontext = iWSOviServiceSession->SessionContext(); |
245 //CWSOviSessionContext* sessioncontext = iWSOviServiceSession->SessionContext(); |
264 const TInt* diffHandlerContext = iHndCtx->GetIntL(HandlerContextKey::KDiff); |
246 const TInt* diffHandlerContext = iHndCtx->GetIntL(HandlerContextKey::KDiff); |
265 if( diffHandlerContext && *diffHandlerContext > 0 ) |
247 if( diffHandlerContext && *diffHandlerContext > 0 ) |
389 TTimeIntervalMinutes minutes(*diffContext); |
370 TTimeIntervalMinutes minutes(*diffContext); |
390 TTime diff = time-minutes; |
371 TTime diff = time-minutes; |
391 time -= TTimeIntervalMicroSeconds(diff.Int64()); |
372 time -= TTimeIntervalMicroSeconds(diff.Int64()); |
392 HBufC8* created = SenCryptoUtils::GetTimestampL(time); |
373 HBufC8* created = SenCryptoUtils::GetTimestampL(time); |
393 CleanupStack::PushL(created); |
374 CleanupStack::PushL(created); |
394 |
|
395 CreateBodyL(*version, |
375 CreateBodyL(*version, |
396 userName, |
376 userName, |
397 password, |
377 password, |
398 *created/*, |
378 *created); |
399 validator*/); |
|
400 CleanupStack::PopAndDestroy(created); |
379 CleanupStack::PopAndDestroy(created); |
401 retVal = iAuthSession->SubmitL(*iBody, *transPropAsXml, *this, response); |
380 retVal = iAuthSession->SubmitL(*iBody, *transPropAsXml, *this, response); |
402 aSession.SetTransportL(ipTransport);//ownership moved |
381 aSession.SetTransportL(ipTransport);//ownership moved |
403 ipTransport = NULL; |
382 ipTransport = NULL; |
404 } |
383 } |
752 } |
731 } |
753 } |
732 } |
754 return retVal; |
733 return retVal; |
755 } |
734 } |
756 |
735 |
757 void CWSOviOAuthClient::CreateBodyL(const TDesC8& aXmlNs, const TDesC8& aUsername, const TDesC8& aPassword, const TDesC8& aCreated, const TDesC8& aValidator) |
736 void CWSOviOAuthClient::CreateBodyL(const TDesC8& aXmlNs, const TDesC8& aUsername, const TDesC8& aPassword, const TDesC8& aCreated) |
758 { |
737 { |
759 if(aPassword == KNullDesC8()) |
738 if(aPassword == KNullDesC8()) |
760 { |
739 { |
761 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviOAuthClient::CreateBodyL() - aPassword == KNullDesC8"))); |
740 TLSLOG(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,(_L("CWSOviOAuthClient::CreateBodyL() - aPassword == KNullDesC8"))); |
762 } |
741 } |
763 delete iBody; |
742 delete iBody; |
764 iBody = NULL; |
743 iBody = NULL; |
765 HBufC8* nonce = SenCryptoUtils::GetRandomNonceL(); |
744 HBufC8* nonce = SenCryptoUtils::GetRandomNonceL(); |
766 CleanupStack::PushL(nonce); |
745 CleanupStack::PushL(nonce); |
767 HBufC8* passDec = SenXmlUtils::DecodeHttpCharactersLC( aPassword ); |
746 HBufC8* passDec = SenXmlUtils::DecodeHttpCharactersLC( aPassword ); |
768 HBufC8* digest = CWSOviUtils::DigestAuthStringL(*nonce, aCreated, aUsername, *passDec, aValidator); |
747 HBufC8* digest = CWSOviUtils::DigestAuthStringL(*nonce, aCreated, aUsername, *passDec); |
769 |
|
770 CleanupStack::PopAndDestroy(passDec); |
748 CleanupStack::PopAndDestroy(passDec); |
771 CleanupStack::PushL(digest); |
749 CleanupStack::PushL(digest); |
772 |
750 |
773 iBody = HBufC8::NewL(KCreationRequestFormat8().Length() |
751 iBody = HBufC8::NewL(KCreationRequestFormat8().Length() |
774 + aXmlNs.Length() |
752 + aXmlNs.Length() |