1010
1111class KnownUser
1212{
13- const QueueITAjaxHeaderKey = "x-queueit-ajaxpageurl " ;
13+ const QueueITAjaxHeaderKey = "x-queueit-ajaxpageurl " ;
1414
1515 //used for unittest
1616 private static $ userInQueueService = null ;
@@ -22,6 +22,10 @@ private static function getUserInQueueService()
2222 return KnownUser::$ userInQueueService ;
2323 }
2424
25+ public static function setHttpRequestProvider (IHttpRequestProvider $ customHttpRequestProvider ){
26+ KnownUser::$ httpRequestProvider = $ customHttpRequestProvider ;
27+ }
28+
2529 //used for unittest
2630 private static $ httpRequestProvider = null ;
2731 private static function getHttpRequestProvider ()
@@ -33,7 +37,7 @@ private static function getHttpRequestProvider()
3337 }
3438
3539 private static $ debugInfoArray = null ;
36- public static function extendQueueCookie ($ eventId , $ cookieValidityMinute , $ cookieDomain , $ secretKey )
40+ public static function extendQueueCookie ($ eventId , $ cookieValidityMinute , $ cookieDomain , $ isCookieHttpOnly , $ isCookieSecure , $ secretKey )
3741 {
3842 if (empty ($ eventId )) {
3943 throw new KnownUserException ("eventId can not be null or empty. " );
@@ -45,7 +49,7 @@ public static function extendQueueCookie($eventId, $cookieValidityMinute, $cooki
4549 throw new KnownUserException ("cookieValidityMinute should be integer greater than 0. " );
4650 }
4751 $ userInQueueService = KnownUser::getUserInQueueService ();
48- $ userInQueueService ->extendQueueCookie ($ eventId , $ cookieValidityMinute , $ cookieDomain , $ secretKey );
52+ $ userInQueueService ->extendQueueCookie ($ eventId , $ cookieValidityMinute , $ cookieDomain , $ isCookieHttpOnly , $ isCookieSecure , $ secretKey );
4953 }
5054
5155 private static function _cancelRequestByLocalConfig (
@@ -107,7 +111,7 @@ public static function cancelRequestByLocalConfig(
107111 }
108112
109113 try {
110- $ result = KnownUser::_cancelRequestByLocalConfig ($ targetUrl ,$ queueitToken ,$ cancelConfig ,$ customerId ,$ secretKey ,$ connectorDiagnostics ->isEnabled );
114+ $ result = KnownUser::_cancelRequestByLocalConfig ($ targetUrl , $ queueitToken , $ cancelConfig , $ customerId , $ secretKey , $ connectorDiagnostics ->isEnabled );
111115 KnownUser::sendDebugCookie ();
112116 return $ result ;
113117 } catch (\Exception $ e ) {
@@ -217,14 +221,14 @@ public static function validateRequestByIntegrationConfig($currentUrlWithoutQueu
217221 public static function resolveQueueRequestByLocalConfig ($ targetUrl , $ queueitToken , QueueEventConfig $ queueConfig , $ customerId , $ secretKey )
218222 {
219223 $ connectorDiagnostics = ConnectorDiagnostics::verify ($ customerId , $ secretKey , $ queueitToken );
220-
224+
221225 if ($ connectorDiagnostics ->hasError ) {
222226 return $ connectorDiagnostics ->validationResult ;
223227 }
224228
225229 try {
226230 $ targetUrl = KnownUser::generateTargetUrl ($ targetUrl );
227- $ result = KnownUser::_resolveQueueRequestByLocalConfig ($ targetUrl , $ queueitToken , $ queueConfig , $ customerId , $ secretKey ,$ connectorDiagnostics ->isEnabled );
231+ $ result = KnownUser::_resolveQueueRequestByLocalConfig ($ targetUrl , $ queueitToken , $ queueConfig , $ customerId , $ secretKey , $ connectorDiagnostics ->isEnabled );
228232 KnownUser::sendDebugCookie ();
229233 return $ result ;
230234 } catch (\Exception $ e ) {
@@ -291,12 +295,14 @@ private static function handleQueueAction(
291295 $ eventConfig = new QueueEventConfig ();
292296 $ targetUrl = "" ;
293297 $ eventConfig ->eventId = $ matchedConfig ["EventId " ];
294- $ eventConfig ->queueDomain = $ matchedConfig ["QueueDomain " ];
295298 $ eventConfig ->layoutName = $ matchedConfig ["LayoutName " ];
296299 $ eventConfig ->culture = $ matchedConfig ["Culture " ];
297- $ eventConfig ->cookieDomain = $ matchedConfig ["CookieDomain " ];
300+ $ eventConfig ->queueDomain = $ matchedConfig ["QueueDomain " ];
298301 $ eventConfig ->extendCookieValidity = $ matchedConfig ["ExtendCookieValidity " ];
299302 $ eventConfig ->cookieValidityMinute = $ matchedConfig ["CookieValidityMinute " ];
303+ $ eventConfig ->cookieDomain = $ matchedConfig ["CookieDomain " ];
304+ $ eventConfig ->isCookieHttpOnly = array_key_exists ("IsCookieHttpOnly " , $ matchedConfig ) ? $ matchedConfig ["IsCookieHttpOnly " ] : false ;
305+ $ eventConfig ->isCookieSecure = array_key_exists ("IsCookieSecure " , $ matchedConfig ) ? $ matchedConfig ["IsCookieSecure " ] : false ;
300306 $ eventConfig ->version = $ customerIntegration ["Version " ];
301307 $ eventConfig ->actionName = $ matchedConfig ["Name " ];
302308
@@ -325,10 +331,12 @@ private static function handleCancelAction(
325331 $ isDebug
326332 ) {
327333 $ cancelEventConfig = new CancelEventConfig ();
328- $ cancelEventConfig ->eventId = $ matchedConfig ["EventId " ];
329334 $ cancelEventConfig ->queueDomain = $ matchedConfig ["QueueDomain " ];
330- $ cancelEventConfig ->cookieDomain = $ matchedConfig ["CookieDomain " ];
335+ $ cancelEventConfig ->eventId = $ matchedConfig ["EventId " ];
331336 $ cancelEventConfig ->version = $ customerIntegration ["Version " ];
337+ $ cancelEventConfig ->cookieDomain = $ matchedConfig ["CookieDomain " ];
338+ $ cancelEventConfig ->isCookieHttpOnly = array_key_exists ("IsCookieHttpOnly " , $ matchedConfig ) ? $ matchedConfig ["IsCookieHttpOnly " ] : false ;
339+ $ cancelEventConfig ->isCookieSecure = array_key_exists ("IsCookieSecure " , $ matchedConfig ) ? $ matchedConfig ["IsCookieSecure " ] : false ;
332340 $ cancelEventConfig ->actionName = $ matchedConfig ["Name " ];
333341
334342 return KnownUser::_cancelRequestByLocalConfig ($ currentUrlWithoutQueueITToken , $ queueitToken , $ cancelEventConfig , $ customerId , $ secretKey , $ isDebug );
@@ -374,7 +382,7 @@ private static function sendDebugCookie()
374382 foreach (KnownUser::$ debugInfoArray as $ key => $ value ) {
375383 array_push ($ cookieNameValues , $ key . '= ' . $ value );
376384 }
377- KnownUser::getHttpRequestProvider ()->getCookieManager ()->setCookie ("queueitdebug " , implode ('| ' , $ cookieNameValues ), 0 , null );
385+ KnownUser::getHttpRequestProvider ()->getCookieManager ()->setCookie ("queueitdebug " , implode ('| ' , $ cookieNameValues ), 0 , null , false , false );
378386 }
379387 }
380388
@@ -413,12 +421,12 @@ public function getCookie($cookieName)
413421 }
414422 }
415423
416- public function setCookie ($ name , $ value , $ expire , $ domain )
424+ public function setCookie ($ name , $ value , $ expire , $ domain, $ isHttpOnly , $ isSecure )
417425 {
418426 if ($ domain == null ) {
419427 $ domain = "" ;
420428 }
421- setcookie ($ name , $ value , $ expire , "/ " , $ domain , false , false );
429+ setcookie ($ name , $ value , $ expire , "/ " , $ domain , $ isSecure , $ isHttpOnly );
422430 }
423431
424432 public function getCookieArray ()
@@ -438,6 +446,7 @@ function getUserHostAddress();
438446 function getCookieManager ();
439447 function getAbsoluteUri ();
440448 function getHeaderArray ();
449+ function getRequestBodyAsString ();
441450}
442451
443452class HttpRequestProvider implements IHttpRequestProvider
@@ -489,6 +498,11 @@ function getHeaderArray()
489498 }
490499 return $ this ->allHeadersLowerCaseKeyArray ;
491500 }
501+
502+ function getRequestBodyAsString ()
503+ {
504+ return '' ;
505+ }
492506}
493507
494508//https://github.com/ralouphie/getallheaders/blob/master/src/getallheaders.php
0 commit comments