Override so we ask the handler if its using cookies (rather than inferring
from the class instance)
189739
protected function usingCookieSessions()
    {
        if (! $this->sessionConfigured()) {
            return false;
        }

        $handler = $this->manager->driver()->getHandler();

        if ($handler instanceof LockingSessionHandler) {
            return $handler->usingCookieSessions();
        }

        return parent::usingCookieSessions();
    }
243539
def _generate_request_handler_proxy(handler_class, handler_args, name):
    """"""

    @scope.inject
    def request_handler_wrapper(app, handler, **kwargs):
        handler = handler_class(app, handler.request, **handler_args)
        handler._execute([], **kwargs)
    request_handler_wrapper.__name__ = name
    request_handler_wrapper.handler_class = handler_class
    request_handler_wrapper.handler_args = handler_args

    return request_handler_wrapper
279437
def extract_cookies(self, response, request):
        """"""
        _debug("extract_cookies: %s", response.info())
        self._cookies_lock.acquire()
        try:
            self._policy._now = self._now = int(time.time())

            for cookie in self.make_cookies(response, request):
                if self._policy.set_ok(cookie, request):
                    _debug(" setting cookie: %s", cookie)
                    self.set_cookie(cookie)
        finally:
            self._cookies_lock.release()
1355213
protected function usingCookieSessions()
    {
        if (! $this->sessionConfigured()) {
            return false;
        }

        $session = $this->manager->driver();

        //
        $handler = $session->getHandler();

        return ($handler instanceof CookieSessionHandler);
    }
1273601
def _get_handler(self, handler_class):
        """"""
        element = None
        for handler in self.handlers:
            if isinstance(handler, handler_class):
                element = handler
                break
        return element
646213
def _wrap_class(request_handler, validator):
    
    METHODS = ['get', 'post', 'put', 'head', 'options', 'delete', 'patch']
    for name in METHODS:
        method = getattr(request_handler, name)
        setattr(request_handler, name, _auth_required(method, validator))

    return request_handler
145712
def _processHandler(self, securityHandler, param_dict):
        """"""
        cj = None
        handler = None
        if securityHandler is None:
            cj = cookiejar.CookieJar()
        elif securityHandler.method.lower() == "token" or \
             securityHandler.method.lower() == "oauth":
            param_dict['token'] = securityHandler.token
            if hasattr(securityHandler, 'cookiejar'):
                cj = securityHandler.cookiejar
            if hasattr(securityHandler, 'handler'):
                handler = securityHandler.handler
        elif securityHandler.method.lower() == "handler":
            handler = securityHandler.handler
            cj = securityHandler.cookiejar
        if len(param_dict) > 0:
            for k,v in param_dict.items():
                if isinstance(v, bool):
                    param_dict[k] = json.dumps(v)
        return param_dict, handler, cj
514472
def assertNotCookie(self, name, value=None, attrs={}, *args, **kwargs):
        
        return not self.assertCookie(name, value, attrs)
492303
def _get_token_from_cookies(self, request, refresh_token):
        
        if refresh_token:
            cookie_token_name_key = "cookie_refresh_token_name"
        else:
            cookie_token_name_key = "cookie_access_token_name"
        cookie_token_name = getattr(self.config, cookie_token_name_key)
        return request.cookies.get(cookie_token_name(), None)
1287520
def set_handler(self, handler):
        
        if self.handler is not None:
            raise Exception('Attempted to overwrite BaseSession handler')

        self.handler = handler
        self.transport_name = self.handler.name

        if self.conn_info is None:
            self.conn_info = handler.get_conn_info()
            self.stats.sessionOpened(self.transport_name)

        return True
671507
function() {

            // We perform the bindings so that every function works
            // properly when it is passed as a callback.
            this.get                = utils.bind(this, this.get);
            this.del                = utils.bind(this, this.del);
            this.post               = utils.bind(this, this.post);
            this.request            = utils.bind(this, this.request);
            this._buildResponse     = utils.bind(this, this._buildResponse);

            // Set our default version to "none"
            this._setSplunkVersion("none");

            // Cookie store for cookie based authentication.
            this._cookieStore = {};
        }
466021
def _after_request(self, response):
        
        # This means that if either the new or the old are False, we set
        # insecure cookies.
        # We don't define OIDC_ID_TOKEN_COOKIE_SECURE in init_app, because we
        # don't want people to find it easily.
        cookie_secure = (current_app.config['OIDC_COOKIE_SECURE'] and
                         current_app.config.get('OIDC_ID_TOKEN_COOKIE_SECURE',
                                                True))

        if getattr(g, 'oidc_id_token_dirty', False):
            if g.oidc_id_token:
                signed_id_token = self.cookie_serializer.dumps(g.oidc_id_token)
                response.set_cookie(
                    current_app.config['OIDC_ID_TOKEN_COOKIE_NAME'],
                    signed_id_token,
                    secure=cookie_secure,
                    httponly=True,
                    max_age=current_app.config['OIDC_ID_TOKEN_COOKIE_TTL'])
            else:
                # This was a log out
                response.set_cookie(
                    current_app.config['OIDC_ID_TOKEN_COOKIE_NAME'],
                    '',
                    path=current_app.config['OIDC_ID_TOKEN_COOKIE_PATH'],
                    secure=cookie_secure,
                    httponly=True,
                    expires=0)
        return response
1305920
protected function _assertCookieRestriction()
    {
        $stat = false;
        if ( php_sapi_name() !== 'cli' ) {
            if ( headers_sent() )
                throw new \Exception('Headers was sent, cookies must be sent before any output from your script.');

            $stat = true;
        }

        if ( false === $stat )
            throw new \Exception('Session Cant Be Initialized.');
    }
718880
def get_cookie(self, *args):
        
        value = self.COOKIES.get(*args)
        sec = self.app.config['securecookie.key']
        dec = cookie_decode(value, sec)
        return dec or value
726209
def _hash_cookies(self):
        ''' 
        '''
        return hash(frozenset([hash(c) for c in sorted([repr(c) for c in self.session.cookies])]))
26128
function Cookie(name, value, attrs){
  if(!(this instanceof Cookie)) 
    return new Cookie(name, value, attrs);
  if(!name)  throw new TypeError('argument name is invalid');

  this.name   = name;
  this.value  = value;

  for (var key in attrs) {
    this[key] = attrs[key];
  }
  return this;
}
440757
def sanitize_http_response_cookies(client, event):
    
    try:
        cookie_string = event["context"]["response"]["headers"]["set-cookie"]
        event["context"]["response"]["headers"]["set-cookie"] = _sanitize_string(cookie_string, ";", "=")
    except (KeyError, TypeError):
        pass
    return event