Exemplo n.º 1
0
    def __resolveQueueRequestByLocalConfig(target_url, queueit_token,
                                           queue_config, customer_id,
                                           secret_key, http_context_provider,
                                           debug_entries, is_debug):
        if is_debug:
            debug_entries["SdkVersion"] = UserInQueueService.SDK_VERSION
            debug_entries["Connector"] = http_context_provider.getProviderName(
            )
            debug_entries["Runtime"] = KnownUser.__getRunTime()
            debug_entries["TargetUrl"] = target_url
            debug_entries["QueueitToken"] = queueit_token
            debug_entries[
                "OriginalUrl"] = http_context_provider.getOriginalRequestUrl()
            if queue_config is None:
                debug_entries["QueueConfig"] = "NULL"
            else:
                debug_entries["QueueConfig"] = queue_config.toString()
            KnownUser.__logMoreRequestDetails(debug_entries,
                                              http_context_provider)

        if Utils.isNilOrEmpty(customer_id):
            raise KnownUserError("customerId can not be none or empty.")

        if Utils.isNilOrEmpty(secret_key):
            raise KnownUserError("secretKey can not be none or empty.")

        if queue_config is None:
            raise KnownUserError("queueConfig can not be none.")

        if Utils.isNilOrEmpty(queue_config.eventId):
            raise KnownUserError(
                "queueConfig.eventId can not be none or empty.")

        if Utils.isNilOrEmpty(queue_config.queueDomain):
            raise KnownUserError(
                "queueConfig.queueDomain can not be none or empty.")

        minutes = QueueitHelpers.convertToInt(
            queue_config.cookieValidityMinute)
        if minutes <= 0:
            raise KnownUserError(
                "queueConfig.cookieValidityMinute should be integer greater than 0."
            )

        if not isinstance(queue_config.extendCookieValidity, bool):
            raise KnownUserError(
                "queueConfig.extendCookieValidity should be valid boolean.")

        user_in_queue_service = KnownUser.__getUserInQueueService(
            http_context_provider)
        result = user_in_queue_service.validateQueueRequest(
            target_url, queueit_token, queue_config, customer_id, secret_key)
        result.isAjaxResult = KnownUser.__isQueueAjaxCall(
            http_context_provider)
        return result
Exemplo n.º 2
0
    def __resolveQueueRequestByLocalConfig(targetUrl, queueitToken,
                                           queueConfig, customerId, secretKey,
                                           httpContextProvider, debugEntries):
        isDebug = KnownUser.__getIsDebug(queueitToken, secretKey)
        if (isDebug):
            debugEntries["TargetUrl"] = targetUrl
            debugEntries["QueueitToken"] = queueitToken
            debugEntries[
                "OriginalUrl"] = httpContextProvider.getOriginalRequestUrl()
            if (queueConfig == None):
                debugEntries["QueueConfig"] = "NULL"
            else:
                debugEntries["QueueConfig"] = queueConfig.toString()
            KnownUser.__logMoreRequestDetails(debugEntries,
                                              httpContextProvider)

        if (Utils.isNilOrEmpty(customerId)):
            raise KnownUserError("customerId can not be none or empty.")

        if (Utils.isNilOrEmpty(secretKey)):
            raise KnownUserError("secretKey can not be none or empty.")

        if (queueConfig == None):
            raise KnownUserError("queueConfig can not be none.")

        if (Utils.isNilOrEmpty(queueConfig.eventId)):
            raise KnownUserError(
                "queueConfig.eventId can not be none or empty.")

        if (Utils.isNilOrEmpty(queueConfig.queueDomain)):
            raise KnownUserError(
                "queueConfig.queueDomain can not be none or empty.")

        minutes = QueueitHelpers.convertToInt(queueConfig.cookieValidityMinute)
        if (minutes <= 0):
            raise KnownUserError(
                "queueConfig.cookieValidityMinute should be integer greater than 0."
            )

        if (queueConfig.extendCookieValidity != True
                and queueConfig.extendCookieValidity != False):
            raise KnownUserError(
                "queueConfig.extendCookieValidity should be valid boolean.")

        userInQueueService = KnownUser.__getUserInQueueService(
            httpContextProvider)
        result = userInQueueService.validateQueueRequest(
            targetUrl, queueitToken, queueConfig, customerId, secretKey)
        result.isAjaxResult = KnownUser.__isQueueAjaxCall(httpContextProvider)
        return result
Exemplo n.º 3
0
    def extendQueueCookie(eventId, cookieValidityMinute, cookieDomain,
                          secretKey, httpContextProvider):
        if (Utils.isNilOrEmpty(eventId)):
            raise KnownUserError("eventId can not be none or empty.")

        if (Utils.isNilOrEmpty(secretKey)):
            raise KnownUserError("secretKey can not be none or empty.")

        minutes = QueueitHelpers.convertToInt(cookieValidityMinute)
        if (minutes <= 0):
            raise KnownUserError(
                "cookieValidityMinute should be integer greater than 0.")

        userInQueueService = KnownUser.__getUserInQueueService(
            httpContextProvider)
        userInQueueService.extendQueueCookie(eventId, cookieValidityMinute,
                                             cookieDomain, secretKey)
Exemplo n.º 4
0
    def extendQueueCookie(event_id, cookie_validity_minute, cookie_domain,
                          is_cookie_http_only, is_cookie_secure, secret_key,
                          http_context_provider):
        if Utils.isNilOrEmpty(event_id):
            raise KnownUserError("eventId can not be none or empty.")

        if Utils.isNilOrEmpty(secret_key):
            raise KnownUserError("secretKey can not be none or empty.")

        minutes = QueueitHelpers.convertToInt(cookie_validity_minute)
        if minutes <= 0:
            raise KnownUserError(
                "cookieValidityMinute should be integer greater than 0.")

        user_in_queue_service = KnownUser.__getUserInQueueService(
            http_context_provider)

        user_in_queue_service.extendQueueCookie(event_id,
                                                cookie_validity_minute,
                                                cookie_domain,
                                                is_cookie_http_only,
                                                is_cookie_secure, secret_key)