Returns whether or not a lock exists.

@param Request $request A Request instance

@return bool true if lock exists, false otherwise
503293
public function isLocked(Request $request)
    {
        $cacheKey = $this->getCacheKey($request);

        if (!isset($this->locks[$cacheKey])) {
            return false;
        }

        return $this->locks[$cacheKey]->isAcquired();
    }
1268147
private function isFromTrustedProxy(Request $request)
    {
        return $request->getTrustedProxies() && IpUtils::checkIp($request->server->get('REMOTE_ADDR'), $request->getTrustedProxies());
    }
973038
public function sync(Request $request)
    {

        try {
            $logged_in_user = Auth::user();

            $oauth_user = null;
            if ($logged_in_user['oauth_token']) {
                $oauth_user = Socialite::getUserByExistingToken($logged_in_user['oauth_token']);
            }

            if ($oauth_user) {
                $tokenly_uuid       = $oauth_user->id;
                $oauth_token        = $oauth_user->token;
                $username           = $oauth_user->user['username'];
                $name               = $oauth_user->user['name'];
                $email              = $oauth_user->user['email'];
                $email_is_confirmed = $oauth_user->user['email_is_confirmed'];

                // find an existing user based on the credentials provided
                $existing_user = User::where('tokenly_uuid', $tokenly_uuid);
                if ($existing_user) {
                    // update
                    $existing_user->update(['name' => $name, 'email' => $email, /* etc */ ]);
                }

                $synced = true;
            } else {
                // not able to sync this user
                $synced = false;
            }

            return view('account.sync', ['synced' => $synced, 'user' => $logged_in_user, ]);

        } catch (Exception $e) {
            return view('account.sync-failed', ['error_msg' => 'Failed to sync this user.']);
        }
    }
1239369
public function isAuthenticated(Request $request): bool
    {
        foreach ($this->authentications as $authentication) {
            if ($authentication->isAuthenticated($request)) {
                return true;
            }
        }

        return false;
    }
771059
public function canSkip(Request $request)
    {
        $routeName = $request->route()->getName();

        return in_array($routeName, $this->preventRouteNames, true);
    }
1299141
public function assignRequest(Request $request)
    {
        $extracted = $this->extractData($request);

        if (count($extracted)) {
            foreach ($this->getAttributeNames() as $key) {
                if (array_key_exists($key, $extracted)) {
                    $this->{$key} = $extracted[$key];
                }
            }
            return true;
        }

        return false;
    }
794110
protected function retriesLeft(Request $request)
    {
        $rateLimiter = App::make('Nova\Cache\RateLimiter');

        $attempts = $rateLimiter->attempts($this->getThrottleKey($request));

        return $this->maxLoginAttempts() - $attempts + 1;
    }
84122
public function isLocked($resource = null): bool
    {
        return $this->hasSharedLock($resource) || $this->hasExclusiveLock($resource);
    }
505500
protected function applyLock($resource)
    {
        if ($this->shouldLock === false) {
            $this->lockApplied = false;
            return flock($resource, LOCK_UN);
        }

        $lock = $this->shouldLock === true ? $this->getLockMode() : $this->shouldLock;


        if (!flock($resource, $lock)) {
            return false;
        }

        $this->lockApplied = true;

        return true;
    }
753976
private function waitForLock(Request $request): bool
    {
        $wait = 0;
        while ($this->store->isLocked($request) && $wait < 100) {
            usleep(50000);
            ++$wait;
        }

        return $wait < 100;
    }
531119
protected function isAllowed($request)
    {
        try {
            $decrypted = Crypt::decrypt($request->get('key'));
        } catch (DecryptException $e) {
            $decrypted = '';
        }

        return $decrypted == 'opcache' || in_array($this->getRequestIp($request), [$this->getServerIp(), '127.0.0.1', '::1']);
    }
1193279
protected function hasNotExpired($request) : bool
  {
    if (!isset($_SESSION['_cksal'])) return false;

    $this->createUrl($request, 'expire');

    if (in_array($request->path(), $this->canExpire)) return true;

    $time = $_SESSION['_cksal'];
    $time = base64_decode($time);

    $expire = config('auth.expire.session_token');

    if(strtotime($time) < strtotime("-$expire")) {
      $this->hasExpired = true;
      return false;
    }

    return true;
  }
1051768
public function containsRequest(RequestInterface $request)
    {
        return in_array($request, $this->failedRequests, true) || in_array($request, $this->successfulRequests, true);
    }
179533
private function isCachable(Request $request)
    {
        if ($this->cachable === null) {
            $this->cachable = $request->method() === 'GET' && !app()->environment('local') && $this->minutesToCache > 0;
        }

        return $this->cachable;
    }
435381
protected function hasTooManyLoginAttempts( Request $request )
	{
		return UniversalBuilder::resolveClass( RateLimiter::class )->tooManyAttempts( $this->getThrottleKey( $request ), $this->maxLoginAttempts(), $this->lockoutTime() / 60 );
	}
758331
public function isAuthorised( Request $request )
    {
        $header = $request->headers->get( 'Authorization' );
        $context = new Context( EncryptionFactory::create( $this->algorithm ) );

        if ( $header ) {
            try{
                $this->token = $this->jwt->deserialize( $this->extractJwtFromHeader($header) );
            } catch ( \Exception $e ){
                return false;
            }
        }

        if ( $this->algorithm instanceof None ) {
            return false;
        }

        if( $this->isExpired() || !$this->hasUserId() || !$this->isAllowedAppId() ) {
            return false;
        }

        try {
            return $this->jwt->verify( $this->token, $context );
        } catch ( VerificationException $e ) {
            return false;
        }
    }
1193925
public function isAjax($request = null)
    {
        if ($this->isSingle()) {
            return $request ? $request->isAjax() : RequestKit::isAjax();
        }
        return false;
    }