Revision: 201021 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 10:53:28 +0300
branchRCL_3
changeset 22 56092bff76ba
parent 20 32ab7ae9ec94
child 30 b72ea8487adb
Revision: 201021 Kit: 2010123
webservices/idwsfplugin/group/senidwsfplugin.mmp
webservices/wscore/src/sencoreservicemanager.cpp
webservices/wsoviplugin/inc/wsovicons.h
webservices/wsoviplugin/inc/wsoviservicesession.h
webservices/wsoviplugin/inc/wsovitokencreationresponse.h
webservices/wsoviplugin/src/wsovioauthclient.cpp
webservices/wsoviplugin/src/wsoviservicesession.cpp
webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp
webservices/wsoviplugin/src/wsovisessioncontext.cpp
webservices/wsoviplugin/src/wsovitokencreationresponse.cpp
--- a/webservices/idwsfplugin/group/senidwsfplugin.mmp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/idwsfplugin/group/senidwsfplugin.mmp	Wed Jun 09 10:53:28 2010 +0300
@@ -35,7 +35,8 @@
 UID 0x10009D8D 0x101F972F
 #endif
 
-paged
+PAGEDDATA
+PAGEDCODE
 //For enabling bytepair compression for code paging
 
 #ifdef EKA2
--- a/webservices/wscore/src/sencoreservicemanager.cpp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wscore/src/sencoreservicemanager.cpp	Wed Jun 09 10:53:28 2010 +0300
@@ -379,7 +379,7 @@
             error = additions;
             additions = 0;
             }
-        CSLOG_FORMAT((aConsumer.ConnectionId(), KNormalLogLevel , _L8(" - Just added %d service description(s)."), additions));
+        CSLOG_FORMAT((aConsumer.ConnectionId(), KMinLogLevel , _L8(" - Just added %d service description(s)."), additions));
         if ( error )
             {
             retVal = error;
--- a/webservices/wsoviplugin/inc/wsovicons.h	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/inc/wsovicons.h	Wed Jun 09 10:53:28 2010 +0300
@@ -164,6 +164,7 @@
     
     _LIT8(KTTL,"TTL");
     _LIT8(KTokenCreationTime,"TokenCreationTime");
+    _LIT8(KTokenValidUntilTime,"TokenValidUntil");
     _LIT8( KTokenSecret, "TokenSecret");
     _LIT8( KToken, "Token");
     _LIT8(KOnlySharing,       "OnlySharing");
@@ -191,6 +192,7 @@
 	_LIT8(KTokenCreationResponseLocalName, "tokenCreationResponse");
 	_LIT8(KTokenSecretLocalName, "tokenSecret");
 	_LIT8(KTTLLocalName, "ttl");
+	_LIT8(KExpiresLocalName, "expires");
 	_LIT8(KTokenInfoLocalName,"tokenInfo");
     _LIT8(KErrorNode,                    "error");
     _LIT8(KErrorCode,                    "errorCode");
--- a/webservices/wsoviplugin/inc/wsoviservicesession.h	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/inc/wsoviservicesession.h	Wed Jun 09 10:53:28 2010 +0300
@@ -50,6 +50,9 @@
     _LIT8(KTokenCreationTimeTag,         "<TokenCreationTime>");
     _LIT8(KTokenCreationTimeEndTag,      "</TokenCreationTime>");
     _LIT8(KTokenCreationTimeLocalName,   "TokenCreationTime");
+    _LIT8(KTokenValidUntilTimeTag,         "<ValidUntil>");
+    _LIT8(KTokenValidUntilTimeEndTag,      "</ValidUntil>");
+    _LIT8(KTokenValidUntilTimeLocalName,   "ValidUntil");
     _LIT8(KTTLTag,                 		 "<TTL>");
     _LIT8(KTTLEndTag,                    "</TTL>");
     _LIT8(KTTLLocalName,                 "TTL");
--- a/webservices/wsoviplugin/inc/wsovitokencreationresponse.h	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/inc/wsovitokencreationresponse.h	Wed Jun 09 10:53:28 2010 +0300
@@ -74,6 +74,12 @@
 TPtrC8 TTL();
 
 /**
+* Getter for validUntil
+* @return validUntil
+*/
+TPtrC8 ValidUntil();
+
+/**
 * Getter for username
 * @return username
 */
@@ -104,7 +110,7 @@
 	HBufC8* iTTL;
 	HBufC8* iUsername;
 	TBool iIsTokenUpdate;
-
+	HBufC8* iValidUntil;
 };
 
 #endif /*WSOVITOKENCREATIONRESPONSE_H_*/
--- a/webservices/wsoviplugin/src/wsovioauthclient.cpp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/src/wsovioauthclient.cpp	Wed Jun 09 10:53:28 2010 +0300
@@ -40,6 +40,7 @@
 #include "wsovitokencreationresponse.h"
 #include "sencryptoutils.h"
 #include "wsoviutils.h"
+#include <SenDateUtils.h>
 
 namespace 
     {
@@ -530,7 +531,22 @@
 	    else
 	        {
 	        iWSOviServiceSession->SetTrustAnchorL(iIdentityProvider->ProviderID());
-	            TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"CWSOviOAuthClient::ValidateL - set ctx basing on response");
+	        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"CWSOviOAuthClient::ValidateL - set ctx basing on response");
+	        
+		    TPtrC8 validUntil = responseFragment->ValidUntil();
+		    if (validUntil.Length())
+		        {
+		        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,validUntil);
+		        User::LeaveIfError(iWSOviServiceSession->SessionContext()->Update(WSOviContextKeys::KTokenValidUntilTime,validUntil));
+		        }
+			else
+				{
+				TTime tmpValidUntil = Time::MaxTTime();
+				TBuf8<SenDateUtils::KXmlDateTimeMaxLength> pValidUntil;
+				SenDateUtils::ToXmlDateTimeUtf8L(pValidUntil, tmpValidUntil);
+		        User::LeaveIfError(iWSOviServiceSession->SessionContext()->Update(WSOviContextKeys::KTokenValidUntilTime,pValidUntil));				
+				}	
+	        
 	        retVal = iWSOviServiceSession->SessionContext()->SetTokenKeysL(token);
 	        if (retVal)
 	            {
--- a/webservices/wsoviplugin/src/wsoviservicesession.cpp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/src/wsoviservicesession.cpp	Wed Jun 09 10:53:28 2010 +0300
@@ -553,12 +553,27 @@
         const TDesC8* message = iOutContext->GetDesC8L(WSOviContextKeys::KMessageBody);
         if (message)
             {
+	        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("CWSOviServiceSession::SubmitL() - Request"));
+	        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("********************************************"));
+	        TLSLOG_ALL(KSenClientSessionLogChannelBase+aConsumer.ConnectionId()  , KMaxLogLevel , *message);
+	        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("********************************************"));
+                    
             retVal = transport.SubmitL(Endpoint(), *message, *utfTP, aResponse, aConsumer);
             }
         else
             {
+	        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("CWSOviServiceSession::SubmitL() - Request"));
+	        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("********************************************"));
+	        TLSLOG_ALL(KSenClientSessionLogChannelBase+aConsumer.ConnectionId()  , KMaxLogLevel , aMessage);
+	        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("********************************************"));            	
+            	
             retVal = transport.SubmitL(Endpoint(), aMessage, *utfTP, aResponse, aConsumer);
-            }   
+            }
+               
+        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("CWSOviServiceSession::SubmitL() - Response"));
+        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("********************************************"));
+        TLSLOG_ALL(KSenClientSessionLogChannelBase+aConsumer.ConnectionId()  , KMaxLogLevel , *aResponse);
+        TLSLOG(KSenClientSessionLogChannelBase+aConsumer.ConnectionId(), KMinLogLevel, _L8("********************************************"));
         
         MSenProperties& prop = transport.PropertiesL();
         ((CWSOviPlugin&)iFramework).ProcessInboundDispatchL(this, retVal, aResponse, &prop );
@@ -851,6 +866,11 @@
                     {
                     User::LeaveIfError(iSessionContext->Add(WSOviContextKeys::KTokenCreationTime, pElement->Content()));    
                     }
+                pElement = xmlSdAsElement.Element(WSOviSession::KTokenValidUntilTimeLocalName);
+                if(pElement)
+                    {
+                    User::LeaveIfError(iSessionContext->Add(WSOviContextKeys::KTokenValidUntilTime, pElement->Content()));    
+                    }                    
                 pElement = xmlSdAsElement.Element(WSOviSession::KTTLLocalName);
                 if(pElement)
                     {
@@ -887,6 +907,11 @@
                 {
                 User::LeaveIfError(iSessionContext->Add(WSOviContextKeys::KTokenCreationTime, value));    
                 }
+            retVal = properties.PropertyL(WSOviSession::KTokenValidUntilTimeLocalName, value);
+            if ( retVal == KErrNone )
+                {
+                User::LeaveIfError(iSessionContext->Add(WSOviContextKeys::KTokenValidUntilTime, value));    
+                }               
             retVal = properties.PropertyL(WSOviSession::KTTLLocalName, value);
             if ( retVal == KErrNone )
                 {
@@ -924,7 +949,12 @@
             if ( pValue )
                 {
                 properties.SetPropertyL(WSOviSession::KTokenCreationTimeLocalName(), *pValue);
-                }        
+                }
+            pValue = iSessionContext->GetDesC8L(WSOviContextKeys::KTokenValidUntilTime);
+            if ( pValue )
+                {
+                properties.SetPropertyL(WSOviSession::KTokenValidUntilTimeLocalName(), *pValue);
+                }            
             pValue = iSessionContext->GetDesC8L(WSOviContextKeys::KTTL);
             if ( pValue )
                 {
@@ -971,6 +1001,13 @@
                 aWriteStream.WriteL(*value);
                 aWriteStream.WriteL(WSOviSession::KTokenCreationTimeEndTag);
                 }
+            value = iSessionContext->GetDesC8L(WSOviContextKeys::KTokenValidUntilTime);
+            if (value)
+                {
+                aWriteStream.WriteL(WSOviSession::KTokenValidUntilTimeTag);
+                aWriteStream.WriteL(*value);
+                aWriteStream.WriteL(WSOviSession::KTokenValidUntilTimeEndTag);
+                }                
             value = iSessionContext->GetDesC8L(WSOviContextKeys::KTTL);
             if (value)
                 {
@@ -1374,6 +1411,7 @@
         {
         iSessionContext->Remove(WSOviContextKeys::KToken);    
         iSessionContext->Remove(WSOviContextKeys::KTokenCreationTime);
+        iSessionContext->Remove(WSOviContextKeys::KTokenValidUntilTime);
         iSessionContext->Remove(WSOviContextKeys::KTTL);
         iSessionContext->Remove(WSOviContextKeys::KTokenSecret);
         }
--- a/webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/src/wsoviserviceupdatehandler.cpp	Wed Jun 09 10:53:28 2010 +0300
@@ -32,6 +32,8 @@
 #include <httpstd.h>
 #include <SenHttpTransportProperties.h>
 #include "senlayeredhttptransportproperties.h"
+#include <SenDateUtils.h>
+
 using namespace OAuth;
 
 
@@ -217,6 +219,20 @@
                         }
                     else
                         {
+					    TPtrC8 validUntil = responseFragment->ValidUntil();
+					    if (validUntil.Length())
+					        {
+					        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,validUntil);
+					        User::LeaveIfError(pCtx.Update(WSOviContextKeys::KTokenValidUntilTime,validUntil));
+					        }
+						else
+							{
+							TTime tmpValidUntil = Time::MaxTTime();
+							TBuf8<SenDateUtils::KXmlDateTimeMaxLength> pValidUntil;
+							SenDateUtils::ToXmlDateTimeUtf8L(pValidUntil, tmpValidUntil);
+					        User::LeaveIfError(pCtx.Update(WSOviContextKeys::KTokenValidUntilTime,pValidUntil));
+							}
+                       
                         pCtx.SetTokenKeysL(token);
                         }
                     }
--- a/webservices/wsoviplugin/src/wsovisessioncontext.cpp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/src/wsovisessioncontext.cpp	Wed Jun 09 10:53:28 2010 +0300
@@ -379,6 +379,12 @@
         error = aWSOviSessionCtxDst->Update(KTokenCreationTime, *desc);
         if (error) return error;
         }
+    desc = GetDesC8L(KTokenValidUntilTime);
+    if (desc)
+        {
+        error = aWSOviSessionCtxDst->Update(KTokenValidUntilTime, *desc);
+        if (error) return error;
+        }
     desc = GetDesC8L(KTTL);
     if (desc)
         {
--- a/webservices/wsoviplugin/src/wsovitokencreationresponse.cpp	Tue May 25 13:53:20 2010 +0300
+++ b/webservices/wsoviplugin/src/wsovitokencreationresponse.cpp	Wed Jun 09 10:53:28 2010 +0300
@@ -45,8 +45,7 @@
 // Second phase construction.
 void CWSOviTokenCreationResponse::ConstructL()
     {
-        CSenBaseFragment::BaseConstructL(TPtrC8(NULL,0),
-        		KTokenCreationResponseLocalName);
+    CSenBaseFragment::BaseConstructL(TPtrC8(NULL,0), KTokenCreationResponseLocalName);
     }
 
 void CWSOviTokenCreationResponse::StartElementL(const TDesC8& /*aNsUri*/,
@@ -78,14 +77,18 @@
         		{
         		iState = KStateSave;
         		}
-            else if (aLocalName == KTokenLocalName)
-                {
-                iState = KStateSave;
-                }
-        	else if (aLocalName == KTTLLocalName)
-        		{
-        		iState = KStateSave;
-        		}
+          else if (aLocalName == KTokenLocalName)
+              {
+              iState = KStateSave;
+              }
+          else if (aLocalName == KTTLLocalName)
+	          {
+	      	  iState = KStateSave;
+	          }
+          else if (aLocalName == KExpiresLocalName)
+              {
+              iState = KStateSave;
+              }        	
         	break;
         	}
         case KStateParsingUserInfo:
@@ -154,6 +157,21 @@
                 ResetContentL();
                 iState = KStateParsingTokenInfo;
                 }
+            else if (aLocalName == KExpiresLocalName)
+                {
+                if(iValidUntil)
+                	{
+                	delete iValidUntil;
+                	iValidUntil = NULL;
+                	}
+                TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"WSOviTokenCreationResponse::expires parsing");
+                TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("iValidUntil : %S"), &content));
+                
+                iValidUntil = content.AllocL();
+                
+                ResetContentL();
+                iState = KStateParsingTokenInfo;
+                }            
             else if ( aLocalName == KUserNameLocalName)
                 {
                 if (iUsername)
@@ -202,6 +220,7 @@
 	delete iTokenSecret;
 	delete iTTL;
 	delete iUsername;
+	delete iValidUntil;
 	}
 
 TPtrC8 CWSOviTokenCreationResponse::Token()
@@ -240,6 +259,18 @@
         }
     }
 
+TPtrC8 CWSOviTokenCreationResponse::ValidUntil()
+    {
+    if (iValidUntil)
+        {
+        return *iValidUntil;    
+        }
+    else 
+        {
+        return KNullDesC8();
+        }    	
+    }
+
 TPtrC8 CWSOviTokenCreationResponse::Username()
     {
     if (iUsername)